Replace spaces with tabs in fstab and move mounts to /etc/rc on Synology DSM

This commit is contained in:
Janek Bevendorff 2014-10-15 00:21:53 +02:00
parent 1c2933e48c
commit ad633b262a
5 changed files with 57 additions and 26 deletions

View File

@ -162,6 +162,19 @@ To run the server component on Synology DSM, you need to install the following p
* `openssh-sftp-server` * `openssh-sftp-server`
* `util-linux-ng` * `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 ### 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. 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.

View File

@ -142,16 +142,30 @@ if [[ $MODE == "install" ]]; then
fi fi
# Append fstab entries # Append fstab entries
if ! grep -q "^# BEGIN: rs-backup-suite" /etc/fstab; then if [[ "$DISTRIBUTION" == "Synology" ]]; then
if [[ "$DISTRIBUTION" == "Ubuntu" ]]; then # Synology DSM restores default /etc/fstab upon reboot,
fstab_name="fstab_ubuntu" # so we better put mount commands in /etc/rc
elif [[ "$DISTRIBUTION" == "Synology" ]]; then if ! grep -q "^# BEGIN: rs-backup-suite" /etc/rc; then
fstab_name="fstab_synology" tmp_name="/tmp/rs-backup_etc-rc.$RANDOM"
else fstab_contents="$(cat ./server/etc/fstab_synology | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
fstab_name="fstab" 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_local_name="fstab_ubuntu"
elif [[ "$DISTRIBUTION" == "Synology" ]]; then
fstab_local_name="fstab_synology"
else
fstab_local_name="fstab"
fi
fstab_contents="$(cat ./server/etc/$fstab_local_name | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
echo "$fstab_contents" >> /etc/fstab
fi fi
fstab_contents="$(cat ./server/etc/$fstab_name | sed "s#::BACKUP_ROOT::#$BKP_DIR#")"
echo "$fstab_contents" >> /etc/fstab
fi fi
# Do not overwrite existing config # Do not overwrite existing config
@ -238,7 +252,11 @@ elif [[ "$MODE" == "uninstall" ]]; then
fi fi
# Remove fstab entries # 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." echo "Done."

View File

@ -1,7 +1,7 @@
# BEGIN: rs-backup-suite # BEGIN: rs-backup-suite
#/lib ::BACKUP_ROOT::/lib none bind 0 0 #/lib ::BACKUP_ROOT::/lib none bind 0 0
#/dev ::BACKUP_ROOT::/dev none bind 0 0 #/dev ::BACKUP_ROOT::/dev none bind 0 0
#/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0 #/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0
#/usr/lib ::BACKUP_ROOT::/usr/lib none bind 0 0 #/usr/lib ::BACKUP_ROOT::/usr/lib none bind 0 0
#/usr/share/perl5 ::BACKUP_ROOT::/usr/share/perl5 none bind 0 0 #/usr/share/perl5 ::BACKUP_ROOT::/usr/share/perl5 none bind 0 0
# END: rs-backup-suite # END: rs-backup-suite

View File

@ -1,8 +1,8 @@
# BEGIN: rs-backup-suite # BEGIN: rs-backup-suite
#/lib ::BACKUP_ROOT::/lib none bind 0 0 #mount -o bind /lib ::BACKUP_ROOT::/lib
#/dev ::BACKUP_ROOT::/dev none bind 0 0 #mount -o bind /dev ::BACKUP_ROOT::/dev
#/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0 #mount -o bind /usr/bin ::BACKUP_ROOT::/usr/bin
#/opt/bin ::BACKUP_ROOT::/opt/bin none bind 0 0 #mount -o bind /opt/bin ::BACKUP_ROOT::/opt/bin
#/opt/lib ::BACKUP_ROOT::/opt/lib none bind 0 0 #mount -o bind /opt/lib ::BACKUP_ROOT::/opt/lib
#/opt/libexec ::BACKUP_ROOT::/opt/libexec none bind 0 0 #mount -o bind /opt/libexec ::BACKUP_ROOT::/opt/libexec
# END: rs-backup-suite # END: rs-backup-suite

View File

@ -1,7 +1,7 @@
# BEGIN: rs-backup-suite # BEGIN: rs-backup-suite
#/lib ::BACKUP_ROOT::/lib none bind 0 0 #/lib ::BACKUP_ROOT::/lib none bind 0 0
#/dev ::BACKUP_ROOT::/dev none bind 0 0 #/dev ::BACKUP_ROOT::/dev none bind 0 0
#/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0 #/usr/bin ::BACKUP_ROOT::/usr/bin none bind 0 0
#/usr/lib ::BACKUP_ROOT::/usr/lib none bind 0 0 #/usr/lib ::BACKUP_ROOT::/usr/lib none bind 0 0
#/usr/share/perl ::BACKUP_ROOT::/usr/share/perl none bind 0 0 #/usr/share/perl ::BACKUP_ROOT::/usr/share/perl none bind 0 0
# END: rs-backup-suite # END: rs-backup-suite