Merge branch 'master' into borg2

This commit is contained in:
Thomas Waldmann 2022-07-23 21:21:41 +02:00
commit dfbf638a5b
10 changed files with 7724 additions and 13960 deletions

View File

@ -0,0 +1,4 @@
Do NOT run the examples without isolation (e.g Vagrant) or
this code may make undesirable changes to your host.
Running `vagrant up` in this directory will update the screencasts.

75
docs/misc/asciinema/Vagrantfile vendored Normal file
View File

@ -0,0 +1,75 @@
Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64"
config.vm.provision "install dependencies", type: "shell", inline: <<-SHELL
apt-get update
apt-get install -y wget expect gpg asciinema ssh adduser fuse
mkdir -p /wallpaper
wget \
--user-agent="borgbackup demo screencast" \
--input-file=/vagrant/sample-wallpapers.txt \
--directory-prefix=/wallpaper
SHELL
config.vm.provision "record install", type: "shell", inline: <<-SHELL
gpg --recv-keys "6D5B EF9A DD20 7580 5747 B70F 9F88 FB52 FAF7 B393"
asciinema rec -c 'expect /vagrant/install.tcl' --overwrite /vagrant/install.json < /dev/null
SHELL
config.vm.provision "record basic usage", type: "shell", inline: <<-SHELL
# `rm` below allows quick re-exec via:
# vagrant vagrant provision --provision-with "record basic usage"
# this is useful when testing changes
rm -r /media/backup/borgdemo || true
rm -r ~/.ssh/ || true
rm -r Wallpaper || true
deluser --remove-home borgdemo || true
# In case we have skipped "record install"
if [ ! -e /usr/local/bin/borg ] ; then
wget https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64
install --owner root --group root --mode 755 borg-linux64 /usr/local/bin/borg
fi
mkdir -p /media/backup/borgdemo
mkdir Wallpaper
cp -r /wallpaper Wallpaper/bigcollection
cp /wallpaper/Trapper_cabin.jpg Wallpaper/deer.jpg
adduser --disabled-password borgdemo
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
asciinema rec -c 'expect /vagrant/basic.tcl' --overwrite /vagrant/basic.json < /dev/null
SHELL
config.vm.provision "record advanced usage", type: "shell", inline: <<-SHELL
rm -r /media/backup/borgdemo || true
rm -r Wallpaper || true
# In case we have skipped "record install"
if [ ! -e /usr/local/bin/borg ] ; then
wget https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64
install --owner root --group root --mode 755 borg-linux64 /usr/local/bin/borg
fi
mkdir -p /media/backup/borgdemo
mkdir Wallpaper
cp -r /wallpaper Wallpaper/bigcollection
cp /wallpaper/Trapper_cabin.jpg Wallpaper/deer.jpg
mkdir -p ~/Downloads/big
dd if=/dev/zero of=loopbackfile.img bs=100M count=4
losetup /dev/loop0 loopbackfile.img
# Make it look as if the adv. usage screencast was recorded after basic usage
export BORG_PASSPHRASE='1234'
borg init --encryption=repokey /media/backup/borgdemo
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
unset BORG_PASSPHRASE
asciinema rec -c 'expect /vagrant/advanced.tcl' --overwrite /vagrant/advanced.json < /dev/null
SHELL
end

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,11 @@
# Configuration for send -h
# Tries to emulate a human typing
# Tweak this if typing is too fast or too slow
set send_human {.05 .1 1 .01 .2}
set script {
# For the pro users, here are some advanced features of borg, so you can impress your friends. ;)
# Note: This screencast was made with borg version 1.1.0 older or newer borg versions may behave differently.
# Note: This screencast was made with __BORG_VERSION__ older or newer borg versions may behave differently.
# First of all, we can use several environment variables for borg.
# E.g. we do not want to type in our repo path and password again and again
@ -27,13 +33,12 @@ borg info :: --last 1
# So let's rename our last archive:
borg rename ::specialbackup backup-block-device
<up>
borg info :: --last 1
# A very important step if you choose keyfile mode (where the keyfile is only saved locally) is to export your keyfile and possibly print it, etc.
borg key export :: --qr-code file.html # this creates a nice HTML, but when you want something simpler
< remove comment >
< let there: borg check > --paper # this is a "manual input"-only backup (but it is also included in the --qr-code option)
borg key export --qr-html :: file.html # this creates a nice HTML, but when you want something simpler
borg key export --paper :: # this is a "manual input"-only backup (but it is also included in the --qr-code option)
## MAINTENANCE ##
# Sometimes backups get broken or we want a regular "checkup" that everything is okay
@ -63,3 +68,18 @@ ls -la /tmp/mount
borg umount /tmp/mount
# That's it, but of course there is more to explore, so have a look at the docs.
}
set script [string trim $script]
set script [string map [list __BORG_VERSION__ [exec borg -V]] $script]
set script [split $script \n]
set ::env(PS1) "$ "
set stty_init -echo
spawn -noecho /bin/sh
foreach line $script {
expect "$ "
send_user -h $line\n
send $line\n
}
expect "$ "

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,11 @@
# Configuration for send -h
# Tries to emulate a human typing
# Tweak this if typing is too fast or too slow
set send_human {.05 .1 1 .01 .2}
set script {
# Here you'll see some basic commands to start working with borg.
# Note: This teaser screencast was made with borg version 1.1.0 older or newer borg versions may behave differently.
# Note: This teaser screencast was made with __BORG_VERSION__ older or newer borg versions may behave differently.
# But let's start.
# First of all, you can always get help:
@ -16,7 +22,6 @@ borg create --stats --progress --compression lz4 /media/backup/borgdemo::backup1
# So let's add a new file
echo "new nice file" > Wallpaper/newfile.txt
<up>
borg create --stats --progress --compression lz4 /media/backup/borgdemo::backup2 Wallpaper
# Wow, this was a lot faster!
@ -24,7 +29,7 @@ borg create --stats --progress --compression lz4 /media/backup/borgdemo::backup2
# Borg recognized that most files did not change and deduplicated them.
# But what happens, when we move a dir and create a new backup?
mv
mv Wallpaper/bigcollection Wallpaper/bigcollection_NEW
borg create --stats --progress --compression lz4 /media/backup/borgdemo::backup3 Wallpaper
@ -40,7 +45,8 @@ borg list /media/backup/borgdemo::backup3 | grep 'deer.jpg'
# Oh, we found our picture. Now extract it
mv Wallpaper Wallpaper.orig
borg extract /media/backup/borgdemo::backup3 <copy>
borg extract /media/backup/borgdemo::backup3 Wallpaper/deer.jpg
# And check that it's the same:
diff -s Wallpaper/deer.jpg Wallpaper.orig/deer.jpg
@ -51,3 +57,33 @@ borg init --encryption=repokey borgdemo@remoteserver.example:./demo
# Easy, isn't it? That's all you need to know for basic usage.
# If you want to see more, have a look at the screencast showing the "advanced usage".
# In any case, enjoy using borg!
}
set script [string trim $script]
set script [string map [list __BORG_VERSION__ [exec borg -V]] $script]
set script [split $script \n]
foreach line $script {
send_user "$ "
send_user -h $line\n
spawn -noecho /bin/sh -c $line
expect {
"Enter new passphrase: " {
send -h "correct horse battery staple\n"
exp_continue
}
"Enter same passphrase again: " {
send -h "correct horse battery staple\n"
exp_continue
}
"Enter passphrase for key /media/backup/borgdemo: " {
send -h "correct horse battery staple\n"
exp_continue
}
-ex {Do you want your passphrase to be displayed for verification? [yN]: } {
send \n
exp_continue
}
eof
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,15 @@
# Configuration for send -h
# Tries to emulate a human typing
# Tweak this if typing is too fast or too slow
set send_human {.05 .1 1 .01 .2}
set script [string trim {
# This asciinema will show you the installation of borg as a standalone binary. Usually you only need this if you want to have an up-to-date version of borg or no package is available for your distro/OS.
# First, we need to download the version, we'd like to install
wget -q --show-progress https://github.com/borgbackup/borg/releases/download/1.1.0b6/borg-linux64
wget -q --show-progress https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64
# and do not forget the GPG signature!
wget -q --show-progress https://github.com/borgbackup/borg/releases/download/1.1.0b6/borg-linux64.asc
wget -q --show-progress https://github.com/borgbackup/borg/releases/download/1.2.1/borg-linux64.asc
# In this case, we have already imported the public key of a borg developer. So we only need to verify it:
gpg --verify borg-linux64.asc
@ -19,3 +25,14 @@ sudo chmod 755 /usr/local/bin/borg
borg -V
# That's it! Check out the other screencasts to see how to actually use borgbackup.
}]
# wget may be slow
set timeout -1
foreach line [split $script \n] {
send_user "$ "
send_user -h $line\n
spawn -noecho /bin/sh -c $line
expect eof
}

View File

@ -0,0 +1,30 @@
https://upload.wikimedia.org/wikipedia/commons/2/22/Pseudo_kleinian_001_OpenCL_45154214_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/d/da/Mengerschwamm_Iteration_5_x_Mandelbulb_OpenCL_528814521414_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/e/eb/Blixos_logon_screen.jpg
https://upload.wikimedia.org/wikipedia/commons/9/90/Great_smokey_mountains_national_park_with_woman_sitting_under_tree_in_foreground.jpg
https://upload.wikimedia.org/wikipedia/commons/d/d2/Mengerschwamm_x_Generalized_Fold_Box_OpenCL_18915424_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/3/3d/Red_interesting_background.jpg
https://upload.wikimedia.org/wikipedia/commons/4/43/KIFS_OpenCL_54815_5K.jpg
https://upload.wikimedia.org/wikipedia/commons/a/a1/ProjectStealth.png
https://upload.wikimedia.org/wikipedia/commons/8/8d/KIFS_OpenCL_5434735835_5K.jpg
https://upload.wikimedia.org/wikipedia/commons/d/db/Harvett_Fox_-_Wallpaper_%2816x9_ratio%2C_without_character_logo%2C_transparent_variant%29_%28vector_version%29.svg
https://upload.wikimedia.org/wikipedia/commons/7/7f/Generalized_Fold_Box_OpenCL_4258952414_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/5/58/Mandelbox_Vary_Scale_4D_OpenCL_9648145412_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/6/62/Trapper_cabin.jpg
https://upload.wikimedia.org/wikipedia/commons/f/fd/Openarch.png
https://upload.wikimedia.org/wikipedia/commons/a/a5/Mandelbox_-_Variable_8K_6595424.jpg
https://upload.wikimedia.org/wikipedia/commons/d/d6/Mengerschwamm_Iteration_6_x_Generalized_Fold_Box_OpenCL_14048152404910_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/c/cf/Sierp_Oktaeder_x_Menger_4D_OpenCL_51241841541_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/5/59/Airbus_Wing_01798_changed.jpg
https://upload.wikimedia.org/wikipedia/commons/8/8a/Holytrinfruitlandpark1b.jpg
https://upload.wikimedia.org/wikipedia/commons/5/5c/Abox_-_Mod_12_OpenCL_45184521485_5K.jpg
https://upload.wikimedia.org/wikipedia/commons/d/d2/Menger_4D_x_Quaternion_OpenCL_644289452_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/3/3e/Gabrielsond.jpg
https://upload.wikimedia.org/wikipedia/commons/8/80/Mix_Pinski_4D_x_Mengerschwamm_OpenCL_461481542_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/8/84/Belinda_Vixen_-_Wallpaper_%28without_character_wordmark_and_hair_variant%29_%2816x9_ratio%29.jpg
https://upload.wikimedia.org/wikipedia/commons/0/00/Sierp_Oktaeder_Iteration_7_x_Menger_4D_OpenCL_2154188450481_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/2/24/Abox_4D_OpenCL_545185481_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/0/08/Sierpinski_4D_OpenCL_485274854_5K.jpg
https://upload.wikimedia.org/wikipedia/commons/0/09/Vereinigung_Sierpinski_4D_und_Mengerschwamm_OpenCl_6184524.jpg
https://upload.wikimedia.org/wikipedia/commons/a/ae/Mengerschwamm_OpenCL_955141845_8K.jpg
https://upload.wikimedia.org/wikipedia/commons/6/64/Free_high-resolution_pictures_you_can_use_on_your_personal_and_commercial_projects._%2814168975789%29.jpg

View File

@ -3,7 +3,11 @@ requires = ["setuptools", "pkgconfig", "Cython", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
# make sure we have the same versioning scheme with all setuptools_scm versions, to avoid different autogenerated files
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1015052
# https://github.com/borgbackup/borg/issues/6875
write_to = "src/borg/_version.py"
write_to_template = "__version__ = version = {version!r} \n__version_tuple__ = version_tuple = {version_tuple!r}"
[tool.black]
line-length = 120