Auto Update

This commit is contained in:
matt1432 2023-02-04 00:50:10 -05:00
parent 0e7be258d9
commit 8df363428d
9 changed files with 30 additions and 38 deletions

View file

@ -1,15 +0,0 @@
if [ -d ~/git/dotfiles ] ; then
bash ~/git/dotfiles/pull.sh
rm ~/.bashrc ~/.bash_aliases ~/.profile
(cd ~/git/dotfiles
ln ./.bashrc ../../
ln ./.bash_aliases ../../
ln ./.profile ../../)
fi
# TODO remove eventually
if [ -f ~/.bash_fzf ] ; then
rm ~/.bash-fzfrc ~/.bash_fzf
fi
. ~/.bashrc

View file

@ -36,9 +36,9 @@ if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH:$HOME/.local/bin"
fi
# source fzf script for interactive use
if [ -f ~/git/dotfiles/.bash_fzf ] ; then
. ~/git/dotfiles/.bash_fzf
# source misc user scripts
if [ -d ~/git/dotfiles/files ] ; then
. ~/git/dotfiles/files/*
fi
# source headscale autocompletion script
@ -53,11 +53,6 @@ else
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
fi
# get function to see available colors for PS1
if [ -f ~/git/dotfiles/.colors ] ; then
. ~/git/dotfiles/.colors
fi
# fetch uninstalled package names when attempting command (arch only)
if [ -f /usr/share/doc/pkgfile/command-not-found.bash ] ; then
source /usr/share/doc/pkgfile/command-not-found.bash

10
files/.profile Normal file
View file

@ -0,0 +1,10 @@
TODELETE="$(command ls --almost-all ~/git/dotfiles/files)"
if [ -d ~/git/dotfiles ] ; then
bash ~/git/dotfiles/pull.sh
(cd ~ ; rm $TODELETE)
(cd ~/git/dotfiles
ln ./files/* ../../)
fi
. ~/.bashrc

View file

@ -1,38 +1,40 @@
#!/bin/bash
# updates all dotfiles on the system
rm ../../.bash* ../../.profile /root/.bash* /etc/nanorc ../../.PS1 /root/.PS1
TODELETE="$(command ls --almost-all files) .PS1"
cp ./.bash* /root
ln ./.bash* ../../
ln ./.profile ../../
(cd ../.. ; rm $TODELETE)
(cd /root ; rm $TODELETE)
rm /root/.bashrc /root/.profile
cp .bashrc /root
cp .profile /root
cp ./nanorc /etc/nanorc
cp ./files/* /root
ln ./files/* ../../
# changes PS1 prompts
# 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\]$ '
#PS1='\[\033[$RED\]\u\[\033[01;${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\]$ '
#PS1='\[\033[$GREEN\]\u\[\033[01;${SERV_COLOR}m\]@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ '
EOF
if [ -f ../../.env ] ; then
## 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
echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/user
fi
echo "Install fzf, log out and log back in"