Ai
1 Star 0 Fork 0

wangcichen/urbackup_backend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
install_client_linux.sh 26.91 KB
一键复制 编辑 原始数据 按行查看 历史
Martin 提交于 2023-04-01 23:18 +08:00 . Make systemd location change backwards compatible
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
#!/bin/sh
set -e
restore_image () {
if ! [ -t 1 ]
then
echo "Error: Stdout is not a TTY. Not running non-interactively"
exit 5
fi
USER=`whoami`
if [ "x$USER" != "xroot" ]
then
echo "Sorry, you must be super user to restore an image. Try again with sudo?"
exit 6
fi
if ! command -v systemctl >/dev/null 2>&1
then
echo "Sorry, image restore only works with systemd present currently."
exit 7
fi
echo "Uncompressing data..."
tar xzf install-data.tar.gz
sh restore_linux_img.sh "$SERVER_NAME" "$SERVER_PORT" "$SERVER_PROXY" "$RESTORE_AUTHKEY" "$RESTORE_TOKEN" "$PREFIX"
exit $?
}
cat << EOF > /dev/null
#ab6b754c02624b348795c92da78b1e73$version$
EOF
#e1128bd07afd40a0a2752818730589ef
RESTORE_IMAGE=0
################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#902761a5525a4007add0b016a35af985
#Cannot be changed as paths are compiled into the binaries
PREFIX=/usr/local
if [ $RESTORE_IMAGE = 1 ]
then
restore_image
exit $?
fi
SILENT=no
if [ "x$1" = "xsilent" ]
then
SILENT=yes
fi
if ! [ -t 1 ]
then
echo "Stdout is not a TTY. Running non-interactively"
SILENT=yes
fi
USER=`whoami`
if [ "x$USER" != "xroot" ]
then
echo "Sorry, you must be super user to install UrBackup Client. Try again with sudo?"
exit 6
fi
if [ $SILENT = no ]
then
echo "Installation of UrBackup Client $version_short$ to $PREFIX ... Proceed ? [Y/n]"
read yn
if [ "x$yn" = xn ]
then
exit 5
fi
else
echo "Installation of UrBackup Client $version_short$..."
fi
echo "Uncompressing install data..."
tar xzf install-data.tar.gz
DEBIAN=no
if [ -e /etc/debian_version ]
then
DEBIAN=yes
echo "Detected Debian \(derivative\) system"
mv urbackupclientbackend-debian.service urbackupclientbackend.service
mv init.d_client init.d
else
echo "Assuming RedHat \(derivative\) system"
if [ -e /etc/sysconfig ]
then
mv urbackupclientbackend-redhat.service urbackupclientbackend.service
mv init.d_client_rh init.d
else
echo "/etc/sysconfig does not exist. Putting daemon configuration into /etc/default"
mv urbackupclientbackend-debian.service urbackupclientbackend.service
mv init.d_client init.d
fi
fi
SYSTEMD=no
RESTART_SERVICE=no
if command -v systemctl >/dev/null 2>&1
then
echo "Detected systemd"
SYSTEMD=yes
if systemctl status urbackupclientbackend.service >/dev/null 2>&1
then
RESTART_SERVICE=yes
fi
else
if [ -e /etc/init.d/urbackupclientbackend ]
then
if /etc/init.d/urbackupclientbackend status >/dev/null 2>&1
then
RESTART_SERVICE=yes
fi
fi
fi
TARGET=no
arch=`uname -m`
case "$arch" in
i?86) TARGET=i686-linux-android ;;
x86_64) TARGET=x86_64-linux-glibc ;;
armv6*) TARGET=arm-linux-androideabi ;;
armv7*) TARGET=arm-linux-androideabi ;;
armv8*) TARGET=aarch64-linux-android ;;
aarch64) TARGET=aarch64-linux-android ;;
esac
if [ $TARGET = no ]
then
echo "Cannot run UrBackup client on this server. CPU architecture $arch not supported. Stopping installation."
exit 3
else
echo "Detected architecture $TARGET"
fi
test -e "$PREFIX/sbin" || install -c -m 755 -d "$PREFIX/sbin"
test -e "$PREFIX/bin" || install -c -m 755 -d "$PREFIX/bin"
install -c "$TARGET/urbackupclientbackend" "$PREFIX/sbin"
install -c "$TARGET/urbackupclientctl" "$PREFIX/bin"
ORIG_TARGET=$TARGET
if [ $TARGET = x86_64-linux-glibc ]
then
if ! "$PREFIX/bin/urbackupclientctl" --version 2>&1 | grep "UrBackup Client Controller" > /dev/null 2>&1
then
echo "\(Glibc not installed or too old. Falling back to Android NDK build...\)"
TARGET=x86_64-linux-android
else
if ! "$PREFIX/sbin/urbackupclientbackend" --version 2>&1 | grep "UrBackup Client Backend" > /dev/null 2>&1
then
echo "\(Glibc not installed or too old \(2\). Falling back to Android NDK build...\)"
TARGET=x86_64-linux-android
fi
fi
fi
if [ $TARGET = arm-linux-androideabi ]
then
if ! "$PREFIX/bin/urbackupclientctl" --version 2>&1 | grep "UrBackup Client Controller" > /dev/null 2>&1
then
echo "\(Android NDK build not working. Falling back to ELLCC build...\)"
TARGET=armv6-linux-engeabihf
else
if ! "$PREFIX/sbin/urbackupclientbackend" --version 2>&1 | grep "UrBackup Client Backend" > /dev/null 2>&1
then
echo "\(Android NDK build not working. Falling back to ELLCC build...\)"
TARGET=armv6-linux-engeabihf
fi
fi
fi
if [ $TARGET != $ORIG_TARGET ]
then
install -c "$TARGET/urbackupclientbackend" "$PREFIX/sbin"
install -c "$TARGET/urbackupclientctl" "$PREFIX/bin"
fi
if ! "$PREFIX/bin/urbackupclientctl" --version 2>&1 | grep "UrBackup Client Controller" > /dev/null 2>&1
then
echo "Error running executable on this system \($arch\). Stopping installation."
exit 2
fi
install -c "$TARGET/blockalign" "$PREFIX/bin"
test -e "$PREFIX/var/urbackup/data" || install -c -m 744 -d "$PREFIX/var/urbackup/data"
test -e "$PREFIX/share/urbackup/scripts" || install -c -m 744 -d "$PREFIX/share/urbackup/scripts"
test -e "$PREFIX/etc/urbackup" || install -c -m 744 -d "$PREFIX/etc/urbackup"
install -c "uninstall_urbackupclient" "$PREFIX/sbin"
for script in backup_scripts/*
do
sed "s|SYSCONFDIR|$PREFIX/etc/urbackup|g" "$script" > "$script.r"
mv "$script.r" "$script"
done
install -c "backup_scripts/list" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/list_incr" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/mariadbdump" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/postgresqldump" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/postgresbase" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/postgresqlprebackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/postgresqlpostbackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/setup-postgresbackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/mariadbxtrabackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/mariadbxtrabackup_incr" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/restore-mariadbbackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/mariadbprebackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/mariadbpostbackup" "$PREFIX/share/urbackup/scripts"
install -c "backup_scripts/setup-mariadbbackup" "$PREFIX/share/urbackup/scripts"
install -c "btrfs_create_filesystem_snapshot" "$PREFIX/share/urbackup"
install -c "btrfs_remove_filesystem_snapshot" "$PREFIX/share/urbackup"
install -c "lvm_create_filesystem_snapshot" "$PREFIX/share/urbackup"
install -c "lvm_remove_filesystem_snapshot" "$PREFIX/share/urbackup"
install -c "dattobd_create_snapshot" "$PREFIX/share/urbackup"
install -c "dattobd_remove_snapshot" "$PREFIX/share/urbackup"
install -c "dm_create_snapshot" "$PREFIX/share/urbackup"
install -c "dm_remove_snapshot" "$PREFIX/share/urbackup"
install -c "filesystem_snapshot_common" "$PREFIX/share/urbackup"
test -e "$PREFIX/etc/urbackup/mariadbdump.conf" || install -c "backup_scripts/mariadbdump.conf" "$PREFIX/etc/urbackup"
test -e "$PREFIX/etc/urbackup/postgresqldump.conf" || install -c "backup_scripts/postgresqldump.conf" "$PREFIX/etc/urbackup"
test -e "$PREFIX/etc/urbackup/postgresbase.conf" || install -c "backup_scripts/postgresbase.conf" "$PREFIX/etc/urbackup"
test -e "$PREFIX/etc/urbackup/mariadbxtrabackup.conf" || install -c "backup_scripts/mariadbxtrabackup.conf" "$PREFIX/etc/urbackup"
chmod 700 "$PREFIX/share/urbackup/scripts"*
chmod 700 "$PREFIX/etc/urbackup/"*
/usr/bin/install -c -m 644 "version.txt" "$PREFIX/var/urbackup"
/usr/bin/install -c -m 644 "urbackup_ecdsa409k1.pub" "$PREFIX/share/urbackup"
/usr/bin/install -c -m 644 "updates_h.dat" "$PREFIX/var/urbackup"
cat << c71b9d17069d4d03bd7f6b75f36ba5ff > "$PREFIX/var/urbackup/initial_settings.cfg"
#Initial Settings. Changes will not be respected.
#48692563-17e4-4ccb-a078-f14372fdbe20
################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
#6e7f6ba0-8478-4946-b70a-f1c7e83d28cc
c71b9d17069d4d03bd7f6b75f36ba5ff
if test ! -e "$PREFIX/var/urbackup/server_idents.txt"
then
cat << c71b9d17069d4d03bd7f6b75f36ba5ff > "$PREFIX/var/urbackup/server_idents.txt"
#17460620-769b-4add-85aa-a764efe84ab7
###################################################
#569d42d2-1b40-4745-a426-e86a577c7f1a
c71b9d17069d4d03bd7f6b75f36ba5ff
fi
CONFIG_FILE=no
if [ $DEBIAN = yes ]
then
if [ -e /etc/default ] && [ ! -e /etc/default/urbackupclient ]
then
CONFIG_FILE=/etc/default/urbackupclient
install -c defaults_client /etc/default/urbackupclient
fi
else
if [ -e /etc/sysconfig ]
then
if [ ! -e /etc/sysconfig/urbackupclient ]
then
CONFIG_FILE=/etc/sysconfig/urbackupclient
install -c defaults_client /etc/sysconfig/urbackupclient
fi
elif [ -e /etc/default ]
then
if [ ! -e /etc/default/urbackupclient ]
then
CONFIG_FILE=/etc/default/urbackupclient
install -c defaults_client /etc/default/urbackupclient
fi
fi
fi
if [ $CONFIG_FILE != no ]
then
if grep "internet_mode_enabled=true" "$PREFIX/var/urbackup/initial_settings.cfg" > /dev/null 2>&1
then
echo "Enabling internet only mode"
sed 's/INTERNET_ONLY=false/INTERNET_ONLY=true/g' "$CONFIG_FILE" > "$CONFIG_FILE.new"
mv "$CONFIG_FILE.new" "$CONFIG_FILE"
fi
echo "Installed daemon configuration at $CONFIG_FILE..."
echo "Info: Restoring from web interface is disabled per default. Enable by modifying $CONFIG_FILE."
fi
if [ $SYSTEMD = yes ]
then
echo "Installing systemd unit..."
SYSTEMD_DIR=""
if command -v pkg-config >/dev/null 2>&1
then
SYSTEMD_DIR=`pkg-config systemd --variable=systemdsystemunitdir`
fi
if [ "x$SYSTEMD_DIR" = x ]
then
if test -e "/lib/systemd/system/urbackupclientbackend.service"
then
echo "Updating existing systemd unit at /lib/systemd/system/urbackupclientbackend.service"
SYSTEMD_DIR="/lib/systemd/system"
elif test -e "/usr/lib/systemd/system"
then
echo "Cannot find systemd unit dir. Assuming /usr/lib/systemd/system"
SYSTEMD_DIR="/usr/lib/systemd/system"
else
echo "Cannot find systemd unit dir. Assuming /lib/systemd/system"
SYSTEMD_DIR="/lib/systemd/system"
fi
fi
install -c urbackupclientbackend.service $SYSTEMD_DIR
systemctl enable urbackupclientbackend.service
SYSTEMD_DBUS=yes
if [ $RESTART_SERVICE = no ]
then
echo "Starting UrBackup Client service..."
if ! systemctl start urbackupclientbackend.service
then
if ! systemctl > /dev/null
then
SYSTEMD_DBUS=no
fi
fi
else
echo "Restarting UrBackup Client service..."
#This will kill the installer during auto-update.
#So do not do anything (important) after that.
if ! systemctl restart urbackupclientbackend.service
then
if ! systemctl > /dev/null
then
SYSTEMD_DBUS=no
killall urbackupclientbackend || true
fi
fi
fi
if [ $SYSTEMD_DBUS = yes ]
then
if systemctl status urbackupclientbackend.service >/dev/null 2>&1
then
echo "Successfully started client service. Installation complete."
else
echo "Starting client service failed. Please investigate."
exit 1
fi
else
echo "Systemd failed \(see previous messages\). Starting urbackupclientbackend manually this time..."
urbackupclientbackend -d -c $CONFIG_FILE
fi
else
echo "Installing System V init script..."
INSTALL_SYSV=yes
if [ $DEBIAN = yes ] && ! [ -e /lib/lsb/init-functions ]
then
echo "/lib/lsb/init-functions not found. lsb-base \(>= 3.0-6\) not installed? Not installing System V init script."
INSTALL_SYSV=no
elif [ $DEBIAN = no ] && ! [ -e /etc/rc.d/init.d/functions ]
then
echo "/etc/rc.d/init.d/functions not found. Not installing System V init script."
INSTALL_SYSV=no
fi
if [ $INSTALL_SYSV = yes ]
then
install -c init.d /etc/init.d/urbackupclientbackend
if [ $DEBIAN = yes ]
then
update-rc.d urbackupclientbackend defaults
else
chkconfig --add urbackupclientbackend
chkconfig --level 345 urbackupclientbackend on
fi
if [ $RESTART_SERVICE = no ]
then
echo "Starting UrBackup Client service..."
/etc/init.d/urbackupclientbackend start
else
echo "Restarting UrBackup Client service..."
/etc/init.d/urbackupclientbackend restart
fi
if /etc/init.d/urbackupclientbackend status >/dev/null 2>&1
then
echo "Successfully started client service. Installation complete."
else
echo "Starting client service failed \(see previous messages\). Starting urbackupclientbackend manually this time..."
urbackupclientbackend -d -c $CONFIG_FILE
fi
else
echo "Starting urbackupclientbackend manually this time..."
urbackupclientbackend -d -c $CONFIG_FILE
fi
fi
if [ $SILENT = no ]
then
if [ -e $PREFIX/etc/urbackup/snapshot.cfg ] || [ -e $PREFIX/etc/urbackup/no_filesystem_snapshot ]
then
exit 0
fi
CENTOS=no
UBUNTU=no
FEDORA=no
DATTO=no
LVM=no
BTRFS=no
DMSETUP=no
if [ $DEBIAN = no ]
then
if grep "release 6" /etc/redhat-release > /dev/null 2>&1
then
CENTOS=6
fi
if grep "release 7" /etc/redhat-release > /dev/null 2>&1
then
CENTOS=7
fi
if grep "release 8" /etc/redhat-release > /dev/null 2>&1
then
CENTOS=8
fi
if grep "Fedora" /etc/fedora-release > /dev/null 2>&1
then
FEDORA=yes
fi
else
if grep 'NAME="Ubuntu"' /etc/os-release > /dev/null 2>&1
then
if grep 'VERSION="' /etc/os-release | grep "LTS" > /dev/null 2>&1
then
echo "+Detected Ubuntu LTS. Dattobd supported"
UBUNTU=yes
DATTO=yes
fi
elif grep 'NAME="Debian' /etc/os-release > /dev/null 2>&1
then
if grep 'PRETTY_NAME="' /etc/os-release | grep "/sid" > /dev/null 2>&1
then
echo "+Detected Debian unstable/sid. Dattobd not supported"
else
echo "+Detected Debian stable. Dattobd supported"
DATTO=yes
fi
fi
fi
if [ $CENTOS != no ]
then
echo "+Detected EL/RH $CENTOS. Dattobd supported"
DATTO=yes
fi
if [ $FEDORA != no ]
then
echo "+Detected Fedora. Dattobd supported"
DATTO=yes
fi
if [ $DATTO = no ]
then
echo "-dattobd not supported on this system"
fi
if df -T -P | tr -s " " | cut -d" " -f2 | grep "btrfs" > /dev/null 2>&1
then
echo "+Detected btrfs filesystem"
BTRFS=yes
else
echo "-Detected no btrfs filesystem"
fi
if command -v lvs >/dev/null 2>&1
then
LVM_VOLS=`lvs 2> /dev/null | wc -l`
if [ "x$LVM_VOLS" != x ] && [ $LVM_VOLS -gt 1 ]
then
echo "+Detected LVM volumes"
LVM=yes
else
echo "-Detected no LVM volumes"
fi
else
echo "-LVM not installed"
fi
if command -v dmsetup >/dev/null 2>&1
then
DMSETUP=yes
echo "+dmsetup present"
else
echo "-dmsetup not present"
fi
while true
do
echo "Please select the snapshot mechanism to be used for backups:"
if [ $DATTO != no ]
then
echo "1) dattobd volume snapshot kernel module from https://github.com/datto/dattobd (supports image backups and changed block tracking)"
fi
if [ $LVM != no ]
then
echo "2) LVM - Logical Volume Manager snapshots"
fi
if [ $BTRFS != no ]
then
echo "3) btrfs filesystem snapshots (dattobd and LVM will automatically use btrfs snapshots for btrfs filesystems)"
fi
if [ $DMSETUP != no ]
then
echo "4) Linux device mapper based snapshots (supports image backups and changed block tracking)"
fi
echo "5) Use no snapshot mechanism"
read snapn
if [ "x$snapn" = x1 ]
then
break
fi
if [ "x$snapn" = x2 ]
then
break
fi
if [ "x$snapn" = x3 ]
then
break
fi
if [ "x$snapn" = x4 ]
then
break
fi
if [ "x$snapn" = x5 ]
then
break
fi
done
mkdir -p $PREFIX/etc/urbackup
CREATE_SNAPSHOT_SCRIPT=""
REMOVE_SNAPSHOT_SCRIPT=""
CREATE_VOLUME_SNAPSHOT=""
REMOVE_VOLUME_SNAPSHOT=""
if [ $snapn = 3 ]
then
CREATE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/btrfs_create_filesystem_snapshot"
REMOVE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/btrfs_remove_filesystem_snapshot"
fi
if [ $snapn = 2 ]
then
CREATE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/lvm_create_filesystem_snapshot"
REMOVE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/lvm_remove_filesystem_snapshot"
fi
if [ $snapn = 1 ]
then
# if [ $CENTOS != no ]
# then
# yum localinstall https://cpkg.datto.com/datto-rpm/EnterpriseLinux/$(rpm -E %rhel)/x86_64/datto-el-rpm-release-$(rpm -E %rhel)-8.1.noarch.rpm
# yum install dkms-dattobd dattobd-utils
# elif [ $FEDORA != no ]
# then
# yum install https://cpkg.datto.com/datto-rpm/Fedora/$(rpm -E %fedora)/x86_64/datto-fedora-rpm-release-$(rpm -E %fedora)-8.1.noarch.rpm
# yum install kernel-devel-$(uname -r) dkms-dattobd dattobd-utils
# elif [ $UBUNTU != no ]
# then
# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 29FF164C
# CODENAME=`lsb_release -sc`
# echo "deb https://cpkg.datto.com/repositories $CODENAME main" > /etc/apt/sources.list.d/datto-linux-agent.list
# apt-get update
# apt-get install dattobd-dkms dattobd-utils
# fi
echo "Configured dattobd. Please install dattobd following the instructions at https://github.com/datto/dattobd"
CREATE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/dattobd_create_snapshot"
REMOVE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/dattobd_remove_snapshot"
CREATE_VOLUME_SNAPSHOT="$PREFIX/share/urbackup/dattobd_create_snapshot"
REMOVE_VOLUME_SNAPSHOT="$PREFIX/share/urbackup/dattobd_remove_snapshot"
fi
if [ $snapn = 4 ]
then
CREATE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/dm_create_snapshot"
REMOVE_SNAPSHOT_SCRIPT="$PREFIX/share/urbackup/dm_remove_snapshot"
CREATE_VOLUME_SNAPSHOT="$PREFIX/share/urbackup/dm_create_snapshot"
REMOVE_VOLUME_SNAPSHOT="$PREFIX/share/urbackup/dm_remove_snapshot"
if [ $DEBIAN = yes ] || [ $UBUNTU = yes ]
then
echo "## Install thin-provisioning tools for changed block detection and partclone for used space optimization ##"
apt-get install thin-provisioning-tools partclone || true
fi
echo "Convert root device into device mapper device on boot (initramfs)? This is required for root device/filesystem backup. [Y/n]"
read yn
if [ "x$yn" != xn ]
then
if [ -e /usr/share/initramfs-tools/hooks ]
then
install -c "hooks_urbackup-setup-snapshot" /usr/share/initramfs-tools/hooks/urbackup-setup-snapshot
mkdir -p /usr/share/initramfs-tools/scripts/local-top
install -c "scripts_local-top_urbackup-setup-snapshot" /usr/share/initramfs-tools/scripts/local-top/urbackup-setup-snapshot
update-initramfs -u
echo "Info: You need to reboot your system in order to be able to snapshot the root file system/device"
else
echo "Did not find initramfs-tools. Installation failed."
fi
fi
fi
if [ $snapn = 5 ]
then
touch $PREFIX/etc/urbackup/no_filesystem_snapshot
echo "Configured no snapshot mechanism"
fi
if [ "x$CREATE_SNAPSHOT_SCRIPT" != "x" ]
then
echo "#This is a key=value config file for determining the scripts/programs to create snapshots" > $PREFIX/etc/urbackup/snapshot.cfg
echo "" >> $PREFIX/etc/urbackup/snapshot.cfg
echo "create_filesystem_snapshot=$CREATE_SNAPSHOT_SCRIPT" >> $PREFIX/etc/urbackup/snapshot.cfg
echo "remove_filesystem_snapshot=$REMOVE_SNAPSHOT_SCRIPT" >> $PREFIX/etc/urbackup/snapshot.cfg
if [ "x$CREATE_VOLUME_SNAPSHOT" != "x" ]
then
echo "create_volume_snapshot=$CREATE_VOLUME_SNAPSHOT" >> $PREFIX/etc/urbackup/snapshot.cfg
echo "remove_volume_snapshot=$REMOVE_VOLUME_SNAPSHOT" >> $PREFIX/etc/urbackup/snapshot.cfg
fi
echo "Configured snapshot mechanism via $PREFIX/etc/urbackup/snapshot.cfg"
fi
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/wangcichen/urbackup_backend.git
git@gitee.com:wangcichen/urbackup_backend.git
wangcichen
urbackup_backend
urbackup_backend
dev

搜索帮助