From 0083e11e8d8ff367e2c9b590c12083190e37db65 Mon Sep 17 00:00:00 2001 From: anki-code Date: Sat, 28 Mar 2020 10:15:48 +0300 Subject: [PATCH] 0.7.0 --- entrypoint.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 03860be..86070ee 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,8 +11,9 @@ # -v Verbose mode: 1 - verbose, 2 - super verbose # -e -e ... Environement variables (B64 is base64 encoded string) # -b -b ... Base64 encoded bash command +# -H Home path. Will be $HOME on the host. # -while getopts f:c:C:v:e:b: option +while getopts f:c:C:v:e:b:H: option do case "${option}" in @@ -22,6 +23,7 @@ C) EXECUTE_COMMAND_B64=${OPTARG};; v) VERBOSE=${OPTARG};; e) ENV+=("$OPTARG");; b) EBASH+=("$OPTARG");; +H) HOMEPATH=${OPTARG};; esac done @@ -88,6 +90,20 @@ cd $CURRENT_DIR export XXH_HOME=`readlink -f $CURRENT_DIR/../../../..` export XDG_CONFIG_HOME=$XXH_HOME/.config + +if [[ $HOMEPATH != '' ]]; then + homerealpath=`readlink -f $HOMEPATH` + if [[ -d $homerealpath ]]; then + export HOME=$homerealpath + else + echo "Home path not found: $homerealpath" + echo "Set HOME to $XXH_HOME" + export HOME=$XXH_HOME + fi +else + export HOME=$XXH_HOME +fi + #export HISTORY_FILE=$XXH_HOME/.your_portable_shell_history #