Lines Matching +full:sync +full:- +full:2
1 #!/bin/sh -e
5 # SPDX-License-Identifier: BSD-2-Clause
13 if [ -z "$NAME" ]; then
17 DESC=$2
18 if ! [ -z "$DESC" ]; then
19 DESCOPT="--description '$DESC'"
23 # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
25 fetch -qo $TMPFILE http://169.254.169.254/latest/dynamic/instance-identity/document
26 INST=`awk -F \" '/"instanceId"/ { print $4 }' $TMPFILE`
27 REGION=`awk -F \" '/"region"/ { print $4 }' $TMPFILE`
29 CMD="aws --region $REGION ec2 create-image --instance-id $INST --output text --no-reboot --name '$N…
32 if mount -p | grep -q '/mnt.*ufs'; then
33 echo -n "Unmounting new system image..."
34 sync
36 sync
38 sync
40 elif mount -p | grep -q '/mnt.*zfs'; then
41 echo -n "Unmounting new system image..."
42 sync
43 zfs umount -a
45 sync
47 sync
51 if eval "$CMD" --dry-run 2>&1 |
52 grep -qE 'UnauthorizedOperation|Unable to locate credentials'; then
54 echo "Launch an AMI-builder instance with an appropriate IAM Role,"
62 echo -n "Creating AMI..."