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

41 lines
779 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
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
if [ "$USER" = jelly ] ; then
rm ../../.nanorc /root/.nanorc /etc/nanorc
cat << EOF >> ../../.bashrc
rm ./.nanorc
EOF
fi