|
|
|
|
@ -9,16 +9,16 @@ set +a
|
|
|
|
|
|
|
|
|
|
# Check if TARGET_USER is set |
|
|
|
|
if [ -z "$TARGET_USER" ]; then |
|
|
|
|
echo "ERROR: TARGET_USER environment variable is not set" |
|
|
|
|
exit 1 |
|
|
|
|
echo "ERROR: TARGET_USER environment variable is not set" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
targetHome=$(getent passwd $TARGET_USER | cut -f6 -d:) |
|
|
|
|
targetUid=$(id -u $TARGET_USER) |
|
|
|
|
|
|
|
|
|
if [ -z "$TARGET_USER" ]; then |
|
|
|
|
echo "ERROR: Cannot parse home directory for user $TARGET_USER" |
|
|
|
|
exit 1 |
|
|
|
|
echo "ERROR: Cannot parse home directory for user $TARGET_USER" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Change ownership of the specified directories |
|
|
|
|
@ -39,7 +39,7 @@ chown -R $TARGET_USER: /run/user/$targetUid
|
|
|
|
|
# If command line arguments are provided, run them as TARGET_USER |
|
|
|
|
# Otherwise, run bash as TARGET_USER |
|
|
|
|
if [ $# -eq 0 ]; then |
|
|
|
|
exec gosu $TARGET_USER bash |
|
|
|
|
exec /usr/sbin/gosu $TARGET_USER bash |
|
|
|
|
else |
|
|
|
|
exec gosu $TARGET_USER "$@" |
|
|
|
|
exec /usr/sbin/gosu $TARGET_USER "$@" |
|
|
|
|
fi |
|
|
|
|
|