mirror of
https://github.com/linuxserver/docker-code-server.git
synced 2024-12-25 03:47:43 +01:00
23 lines
693 B
Plaintext
23 lines
693 B
Plaintext
#!/usr/bin/with-contenv bash
|
|
|
|
mkdir -p /config/{extensions,data,workspace,.ssh}
|
|
|
|
if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
|
|
echo "setting up sudo access"
|
|
if ! grep -q 'abc' /etc/sudoers; then
|
|
echo "adding abc to sudoers"
|
|
echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
|
|
fi
|
|
if [ -n "${SUDO_PASSWORD_HASH}" ]; then
|
|
echo "setting sudo password using sudo password hash"
|
|
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
|
|
else
|
|
echo "setting sudo password using SUDO_PASSWORD env var"
|
|
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
|
|
fi
|
|
fi
|
|
|
|
# permissions
|
|
chown -R abc:abc \
|
|
/config
|