initial
This commit is contained in:
82
userinit.sh.template
Executable file
82
userinit.sh.template
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
## THIS FILE gets overwritten!
|
||||
|
||||
|
||||
USR=--USER--
|
||||
addgroup --gid --USERGID-- $USR
|
||||
useradd --uid --USERID-- --gid --USERGID-- -m $USR
|
||||
echo "$USR ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
mkdir /home/$USR/.ssh /home/$USR/.vnc /home/$USR/bin
|
||||
echo '--PUBKEY--' > /home/$USR/.ssh/authorized_keys
|
||||
chmod 700 /home/$USR/.ssh
|
||||
chmod 600 /home/$USR/.ssh/authorized_keys
|
||||
chsh -s /bin/bash $USR
|
||||
cp /vnc_passwd /home/$USR/.vnc/passwd
|
||||
chmod 600 /home/$USR/.vnc/passwd
|
||||
echo '#!/bin/sh
|
||||
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
|
||||
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
|
||||
|
||||
xsetroot -solid grey
|
||||
vncconfig -iconic &
|
||||
terminator &
|
||||
openbox &
|
||||
lxpanel -p LXDE &
|
||||
pcmanfm --desktop --profile LXDE &
|
||||
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 *
|
||||
' > /home/$USR/.vnc/xstartup
|
||||
|
||||
echo "#!/bin/bash
|
||||
|
||||
vncserver :0 -depth 24 \$1 \
|
||||
-geometry 1680x1050 \
|
||||
-geometry 800x600 \
|
||||
-geometry 1024x768 \
|
||||
-geometry 1280x1024 \
|
||||
-geometry 1600x1200 \
|
||||
-geometry 1280x720
|
||||
" > /home/$USR/bin/vncs
|
||||
|
||||
echo "#!/bin/bash
|
||||
|
||||
echo exit | nc -w 1 127.0.0.1 1515
|
||||
" > /home/$USR/bin/exit-safe
|
||||
chmod 755 /home/$USR/bin/*
|
||||
|
||||
|
||||
cat <<'EOF' > /tools-install.sh
|
||||
#!/bin/bash
|
||||
|
||||
test -f $HOME/.bashrc || sed 's,#force_color_prompt=yes,force_color_prompt=yes,' /etc/skel/.bashrc > $HOME/.bashrc
|
||||
test -f $HOME/.profile || cp /etc/skel/.profile $HOME/.profile
|
||||
echo "echo \$HOSTNAME | figlet" >> $HOME/.profile
|
||||
echo "echo To exit and shutdown properly, type \'exit-safe\'" >> $HOME/.profile
|
||||
|
||||
mkdir -p $HOME/lib
|
||||
mkdir -p $HOME/bin
|
||||
mkdir -p $HOME/.config/autostart
|
||||
pushd $HOME/lib > /dev/null
|
||||
echo "Getting Tools repository"
|
||||
ln -s /usr/local/share/q-tools tools
|
||||
echo "Checking and adding tools/bin"
|
||||
touch $HOME/.bash_cdhistory $HOME/.qcd
|
||||
grep /lib/tools/rc $HOME/.bashrc > /dev/null || ( echo '. $HOME/lib/tools/rc' >> ~/.bashrc )
|
||||
[[ -f $HOME/bin/xsessionrc ]] || {
|
||||
cp $HOME/lib/tools/skel/xsessionrc $HOME/bin/xsessionrc
|
||||
chmod 755 $HOME/bin/xsessionrc
|
||||
}
|
||||
[[ -f $HOME/.config/autostart/xsessionrc.desktop ]] || {
|
||||
$HOME/lib/tools/bin/fimplate -e $HOME/lib/tools/skel/xsessionrc.desktop > $HOME/.config/autostart/xsessionrc.desktop
|
||||
}
|
||||
|
||||
popd > /dev/null
|
||||
EOF
|
||||
chown -R $USR:$USR /home/$USR/
|
||||
runuser -u $USR -- bash /tools-install.sh
|
||||
|
||||
echo "alias ff='firefox -no-remote &> /dev/null &'" >> /home/$USR/.bashrc
|
||||
echo "alias cb='chromium-browser &> /dev/null &'" >> /home/$USR/.bashrc
|
||||
|
||||
chown -R $USR:$USR /home/$USR/
|
||||
|
||||
Reference in New Issue
Block a user