dotfiles/setup.sh

42 lines
857 B
Bash
Raw Normal View History

2023-01-22 14:23:01 -05:00
#!/bin/bash
# updates all dotfiles on the system
2023-02-04 00:50:10 -05:00
TODELETE="$(command ls --almost-all files) .PS1"
2022-12-17 12:37:42 -05:00
2023-02-04 00:50:10 -05:00
(cd ../.. ; rm $TODELETE)
(cd /root ; rm $TODELETE)
2022-12-17 12:42:26 -05:00
2023-02-04 01:09:29 -05:00
cp -r ./files/. /root
ln ./files/.* ../../
2023-01-22 14:23:01 -05:00
2023-02-04 00:50:10 -05:00
# dotenv
if [ ! -f ../../.env ] ; then
cat << EOF >> ../../.env
2023-01-23 12:22:04 -05:00
SERV_COLOR="32"
2023-02-04 00:50:10 -05:00
USER=""
EOF
fi
2023-01-22 14:37:41 -05:00
source ./setenv.sh
2023-02-04 01:23:14 -05:00
chown $USER:$USER ../../.env
2022-12-17 12:42:26 -05:00
2023-01-22 14:23:01 -05:00
## root PS1
RED="01;31m"
cat << EOF >> /root/.PS1
2023-01-23 15:01:50 -05:00
PS1='\[\033[$RED\]\u\[\033[01;38;5;${SERV_COLOR}m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
2022-12-17 01:22:43 -05:00
EOF
2023-01-22 14:23:01 -05:00
## user PS1
GREEN="01;32m"
2023-01-22 14:37:41 -05:00
cat << EOF >> ../../.PS1
2023-01-23 15:01:50 -05:00
PS1='\[\033[$GREEN\]\u\[\033[01;38;5;${SERV_COLOR}m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
2023-01-22 14:23:01 -05:00
EOF
2023-01-08 10:40:46 -05:00
2023-02-04 00:50:10 -05:00
## 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
2023-01-08 10:40:46 -05:00
rm /etc/sudoers.d/user
fi