Compare commits
No commits in common. "f3a49945aae0d52b45eda73cf3eaf770352402cf" and "d12ff5863084b993c2243580cc8b0112fc4c3e4e" have entirely different histories.
f3a49945aa
...
d12ff58630
@ -17,7 +17,7 @@ Then either run `sudo tupper` or wait for the daily cron scheduler to kick in.
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
`dpkg-deb --build . tupper_0.1_all.deb`
|
`dpkg-deb --build . tupper_0.1_any.deb`
|
||||||
|
|
||||||
## TODO / Known pitfalls
|
## TODO / Known pitfalls
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/usr/sbin/tupper backup 2>&1 | tee --append /var/log/tupper.log
|
/usr/sbin/tupper 2>&1 | tee --append /var/log/tupper.log
|
||||||
|
|
||||||
|
@ -3,14 +3,6 @@
|
|||||||
# Inform user
|
# Inform user
|
||||||
echo "Welcome to tupper! Running on $(date)"
|
echo "Welcome to tupper! Running on $(date)"
|
||||||
|
|
||||||
# Check if it is clear what to do
|
|
||||||
ACTION="$1"
|
|
||||||
if [ "$ACTION" != "backup" ] && [ "$ACTION" != "initialize" ]; then
|
|
||||||
echo "tupper requires an action: $0 { initialize | backup }" 1>&2
|
|
||||||
echo "Unrecognized action: $ACTION" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check access rights of config file
|
# Check access rights of config file
|
||||||
CONF="/etc/tupper.conf"
|
CONF="/etc/tupper.conf"
|
||||||
if [ "$(stat -c '%U' $CONF)" != "root" ] && [ "$(stat -c '%A' $CONF)" = "*------" ]; then
|
if [ "$(stat -c '%U' $CONF)" != "root" ] && [ "$(stat -c '%A' $CONF)" = "*------" ]; then
|
||||||
@ -21,7 +13,7 @@ fi
|
|||||||
source "$CONF"
|
source "$CONF"
|
||||||
|
|
||||||
# Check if required variables are set
|
# Check if required variables are set
|
||||||
if [ "$SSH_URI" = "" ] || [ "$SSH_PASS" = "" ] || [ "$TARGET" = "" ]; then
|
if [ "$SSH_URI$SSH_PASS$TARGET" = "" ]; then
|
||||||
echo "Config file $CONF must contain SSH_URI, SSH_PASS and TARGET" 1>&2
|
echo "Config file $CONF must contain SSH_URI, SSH_PASS and TARGET" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -43,12 +35,8 @@ fi
|
|||||||
# Backup
|
# Backup
|
||||||
export BORG_PASSPHRASE
|
export BORG_PASSPHRASE
|
||||||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
|
||||||
if [ "$ACTION" = "initialize" ]; then
|
|
||||||
borg init --encryption=repokey "$TARGET"
|
|
||||||
elif [ "$ACTION" = "backup" ]; then
|
|
||||||
borg create --stats "$MOUNTPOINT::"'{now}' "$TARGET"
|
borg create --stats "$MOUNTPOINT::"'{now}' "$TARGET"
|
||||||
borg list "$MOUNTPOINT"
|
borg list "$MOUNTPOINT"
|
||||||
fi
|
|
||||||
|
|
||||||
# Unmount and clean up mountpoint
|
# Unmount and clean up mountpoint
|
||||||
fusermount -u "$MOUNTPOINT" && \
|
fusermount -u "$MOUNTPOINT" && \
|
||||||
|
Loading…
Reference in New Issue
Block a user