dotfiles/setup.sh
2023-02-05 14:08:31 -05:00

32 lines
704 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
for f in ./files/.*; do if [[ -f $f ]]; then ln ./$f ../../ ; fi; done
# dotenv
if [ ! -f ../../.env ] ; then
cat << EOF >> ../../.env
SERV_COLOR="32"
USER=""
EOF
fi
source ./setenv.sh
chown $USER:$USER ../../.env
## 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