-
Notifications
You must be signed in to change notification settings - Fork 4
/
aws-teardown.sh
27 lines (23 loc) · 703 Bytes
/
aws-teardown.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/bash -x
# Tear everything down again
# Stop polipo
systemctl stop polipo.service
echo "Post-compose disk usage: "
df -h /dev/xvdf1
# Upload repo
if [ -f /srv/rpm-ostree/changed ];
then
echo "Changed. Syncing"
echo "Changed" >$LOGROOT/changed
rm -rf /mnt/data/repo/{tmp,uncompressed-objects-cache,state}
aws s3 sync /mnt/data/repo s3://trees.puiterwijk.org/repo/ --acl public-read --delete
else
echo "Not changed"
fi
# Upload published info
aws s3 sync /srv/rpm-ostree/config/published s3://trees.puiterwijk.org/ --acl public-read
# Sync data and write everything out
sync
umount /mnt/data
# Self-termination
aws ec2 terminate-instances --instance-ids $AWS_INSTANCE_ID