This commit is contained in:
anki-code 2020-03-30 22:24:55 +03:00
parent 1c4eef118b
commit 2d429138e2

View File

@ -11,10 +11,11 @@
# -v <level> Verbose mode: 1 - verbose, 2 - super verbose # -v <level> Verbose mode: 1 - verbose, 2 - super verbose
# -e <NAME=B64> -e ... Environement variables (B64 is base64 encoded string) # -e <NAME=B64> -e ... Environement variables (B64 is base64 encoded string)
# -b <BASE64> -b ... Base64 encoded bash command # -b <BASE64> -b ... Base64 encoded bash command
# -H <homepath> Home path. Will be $HOME on the host. # -H <HOME path> HOME path. Will be $HOME on the host.
# -X <XDG path> XDG_* path (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
# #
while getopts f:c:C:v:e:b:H: option while getopts f:c:C:v:e:b:H:X: option
do do
case "${option}" case "${option}"
in in
@ -25,6 +26,7 @@ v) VERBOSE=${OPTARG};;
e) ENV+=("$OPTARG");; e) ENV+=("$OPTARG");;
b) EBASH+=("$OPTARG");; b) EBASH+=("$OPTARG");;
H) HOMEPATH=${OPTARG};; H) HOMEPATH=${OPTARG};;
X) XDGPATH=${OPTARG};;
esac esac
done done
@ -108,9 +110,20 @@ else
export HOME=$XXH_HOME export HOME=$XXH_HOME
fi fi
export XDG_CONFIG_HOME=$HOME/.config if [[ $XDGPATH != '' ]]; then
export XDG_DATA_HOME=$HOME/.local/share xdgrealpath=`readlink -f $XDGPATH`
if [[ ! -d $xdgrealpath ]]; then
echo "XDG path not found: $xdgrealpath"
echo "Set XDG path to $XXH_HOME"
export XDGPATH=$XXH_HOME
fi
else
export XDGPATH=$XXH_HOME
fi
export XDG_CONFIG_HOME=$XDGPATH/.config
export XDG_DATA_HOME=$XDGPATH/.local/share
export XDG_CACHE_HOME=$XDGPATH/.cache
# #
# Run the portable shell # Run the portable shell