fix username when automatic: hugo and anaconda (#31)
fix username when automatic
This commit is contained in:
parent
54bb1d4e25
commit
e496022c56
2 changed files with 10 additions and 6 deletions
|
@ -28,7 +28,7 @@ rm -f /etc/profile.d/00-restore-env.sh
|
||||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||||
chmod +x /etc/profile.d/00-restore-env.sh
|
chmod +x /etc/profile.d/00-restore-env.sh
|
||||||
|
|
||||||
# Determine the appropriate non-root user
|
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||||
USERNAME=""
|
USERNAME=""
|
||||||
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
|
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
|
||||||
|
@ -39,10 +39,12 @@ if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "${USERNAME}" = "" ]; then
|
if [ "${USERNAME}" = "" ]; then
|
||||||
USERNAME=root
|
USERNAME=vscode
|
||||||
fi
|
fi
|
||||||
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
|
elif [ "${USERNAME}" = "none" ]; then
|
||||||
USERNAME=root
|
USERNAME=root
|
||||||
|
USER_UID=0
|
||||||
|
USER_GID=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
architecture="$(uname -m)"
|
architecture="$(uname -m)"
|
||||||
|
|
|
@ -27,7 +27,7 @@ rm -f /etc/profile.d/00-restore-env.sh
|
||||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||||
chmod +x /etc/profile.d/00-restore-env.sh
|
chmod +x /etc/profile.d/00-restore-env.sh
|
||||||
|
|
||||||
# Determine the appropriate non-root user
|
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||||
USERNAME=""
|
USERNAME=""
|
||||||
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
|
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
|
||||||
|
@ -38,10 +38,12 @@ if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "${USERNAME}" = "" ]; then
|
if [ "${USERNAME}" = "" ]; then
|
||||||
USERNAME=root
|
USERNAME=vscode
|
||||||
fi
|
fi
|
||||||
elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
|
elif [ "${USERNAME}" = "none" ]; then
|
||||||
USERNAME=root
|
USERNAME=root
|
||||||
|
USER_UID=0
|
||||||
|
USER_GID=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
architecture="$(uname -m)"
|
architecture="$(uname -m)"
|
||||||
|
|
Loading…
Reference in a new issue