40 lines
828 B
Bash
40 lines
828 B
Bash
#!/bin/bash
|
|
|
|
# updates all dotfiles on the system
|
|
TODELETE="$(command ls --almost-all files) .PS1"
|
|
|
|
(cd ../.. ; rm $TODELETE)
|
|
(cd /root ; rm $TODELETE)
|
|
|
|
cp -r ./files/. /root
|
|
ln ./files/.* ../../
|
|
|
|
# dotenv
|
|
if [ ! -f ../../.env ] ; then
|
|
cat << EOF >> ../../.env
|
|
SERV_COLOR="32"
|
|
USER=""
|
|
EOF
|
|
fi
|
|
source ./setenv.sh
|
|
|
|
## root PS1
|
|
RED="01;31m"
|
|
cat << EOF >> /root/.PS1
|
|
PS1='\[\033[$RED\]\u\[\033[01;38;5;${SERV_COLOR}m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
|
|
EOF
|
|
|
|
## user PS1
|
|
GREEN="01;32m"
|
|
cat << EOF >> ../../.PS1
|
|
PS1='\[\033[$GREEN\]\u\[\033[01;38;5;${SERV_COLOR}m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
|
|
EOF
|
|
|
|
## lazyness is bad
|
|
#if [ -f ../../.env ] ; then
|
|
# rm /etc/sudoers.d/user
|
|
# echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user
|
|
#fi
|
|
if [ -f /etc/sudoers.d/user ] ; then
|
|
rm /etc/sudoers.d/user
|
|
fi
|