feat: fix all Ubuntu container issues

This commit is contained in:
Rudra Saraswat 2023-05-21 12:44:01 +05:30
parent a60dd9ab7d
commit 635d085943

View file

@ -318,7 +318,15 @@ if ! grep -q "^${_uname}:" /etc/group; then
printf "%s:x:%s:" "$_uname" "$_cgid" >> /etc/group printf "%s:x:%s:" "$_uname" "$_cgid" >> /etc/group
fi fi
fi fi
userdel -r ubuntu &>/dev/null if [[ $_cuid -eq 1000 ]] && grep -q ubuntu /etc/passwd; then
userdel -r ubuntu &>/dev/null
groupdel ubuntu &> /dev/null
grep -v ubuntu /etc/passwd > /etc/passwd.tmp
grep -v ubuntu /etc/group > /etc/group.tmp
mv /etc/passwd.tmp /etc/passwd
mv /etc/group.tmp /etc/group
echo -e '\n'"$_uname"':x:1000\n' >> /etc/group
fi
useradd --uid "$_cuid" --gid "$_cgid" --shell "/bin/bash" --no-create-home --home "$_uhome" "$_uname" &>/dev/null useradd --uid "$_cuid" --gid "$_cgid" --shell "/bin/bash" --no-create-home --home "$_uhome" "$_uname" &>/dev/null
chown root /etc/sudo.conf chown root /etc/sudo.conf