As pointed out by Joffrey Fitz, gsu-based scripts do not work when
run as a user without home directory. This happens for example if
the script is executed through a web application as the www-data user.
This patch replaces all references to HOME by ${HOME:-}, i.e. we just
default to the empty string but don't fail immediately.
# file.
gsu_check_options()
{
- local i conf="${gsu_config_file:=$HOME/.$gsu_name.rc}" val
+ local i conf="${gsu_config_file:=${HOME:-}/.$gsu_name.rc}" val
for ((i=0; i < ${#gsu_options[@]}; i++)); do
eval "${gsu_options[$i]}"
}
if [[ "$(type -t _gsu_setup)" != "function" ]]; then
- gsu_dir=${gsu_dir:=$HOME/.gsu}
+ gsu_dir=${gsu_dir:=${HOME:-}/.gsu}
. $gsu_dir/common || exit 1
_gsu_setup
fi
#!/bin/bash
if [[ $(type -t gsu_is_a_number) != "function" ]]; then
- GSU_DIR=${GSU_DIR:=$HOME/.gsu}
+ GSU_DIR=${GSU_DIR:=${HOME:-}/.gsu}
. $GSU_DIR/common || exit 1
fi
# (C) 2006-2011 Andre Noll
if [[ $(type -t gsu_is_a_number) != "function" ]]; then
- GSU_DIR=${GSU_DIR:=$HOME/.gsu}
+ GSU_DIR=${GSU_DIR:=${HOME-}/.gsu}
. $GSU_DIR/common || exit 1
fi
with their current value and the default value."
_com_prefs()
{
- local i conf="${gsu_config_file:=$HOME/.$gsu_name.rc}"
+ local i conf="${gsu_config_file:=${HOME:-}/.$gsu_name.rc}"
gsu_getopts "e"
eval "$result"