2022-02-19 10:00:04 +00:00
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "debian/bullseye64"
|
|
|
|
config.vm.provision "install dependencies", type: "shell", inline: <<-SHELL
|
|
|
|
apt-get update
|
2022-02-20 11:24:49 +00:00
|
|
|
apt-get install -y wget expect gpg asciinema ssh adduser fuse
|
2022-02-23 19:50:57 +00:00
|
|
|
mkdir -p /wallpaper
|
|
|
|
wget \
|
|
|
|
--user-agent="borgbackup demo screencast" \
|
|
|
|
--input-file=/vagrant/sample-wallpapers.txt \
|
|
|
|
--directory-prefix=/wallpaper
|
2022-02-19 10:00:04 +00:00
|
|
|
SHELL
|
|
|
|
config.vm.provision "record install", type: "shell", inline: <<-SHELL
|
|
|
|
gpg --recv-keys "6D5B EF9A DD20 7580 5747 B70F 9F88 FB52 FAF7 B393"
|
2022-02-20 11:56:31 +00:00
|
|
|
asciinema rec -c 'expect /vagrant/install.tcl' --overwrite /vagrant/install.json < /dev/null
|
2022-02-19 10:00:04 +00:00
|
|
|
SHELL
|
|
|
|
config.vm.provision "record basic usage", type: "shell", inline: <<-SHELL
|
2022-02-20 08:51:07 +00:00
|
|
|
# `rm` below allows quick re-exec via:
|
2023-01-12 13:42:02 +00:00
|
|
|
# vagrant provision --provision-with "record basic usage"
|
2022-02-20 08:51:07 +00:00
|
|
|
# this is useful when testing changes
|
|
|
|
rm -r /media/backup/borgdemo || true
|
|
|
|
rm -r ~/.ssh/ || true
|
2022-02-23 19:50:57 +00:00
|
|
|
rm -r Wallpaper || true
|
2022-02-20 08:51:07 +00:00
|
|
|
deluser --remove-home borgdemo || true
|
|
|
|
|
2022-02-20 11:24:49 +00:00
|
|
|
# In case we have skipped "record install"
|
2022-02-20 11:31:32 +00:00
|
|
|
if [ ! -e /usr/local/bin/borg ] ; then
|
2022-07-06 21:34:35 +00:00
|
|
|
wget https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64
|
2022-02-20 11:31:32 +00:00
|
|
|
install --owner root --group root --mode 755 borg-linux64 /usr/local/bin/borg
|
|
|
|
fi
|
2022-02-20 11:24:49 +00:00
|
|
|
|
2022-02-19 10:00:04 +00:00
|
|
|
mkdir -p /media/backup/borgdemo
|
2022-02-23 19:50:57 +00:00
|
|
|
mkdir Wallpaper
|
|
|
|
cp -r /wallpaper Wallpaper/bigcollection
|
|
|
|
cp /wallpaper/Trapper_cabin.jpg Wallpaper/deer.jpg
|
2022-02-20 08:51:07 +00:00
|
|
|
|
2022-02-20 11:24:49 +00:00
|
|
|
adduser --disabled-password borgdemo
|
2022-02-20 08:51:07 +00:00
|
|
|
echo '127.0.0.1 remoteserver.example' >> /etc/hosts
|
|
|
|
ssh-keygen -f ~/.ssh/id_rsa -N ''
|
|
|
|
ssh-keyscan remoteserver.example > ~/.ssh/known_hosts
|
|
|
|
runuser -u borgdemo mkdir ~borgdemo/.ssh
|
|
|
|
runuser -u borgdemo tee ~borgdemo/.ssh/authorized_keys < ~/.ssh/id_rsa.pub
|
|
|
|
|
2022-02-20 11:56:31 +00:00
|
|
|
asciinema rec -c 'expect /vagrant/basic.tcl' --overwrite /vagrant/basic.json < /dev/null
|
2022-02-19 10:00:04 +00:00
|
|
|
SHELL
|
2022-02-20 11:24:49 +00:00
|
|
|
config.vm.provision "record advanced usage", type: "shell", inline: <<-SHELL
|
|
|
|
rm -r /media/backup/borgdemo || true
|
2022-02-23 20:45:35 +00:00
|
|
|
rm -r Wallpaper || true
|
2022-02-20 11:24:49 +00:00
|
|
|
|
|
|
|
# In case we have skipped "record install"
|
2022-02-20 11:31:32 +00:00
|
|
|
if [ ! -e /usr/local/bin/borg ] ; then
|
2022-07-06 21:34:35 +00:00
|
|
|
wget https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64
|
2022-02-20 11:31:32 +00:00
|
|
|
install --owner root --group root --mode 755 borg-linux64 /usr/local/bin/borg
|
|
|
|
fi
|
2022-02-20 11:24:49 +00:00
|
|
|
|
|
|
|
mkdir -p /media/backup/borgdemo
|
2022-02-23 20:45:35 +00:00
|
|
|
mkdir Wallpaper
|
|
|
|
cp -r /wallpaper Wallpaper/bigcollection
|
|
|
|
cp /wallpaper/Trapper_cabin.jpg Wallpaper/deer.jpg
|
2022-02-20 11:24:49 +00:00
|
|
|
mkdir -p ~/Downloads/big
|
|
|
|
dd if=/dev/zero of=loopbackfile.img bs=100M count=4
|
|
|
|
losetup /dev/loop0 loopbackfile.img
|
|
|
|
|
2022-02-23 20:45:35 +00:00
|
|
|
# Make it look as if the adv. usage screencast was recorded after basic usage
|
2022-02-20 11:24:49 +00:00
|
|
|
export BORG_PASSPHRASE='1234'
|
|
|
|
borg init --encryption=repokey /media/backup/borgdemo
|
2022-02-23 20:45:35 +00:00
|
|
|
borg create --compression lz4 /media/backup/borgdemo::backup1 Wallpaper
|
|
|
|
echo "new nice file" > Wallpaper/newfile.txt
|
|
|
|
borg create --compression lz4 /media/backup/borgdemo::backup2 Wallpaper
|
|
|
|
mv Wallpaper/bigcollection Wallpaper/bigcollection_NEW
|
|
|
|
borg create --compression lz4 /media/backup/borgdemo::backup3 Wallpaper
|
2022-02-20 11:24:49 +00:00
|
|
|
unset BORG_PASSPHRASE
|
|
|
|
|
2022-02-20 11:56:31 +00:00
|
|
|
asciinema rec -c 'expect /vagrant/advanced.tcl' --overwrite /vagrant/advanced.json < /dev/null
|
2022-02-20 11:24:49 +00:00
|
|
|
SHELL
|
2022-02-19 10:00:04 +00:00
|
|
|
end
|