From 179f274147290cb09596b1020a22423b42f29f3b Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 17 Aug 2016 17:21:32 +0200 Subject: [PATCH] Added more preserve configurable options --- CHANGELOG.md | 2 ++ host_backup.conf.example | 9 ++++++++- upgrade-v1.x-2.1x.sh | 22 +++++++++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb48d4..585949c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ CHANGELOG README: FreeBSD execution needs mailer (not found), sudo missing, bash needed, sed missing (see if StripQuotes mandatory) +! update doc on sudoers paths +- Added options to ignore permissions, ownership and groups - Improved batch runner - Batch runner works for directories and direct paths - Fixed batch runner does not rerun obackup on warnings only diff --git a/host_backup.conf.example b/host_backup.conf.example index 9d52ec7..707140b 100644 --- a/host_backup.conf.example +++ b/host_backup.conf.example @@ -2,7 +2,7 @@ ###### obackup - Local or Remote, push or pull backup script for files & mysql databases ###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr) -###### obackup v2.1x config file rev 2016081601 +###### obackup v2.1x config file rev 2016081701 ###### GENERAL BACKUP OPTIONS @@ -125,6 +125,13 @@ RSYNC_EXCLUDE_FROM="" ## List separator char. You may set an alternative separator char for your directories lists above. PATH_SEPARATOR_CHAR=";" +## Preserve basic linux permissions +PRESERVE_PERMISSIONS=yes +PRESERVE_OWNER=yes +PRESERVE_GROUP=yes +## On MACOS X, does not work and will be ignored +PRESERVE_EXECUTABILITY=yes + ## Preserve ACLS. Make sure source and target FS can hold same ACLs or you'll get loads of errors. PRESERVE_ACL=no ## Preserve Xattr. MAke sure source and target FS can hold same Xattr or you'll get loads of errors. diff --git a/upgrade-v1.x-2.1x.sh b/upgrade-v1.x-2.1x.sh index ac110c2..ea6c838 100755 --- a/upgrade-v1.x-2.1x.sh +++ b/upgrade-v1.x-2.1x.sh @@ -2,11 +2,11 @@ PROGRAM="obackup config file upgrade script" SUBPROGRAM="obackup" -AUTHOR="(C) 2015 by Orsiris \"Ozy\" de Jong" +AUTHOR="(C) 2016 by Orsiris de Jong" CONTACT="http://www.netpower.fr/obacup - ozy@netpower.fr" OLD_PROGRAM_VERSION="v1.x" -NEW_PROGRAM_VERSION="v2.x" -PROGRAM_BUILD=2016041201 +NEW_PROGRAM_VERSION="v2.1x" +PROGRAM_BUILD=20160817.1 ## type -p does not work on platforms other than linux (bash). If if does not work, always as$ if ! type "$BASH" > /dev/null; then @@ -160,8 +160,20 @@ function RewriteConfigFiles { sed -i'.tmp' '/^RSYNC_EXCLUDE_PATTERN=*/a\'$'\n''RSYNC_INCLUDE_PATTERN=""\'$'\n''' "$config_file" fi - if ! grep "^RSYNC_INCLUDE_FROM=" "$config_file" > /dev/null; then - sed -i'.tmp' '/^RSYNC_EXCLUDE_FROM=*/a\'$'\n''RSYNC_INCLUDE_FROM=""\'$'\n''' "$config_file" + if ! grep "^PRESERVE_PERMISSIONS=" "$config_file" > /dev/null; then + sed -i'.tmp' '/^PATH_SEPARATOR_CHAR=*/a\'$'\n''PRESERVE_PERMISSIONS=yes\'$'\n''' "$config_file" + fi + + if ! grep "^PRESERVE_OWNER=" "$config_file" > /dev/null; then + sed -i'.tmp' '/^PRESERVE_PERMISSIONS=*/a\'$'\n''PRESERVE_OWNER=yes\'$'\n''' "$config_file" + fi + + if ! grep "^PRESERVE_GROUP=" "$config_file" > /dev/null; then + sed -i'.tmp' '/^PRESERVE_OWNER=*/a\'$'\n''PRESERVE_GROUP=yes\'$'\n''' "$config_file" + fi + + if ! grep "^PRESERVE_EXECUTABILITY=" "$config_file" > /dev/null; then + sed -i'.tmp' '/^PRESERVE_GROUP=*/a\'$'\n''PRESERVE_EXECUTABILITY=yes\'$'\n''' "$config_file" fi if ! grep "^PARTIAL=" "$config_file" > /dev/null; then