aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 15:11:32 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-24 16:34:02 +0200
commitc2b44ee524cedb55d931c9493531be61beacd7e5 (patch)
treecabf71011fc554b09da5295072d8a0df4dbe75e1
parentAdd README (diff)
downloadbackuper-c2b44ee524cedb55d931c9493531be61beacd7e5.tar.xz
Add support for personalization process
-rw-r--r--backuper.sh18
1 files changed, 17 insertions, 1 deletions
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