From c2b44ee524cedb55d931c9493531be61beacd7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Sun, 24 Jul 2016 15:11:32 +0200 Subject: Add support for personalization process --- backuper.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/backuper.sh b/backuper.sh index fba7c50..19ebd67 100644 --- a/backuper.sh +++ b/backuper.sh @@ -6,7 +6,7 @@ GPG_RECIPIENT="robin.oburka@nic.cz" ## Style TIME_FMT="\nBackup took:\t%E" -## Internal variables +## Internal variables - backup process NAME="" REMOTE="" GENERATE="" @@ -21,6 +21,9 @@ PID_STORE="" PID_FILE="pids" STAGE="0" +## Internal variables - program logic +PERSN_FILE_NAME=".backuper.sh.per" + test_input() { [ -z "$NAME" ] && error "Specify backup name" [ -z "$COMMAND" -a -z "$PLACES" ] && error "Specify backup subject" @@ -94,6 +97,12 @@ get_size() { du -h "$FILE" | awk '{ print $1 }' } +get_home() { + CURRENT_USER="$(id --real --user --name)" + CU_HOME="$(getent passwd "$CURRENT_USER" | cut -d: -f6)" + echo "$CU_HOME" +} + prepare() { echo "prepare $$" trap 'error_handler' EXIT INT QUIT TERM ABRT HUP ILL TRAP BUS FPE SEGV @@ -201,3 +210,10 @@ backup() { start_pipeline cleanup } + +main() { + HOME="$(get_home)" + [ -f "$HOME"/"$PERSN_FILE_NAME" ] && . "$HOME"/"$PERSN_FILE_NAME" +} + +main -- cgit v1.2.3