diff options
author | Chris Severance | 2016-08-12 14:49:12 -0400 |
---|---|---|
committer | Chris Severance | 2016-08-12 14:49:12 -0400 |
commit | b24cec9fba35395196699a6cb72c9a85101e285e (patch) | |
tree | 30e7b89c455423fc76e3b8156fd94dc4998b9c90 | |
parent | 5fcbda2cd56752864b3021fbb2f7b548a20cab21 (diff) | |
download | aur-b24cec9fba35395196699a6cb72c9a85101e285e.tar.gz |
Update to 2.0.32
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | PKGBUILD | 39 | ||||
-rw-r--r-- | btrfs_create_filesystem_snapshot | 33 | ||||
-rw-r--r-- | btrfs_remove_filesystem_snapshot | 35 | ||||
-rw-r--r-- | dattobd_create_filesystem_snapshot | 87 | ||||
-rw-r--r-- | dattobd_remove_filesystem_snapshot | 74 | ||||
-rw-r--r-- | defaults_client | 40 | ||||
-rw-r--r-- | lvm_create_filesystem_snapshot | 67 | ||||
-rw-r--r-- | lvm_remove_filesystem_snapshot | 56 | ||||
-rw-r--r-- | urbackup-client.service | 12 |
10 files changed, 443 insertions, 24 deletions
@@ -1,8 +1,8 @@ # Generated by mksrcinfo v8 -# Mon Jul 25 01:24:52 UTC 2016 +# Fri Aug 12 18:48:08 UTC 2016 pkgbase = urbackup-server-git pkgdesc = Client/Server network backup for Windows and Linux, builds server or client - pkgver = 2.0.31.r32.gb0dd8fd + pkgver = 2.0.32.r2.g85303a6 pkgrel = 1 url = https://www.urbackup.org/ install = urbackup-server.install @@ -15,14 +15,28 @@ pkgbase = urbackup-server-git depends = crypto++ depends = fuse optdepends = btrfs-progs: compressed and subvolume assisted backups - provides = urbackup-server=2.0.31 + provides = urbackup-server=2.0.32 conflicts = urbackup-server source = git+https://github.com/uroni/urbackup_backend.git source = git+https://github.com/uroni/urbackup_frontend_wx.git - source = urbackup-client.service + source = btrfs_create_filesystem_snapshot + source = btrfs_remove_filesystem_snapshot + source = dattobd_create_filesystem_snapshot + source = dattobd_remove_filesystem_snapshot + source = lvm_create_filesystem_snapshot + source = lvm_remove_filesystem_snapshot + source = defaults_client + source = https://www.cryptopp.com/cryptopp563.zip sha256sums = SKIP sha256sums = SKIP - sha256sums = e4c40d10909417cd04898388bab41aa6434375b62944183f132e606ed71f70b2 + sha256sums = 18b5eceb73086b86d904f80e9270df121d06d7c683f93c5449a82e7deb38e0ee + sha256sums = 334d9eb67a642d96e04874fd27c1b57d578c35b4cdc768d50db7ac2436f0927c + sha256sums = 869e6244efbf6e370938e2e5c94a16c0130f583815ddbd34802578656989048b + sha256sums = 23d6bdad352d33fe41acd50e0114f986cd4324c2c65ca16cea365cb99d90addd + sha256sums = d5b462879e7c80139688c9d20ce1b1fe553386df9459def5e1d093d3a13d71fb + sha256sums = 0ffb3bbbf5faf939564681d24786767a4706132f2f081b7a870ecc718a8e9413 + sha256sums = d77fa6ad67141ae5cb4c3c6953783ce54aaaa3c1f2fe5bb28cd20948ddda12c4 + sha256sums = 9390670a14170dd0f48a6b6b06f74269ef4b056d4718a1a329f6f6069dc957c9 pkgname = urbackup-server-git @@ -45,7 +45,7 @@ else _pkgname='urbackup-server' fi pkgname="${_pkgname}-git" -pkgver=2.0.31.r32.gb0dd8fd +pkgver=2.0.32.r2.g85303a6 pkgrel=1 pkgdesc='Client/Server network backup for Windows and Linux, builds server or client' arch=('i686' 'x86_64') @@ -57,10 +57,24 @@ provides=("${_pkgname}=${pkgver%.r*}") conflicts=("${_pkgname}") install="${_pkgname}.install" _verwatch=("${url}/download.html" '//hndl\.urbackup\.org/Server/[0-9\.]\+/urbackup-server-\([0-9\.]\+\)\.tar\.gz' 'l') -source=('git+https://github.com/uroni/urbackup_backend.git' 'git+https://github.com/uroni/urbackup_frontend_wx.git' 'urbackup-client.service') +_scripts=('btrfs_create_filesystem_snapshot' + 'btrfs_remove_filesystem_snapshot' + 'dattobd_create_filesystem_snapshot' + 'dattobd_remove_filesystem_snapshot' + 'lvm_create_filesystem_snapshot' + 'lvm_remove_filesystem_snapshot') +source=('git+https://github.com/uroni/urbackup_backend.git' 'git+https://github.com/uroni/urbackup_frontend_wx.git' "${_scripts[@]}" 'defaults_client') +source+=('https://www.cryptopp.com/cryptopp563.zip') sha256sums=('SKIP' 'SKIP' - 'e4c40d10909417cd04898388bab41aa6434375b62944183f132e606ed71f70b2') + '18b5eceb73086b86d904f80e9270df121d06d7c683f93c5449a82e7deb38e0ee' + '334d9eb67a642d96e04874fd27c1b57d578c35b4cdc768d50db7ac2436f0927c' + '869e6244efbf6e370938e2e5c94a16c0130f583815ddbd34802578656989048b' + '23d6bdad352d33fe41acd50e0114f986cd4324c2c65ca16cea365cb99d90addd' + 'd5b462879e7c80139688c9d20ce1b1fe553386df9459def5e1d093d3a13d71fb' + '0ffb3bbbf5faf939564681d24786767a4706132f2f081b7a870ecc718a8e9413' + 'd77fa6ad67141ae5cb4c3c6953783ce54aaaa3c1f2fe5bb28cd20948ddda12c4' + '9390670a14170dd0f48a6b6b06f74269ef4b056d4718a1a329f6f6069dc957c9') _srcdir='urbackup_backend' if [ "${_opt_BuildClient}" -ne 0 ]; then unset install @@ -154,8 +168,14 @@ prepare() { -e 's:^git reset:#&:g' \ -e "# Version updates are now done here in PKGBUILD" \ -e 's:^python3 :#&:g' \ + -e "# Instruct wget to resume our complete download" \ + -e 's:^\s\+wget :&--continue :g' \ 'build_server.Arch.sh' 'build_client.Arch.sh' + # Dymanic downloads in configure are bad! + #ln -s "${srcdir}/cryptopp563.zip" 'cryptoplugin/cryptopp563.zip' + cp -p "${srcdir}/cryptopp563.zip" 'cryptoplugin/cryptopp563.zip' + if [ "${_opt_BuildClient}" -ne 0 ]; then ln -sf '../urbackup_frontend_wx' 'client' @@ -200,10 +220,15 @@ package() { make -s DESTDIR="${pkgdir}" install if [ "${_opt_BuildClient}" -ne 0 ]; then - install -Dm644 "${srcdir}/urbackup-client.service" -t "${pkgdir}/usr/lib/systemd/system/" - sed -i -e 's:/usr/sbin/:/usr/bin/:g' "${pkgdir}/usr/lib/systemd/system/urbackup-client.service" - install -Dm644 "docs/start_urbackup_client.1" -t "${pkgdir}/usr/share/man/man1/" - install -Dm644 "docs/urbackup_client.1" -t "${pkgdir}/usr/share/man/man1/" + # urbackup2 client uses a different service name. Changing the server name is not cool. + install -Dpm644 'urbackupclientbackend-debian.service' "${pkgdir}/usr/lib/systemd/system/urbackup-client.service" + # urbackup2 client changed the service name. + ln -s 'urbackup-client.service' "${pkgdir}/usr/lib/systemd/system/urbackupclientbackend.service" + sed -i -e 's:/usr/local/sbin/:/usr/bin/:g' "${pkgdir}/usr/lib/systemd/system/urbackup-client.service" + install -Dpm644 "docs/urbackupclientbackend.1" -t "${pkgdir}/usr/share/man/man1/" + cd "${srcdir}" + install -Dpm644 'defaults_client' "${pkgdir}/etc/default/urbackupclient" + install -Dpm700 "${_scripts[@]}" -t "${pkgdir}/usr/share/urbackup/" else # Correct some file mode bits, thanks cfstras (from urbackup2) chmod a+x "${pkgdir}/usr/share/urbackup/www/"{css,fonts,js,images,} diff --git a/btrfs_create_filesystem_snapshot b/btrfs_create_filesystem_snapshot new file mode 100644 index 000000000000..5d9375489af4 --- /dev/null +++ b/btrfs_create_filesystem_snapshot @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +mkdir -p /mnt/urbackup_snaps + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" +SNAP_NAME="$3" +SNAP_ORIG_PATH="$4" +SNAP_DEST=/mnt/urbackup_snaps/$SNAP_ID + +TYPE=$(df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f2) + +if [[ $TYPE == "" ]] +then + if btrfs subvolume list -o "$SNAP_MOUNTPOINT" > /dev/null 2>&1 + then + TYPE="btrfs" + fi +fi + +if [[ $TYPE == "btrfs" ]] +then + btrfs subvolume snapshot -r "$SNAP_MOUNTPOINT" "$SNAP_DEST" +else + echo "Cannot create snapshot of file system with type $TYPE" + exit 1 +fi + +echo "SNAPSHOT=$SNAP_DEST" + +exit 0
\ No newline at end of file diff --git a/btrfs_remove_filesystem_snapshot b/btrfs_remove_filesystem_snapshot new file mode 100644 index 000000000000..e3377ca47439 --- /dev/null +++ b/btrfs_remove_filesystem_snapshot @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" +SNAP_NAME="$3" +SNAP_DEST="$4" +SNAP_ORIG_PATH="$5" + +if ! test -e $SNAP_MOUNTPOINT +then + echo "Snapshot at $SNAP_MOUNTPOINT was already removed" + exit 0 +fi + +TYPE=$(df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" | tr -s " " | cut -d" " -f2) + +if [[ $TYPE == "" ]] +then + if btrfs subvolume list -o "$SNAP_MOUNTPOINT" > /dev/null 2>&1 + then + TYPE="btrfs" + fi +fi + +if [[ $TYPE == "btrfs" ]] +then + btrfs subvolume delete "$SNAP_MOUNTPOINT" +else + echo "Cannot remove snapshot at $SNAP_MOUNTPOINT. File system type $TYPE not supported." + exit 1 +fi + +exit 0
\ No newline at end of file diff --git a/dattobd_create_filesystem_snapshot b/dattobd_create_filesystem_snapshot new file mode 100644 index 000000000000..c4faa3612ddf --- /dev/null +++ b/dattobd_create_filesystem_snapshot @@ -0,0 +1,87 @@ +#!/bin/sh + +set -e + +mkdir -p /mnt/urbackup_snaps + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" +SNAP_DEST=/mnt/urbackup_snaps/$SNAP_ID + +DEVICE=$(df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f1) +TYPE=$(df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f2) + +if [ "x$DEVICE" = "x" ] +then + echo "Cannot get device for filesystem $SNAP_MOUNTPOINT" + exit 1 +fi + +echo "Snapshotting device $DEVICE via dattobd..." + +NUM=0 + +while [ -e "/dev/datto$NUM" ] +do + NUM=`expr $NUM + 1` +done + +if ! modprobe dattobd +then + echo "Dattobd kernel module not available" + exit 1 +fi + +echo "Using /dev/datto$NUM..." + +sync + +dbdctl setup-snapshot "$DEVICE" "$SNAP_MOUNTPOINT/.datto_$SNAP_ID" $NUM + +echo $NUM > ${SNAP_DEST}-num + +DEV_SIZE=`blockdev --getsize /dev/datto$NUM` + +truncate -s100M $SNAP_MOUNTPOINT/.overlay_$SNAP_ID + +LODEV=`losetup -f` + +if [ "x$LODEV" = x ] +then + rm "${SNAP_DEST}-num" + rm $SNAP_MOUNTPOINT/.overlay_$SNAP_ID + dbdctl destroy $NUM + exit 1 +fi + + +losetup $LODEV $SNAP_MOUNTPOINT/.overlay_$SNAP_ID + +echo "0 $DEV_SIZE snapshot /dev/datto$NUM $LODEV N 8" | dmsetup create "wsnap-$SNAP_ID" + +echo "Mounting /dev/mapper/wsnap-$SNAP_ID..." + +mkdir -p $SNAP_DEST + +MOUNTOPTS="ro" + +if [ $TYPE = "xfs" ] +then + MOUNTOPTS="ro,nouuid" +fi + +if ! mount -o $MOUNTOPTS /dev/mapper/wsnap-$SNAP_ID $SNAP_DEST +then + echo "Mounting filesystem failed" + rmdir "$SNAP_DEST" + rm "${SNAP_DEST}-num" + dmsetup remove "wsnap-$SNAP_ID" + losetup -d $LODEV + rm $SNAP_MOUNTPOINT/.overlay_$SNAP_ID + dbdctl destroy $NUM + exit 1 +fi + +echo "SNAPSHOT=$SNAP_DEST" + +exit 0
\ No newline at end of file diff --git a/dattobd_remove_filesystem_snapshot b/dattobd_remove_filesystem_snapshot new file mode 100644 index 000000000000..16c9a63f0529 --- /dev/null +++ b/dattobd_remove_filesystem_snapshot @@ -0,0 +1,74 @@ +#!/bin/sh + +set -e + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" +SNAP_ORIG_PATH="$5" + +remove_overlay() { + if test -e "$SNAP_ORIG_PATH/.overlay_$SNAP_ID" + then + LODEV=`losetup -j "$SNAP_ORIG_PATH/.overlay_$SNAP_ID" | cut -d':' -f1` + if [ "x$LODEV" != x ] + then + losetup -d $LODEV + fi + rm "$SNAP_ORIG_PATH/.overlay_$SNAP_ID" + fi +} + +if ! test -e $SNAP_MOUNTPOINT +then + echo "Snapshot at $SNAP_MOUNTPOINT was already removed" + [ ! -e "$SNAP_ORIG_PATH/.datto_$SNAP_ID" ] || rm "$SNAP_ORIG_PATH/.datto_$SNAP_ID" + [ ! -e "${SNAP_MOUNTPOINT}-num" ] || rm "${SNAP_MOUNTPOINT}-num" + remove_overlay + exit 0 +fi + +if ! df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" > /dev/null 2>&1 +then + echo "Snapshot is not mounted. Already removed" + rm "${SNAP_MOUNTPOINT}-num" + rmdir "${SNAP_MOUNTPOINT}" + [ ! -e "$SNAP_ORIG_PATH/.datto_$SNAP_ID" ] || rm "$SNAP_ORIG_PATH/.datto_$SNAP_ID" + remove_overlay + exit 0 +fi + +NUM=`cat "${SNAP_MOUNTPOINT}-num"` || true + +if [ "x$NUM" = "x" ] +then + echo "Cannot get device number from ${SNAP_MOUNTPOINT}-num" + exit 1 +fi + +echo "Unmounting /dev/datto$NUM at /mnt/urbackup_snaps/$SNAP_ID..." + +if ! umount /mnt/urbackup_snaps/$SNAP_ID +then + lsof | grep /mnt/urbackup_snaps/$SNAP_ID || true + echo "Unmounting /mnt/urbackup_snaps/$SNAP_ID failed. Retrying in 10s..." + sleep 10 + umount /mnt/urbackup_snaps/$SNAP_ID +fi + + +rm "${SNAP_MOUNTPOINT}-num" +rmdir "${SNAP_MOUNTPOINT}" + +echo "Removing devicemapper snapshot..." + +dmsetup remove "wsnap-$SNAP_ID" + +remove_overlay + +echo "Destroying dattobd snapshot /dev/datto$NUM..." + +dbdctl destroy $NUM + +[ ! -e "$SNAP_ORIG_PATH/.datto_$SNAP_ID" ] || rm "$SNAP_ORIG_PATH/.datto_$SNAP_ID" + +exit 0
\ No newline at end of file diff --git a/defaults_client b/defaults_client new file mode 100644 index 000000000000..2e4b108d9a99 --- /dev/null +++ b/defaults_client @@ -0,0 +1,40 @@ +# Defaults for urbackup_client initscript +# sourced by /etc/init.d/urbackupclientbackend +# installed at /etc/default/urbackupclient by the maintainer scripts + +# +# This is parsed as a key=value file +# + +#logfile name +LOGFILE="/var/log/urbackupclient.log" + +#Either debug,warn,info or error +LOGLEVEL=warn + +#Max size of the log file before rotation +#Disable if you are using logrotate for +#more advanced configurations (e.g. with compression) +LOG_ROTATE_FILESIZE=20971520 + +#Max number of log files during rotation +LOG_ROTATE_NUM=10 + +#Tmp file directory +DAEMON_TMPDIR="/tmp" + +# Valid settings: +# +# "client-confirms": If you have the GUI component the currently active user +# will need to confirm restores from the web interface. +# If you have no GUI component this will cause restores +# from the server web interface to not work +# "server-confirms": The server will ask the user starting the restore on +# the web interface for confirmation +# "disabled": Restores via web interface are disabled. +# Restores via urbackupclientctl still work +# +RESTORE=disabled + +#If true client will not bind to any external network ports (either true or false) +INTERNET_ONLY=false diff --git a/lvm_create_filesystem_snapshot b/lvm_create_filesystem_snapshot new file mode 100644 index 000000000000..3c919743f726 --- /dev/null +++ b/lvm_create_filesystem_snapshot @@ -0,0 +1,67 @@ +#!/bin/sh + +set -e + +#For 20GB +#SNAP_SIZE="-L20G" +SNAP_SIZE="-l50%FREE" + +mkdir -p /mnt/urbackup_snaps + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" +SNAP_DEST=/mnt/urbackup_snaps/$SNAP_ID + +if lsblk -r --output "NAME,MOUNTPOINT" --paths > /dev/null 2>&1 +then + VOLNAME=`lsblk -r --output "NAME,MOUNTPOINT" --paths | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f1` +else + VOLNAME=`lsblk -r --output "NAME,MOUNTPOINT" | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f1` + VOLNAME="/dev/mapper/$VOLNAME" +fi + +TYPE=`df -T -P | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f2` + +if [ "x$VOLNAME" = x ] +then + echo "Could not find LVM volume for mountpoint ${SNAP_MOUNTPOINT}" + exit 1 +fi + +export LVM_SUPPRESS_FD_WARNINGS=1 + +VGNAME=`lvdisplay "$VOLNAME" | grep "VG Name" | tr -s " " | cut -d" " -f4` +if [ "x$VGNAME" = x ] +then + echo "Could not find LVM volume group of volume $VOLNAME" + exit 1 +fi + +if [ "x$SNAP_ID" = x ] +then + echo "No snapshot id specified" + exit 1 +fi + +lvcreate $SNAP_SIZE -s -n urbackup_snap_$SNAP_ID "$VOLNAME" + +mkdir -p /mnt/urbackup_snaps/$SNAP_ID + +MOUNTOPTS="ro" + +if [ $TYPE = "xfs" ] +then + MOUNTOPTS="ro,nouuid" +fi + +if ! mount -o $MOUNTOPTS /dev/$VGNAME/urbackup_snap_$SNAP_ID /mnt/urbackup_snaps/$SNAP_ID +then + echo "Mounting filesystem failed" + rmdir /mnt/urbackup_snaps/$SNAP_ID + lvremove -f /dev/$VGNAME/urbackup_snap_$SNAP_ID + exit 1 +fi + +echo "SNAPSHOT=/mnt/urbackup_snaps/$SNAP_ID" + +exit 0
\ No newline at end of file diff --git a/lvm_remove_filesystem_snapshot b/lvm_remove_filesystem_snapshot new file mode 100644 index 000000000000..e46c927607df --- /dev/null +++ b/lvm_remove_filesystem_snapshot @@ -0,0 +1,56 @@ +#!/bin/sh + +set -e + +SNAP_ID=$1 +SNAP_MOUNTPOINT="$2" + +if ! test -e $SNAP_MOUNTPOINT +then + echo "Snapshot at $SNAP_MOUNTPOINT was already removed" + exit 0 +fi + +if ! df -T -P | egrep "${SNAP_MOUNTPOINT}\$" > /dev/null 2>&1 +then + echo "Snapshot is not mounted. Already removed" + rmdir "${SNAP_MOUNTPOINT}" + exit 0 +fi + +if lsblk -r --output "NAME,MOUNTPOINT" --paths > /dev/null 2>&1 +then + VOLNAME=`lsblk -r --output "NAME,MOUNTPOINT" --paths | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f1` +else + VOLNAME=`lsblk -r --output "NAME,MOUNTPOINT" | egrep " ${SNAP_MOUNTPOINT}\$" | head -n 1 | tr -s " " | cut -d" " -f1` + VOLNAME="/dev/mapper/$VOLNAME" +fi + +if [ "x$VOLNAME" = x ] +then + echo "Could not find LVM volume for mountpoint ${SNAP_MOUNTPOINT}" + exit 1 +fi + +if [ ! -e "$VOLNAME" ] +then + echo "LVM volume for mountpoint ${SNAP_MOUNTPOINT} does not exist" + exit 1 +fi + +echo "Unmounting $VOLNAME at /mnt/urbackup_snaps/$SNAP_ID..." + +if ! umount /mnt/urbackup_snaps/$SNAP_ID +then + lsof | grep /mnt/urbackup_snaps/$SNAP_ID || true + sleep 10 + umount /mnt/urbackup_snaps/$SNAP_ID +fi + +rmdir "${SNAP_MOUNTPOINT}" + +echo "Destroying LVM snapshot $VOLNAME..." + +export LVM_SUPPRESS_FD_WARNINGS=1 + +lvremove -f "$VOLNAME" diff --git a/urbackup-client.service b/urbackup-client.service deleted file mode 100644 index aad06fb3d751..000000000000 --- a/urbackup-client.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=UrBackup Client -After=syslog.target network.target - -[Service] -Type=forking -NotifyAccess=all -PIDFile=/run/urbackup_client.pid -ExecStart=/usr/sbin/start_urbackup_client --logfile urbackup_client.log --loglevel error - -[Install] -WantedBy=multi-user.target |