Replace spaces with tabs in fstab and move mounts to /etc/rc on Synology DSM
This commit is contained in:
parent
1c2933e48c
commit
ad633b262a
13
README.md
13
README.md
|
@ -162,6 +162,19 @@ To run the server component on Synology DSM, you need to install the following p
|
|||
* `openssh-sftp-server`
|
||||
* `util-linux-ng`
|
||||
|
||||
If you want to run your backups in a chroot environment please note that `/etc/fstab/` will be reset to its defaults when rebooting the disk station. To avoid configuration loss, no mount directives are added to `/etc/fstab` by the install script. Instead the following entries are added to `/etc/rc` (which won't be overwritten upon reboot):
|
||||
|
||||
# BEGIN: rs-backup-suite
|
||||
#mount -o bind /lib /var/services/homes/lib
|
||||
#mount -o bind /dev /var/services/homes/dev
|
||||
#mount -o bind /usr/bin /var/services/homes/usr/bin
|
||||
#mount -o bind /opt/bin /var/services/homes/opt/bin
|
||||
#mount -o bind /opt/lib /var/services/homes/opt/lib
|
||||
#mount -o bind /opt/libexec /var/services/homes/opt/libexec
|
||||
# END: rs-backup-suite
|
||||
|
||||
To enable the mounts, uncomment everything between the `BEGIN` and `END` block. Afterwards either run these commands by hand once or reboot.
|
||||
|
||||
### Cygwin
|
||||
The server component is incompatible with Cygwin for several reasons, but the client component works just fine. At the moment, though, there is no root mode for backing up all home directories at once. Desktop notifications are also unsupported.
|
||||
|
||||
|
|
28
install.sh
28
install.sh
|
@ -142,17 +142,31 @@ if [[ $MODE == "install" ]]; then
|
|||
fi
|
||||
|
||||
# Append fstab entries
|
||||
if [[ "$DISTRIBUTION" == "Synology" ]]; then
|
||||
# Synology DSM restores default /etc/fstab upon reboot,
|
||||
# so we better put mount commands in /etc/rc
|
||||
if ! grep -q "^# BEGIN: rs-backup-suite" /etc/rc; then
|
||||
tmp_name="/tmp/rs-backup_etc-rc.$RANDOM"
|
||||
fstab_contents="$(cat ./server/etc/fstab_synology | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
|
||||
tac /etc/rc | sed -e '1!b' -e '/^exit 0$/d' | tac > $tmp_name
|
||||
echo "$fstab_contents" >> $tmp_name
|
||||
echo "exit 0" >> $tmp_name
|
||||
cat $tmp_name > /etc/rc
|
||||
rm $tmp_name
|
||||
fi
|
||||
else
|
||||
if ! grep -q "^# BEGIN: rs-backup-suite" /etc/fstab; then
|
||||
if [[ "$DISTRIBUTION" == "Ubuntu" ]]; then
|
||||
fstab_name="fstab_ubuntu"
|
||||
fstab_local_name="fstab_ubuntu"
|
||||
elif [[ "$DISTRIBUTION" == "Synology" ]]; then
|
||||
fstab_name="fstab_synology"
|
||||
fstab_local_name="fstab_synology"
|
||||
else
|
||||
fstab_name="fstab"
|
||||
fstab_local_name="fstab"
|
||||
fi
|
||||
fstab_contents="$(cat ./server/etc/$fstab_name | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
|
||||
fstab_contents="$(cat ./server/etc/$fstab_local_name | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
|
||||
echo "$fstab_contents" >> /etc/fstab
|
||||
fi
|
||||
fi
|
||||
|
||||
# Do not overwrite existing config
|
||||
if [ ! -e "$BKP_DIR"/etc/rsnapshot.global.conf ]; then
|
||||
|
@ -238,7 +252,11 @@ elif [[ "$MODE" == "uninstall" ]]; then
|
|||
fi
|
||||
|
||||
# Remove fstab entries
|
||||
sed -i '/^# BEGIN: rs-backup-suite$/,/^# END: rs-backup-suite$/d' /etc/fstab
|
||||
fstab_name="/etc/fstab"
|
||||
if [[ "$DISTRIBUTION" == "Synology" ]]; then
|
||||
fstab_name="/etc/rc"
|
||||
fi
|
||||
sed -i '/^# BEGIN: rs-backup-suite$/,/^# END: rs-backup-suite$/d' $fstab_name
|
||||
|
||||
echo "Done."
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# BEGIN: rs-backup-suite
|
||||
#/lib ::BACKUP_ROOT::/lib none bind 0 0
|
||||
#/dev ::BACKUP_ROOT::/dev none bind 0 0
|
||||
#/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0
|
||||
#/opt/bin ::BACKUP_ROOT::/opt/bin none bind 0 0
|
||||
#/opt/lib ::BACKUP_ROOT::/opt/lib none bind 0 0
|
||||
#/opt/libexec ::BACKUP_ROOT::/opt/libexec none bind 0 0
|
||||
#mount -o bind /lib ::BACKUP_ROOT::/lib
|
||||
#mount -o bind /dev ::BACKUP_ROOT::/dev
|
||||
#mount -o bind /usr/bin ::BACKUP_ROOT::/usr/bin
|
||||
#mount -o bind /opt/bin ::BACKUP_ROOT::/opt/bin
|
||||
#mount -o bind /opt/lib ::BACKUP_ROOT::/opt/lib
|
||||
#mount -o bind /opt/libexec ::BACKUP_ROOT::/opt/libexec
|
||||
# END: rs-backup-suite
|
||||
|
|
Loading…
Reference in New Issue