aboutsummaryrefslogtreecommitdiffstats
path: root/backuper.sh
diff options
context:
space:
mode:
Diffstat (limited to 'backuper.sh')
-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