-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10-user
More file actions
32 lines (24 loc) · 997 Bytes
/
10-user
File metadata and controls
32 lines (24 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/with-contenv bash
DEDAULT_USER=`id -un $PUID`
ln -nfs /home/default /home/$USER
usermod -l $USER -d /home/$USER $DEDAULT_USER
sed -i'.bak' "s|s6-setuidgid $DEDAULT_USER|s6-setuidgid $USER|" /etc/services.d/code-server/run
sed -i'.bak' "s|/config/workspace|/home/$USER|" /etc/services.d/code-server/run
echo "$USER ALL=(ALL) NOPASSWD: ALL" >| /etc/sudoers.d/default
chsh -s $(which zsh) $USER
if [[ `grep 'export HOME=' /etc/profile` ]]; then
sed -i'.bak' "|export HOME=|s export HOME=/home/$USER" /etc/profile
else
echo "export HOME=/home/$USER" >> /etc/profile
fi
mkdir -p /etc/zsh
if [[ `grep 'export HOME=' /etc/zsh/zshenv` ]]; then
sed -i'.bak' "|export HOME=|s export HOME=/home/$USER" /etc/zsh/zshenv
else
echo "export HOME=/home/$USER" >> /etc/zsh/zshenv
fi
if [[ ! -e /home/$USER/.zshrc ]]; then
cp /etc/zsh/newuser.zshrc.recommended /home/$USER/.zshrc
echo 'prompt redhat' >> /home/$USER/.zshrc
fi
chown -R $PUID:$PGID /home/default /home/$USER