Added update into dotfiles functions
This commit is contained in:
parent
278677ca86
commit
cfa721db33
|
@ -42,17 +42,6 @@ vfind() {
|
|||
}
|
||||
|
||||
### Others ###
|
||||
pull-dotfiles() {
|
||||
current_dir=$PWD
|
||||
echo Pulling dotfiles...
|
||||
cd ~/.config/dotfiles && git pull
|
||||
echo Pulling scripts...
|
||||
cd ~/.scripts && git pull
|
||||
echo Pulling oh-my-zsh
|
||||
cd ~/.config/oh-my-zsh && git pull
|
||||
cd $current_dir
|
||||
}
|
||||
|
||||
# Recover a vim backup
|
||||
recover() {
|
||||
if [ -f $1 ]; then
|
||||
|
@ -100,6 +89,8 @@ makelatex() {
|
|||
cp /home/thomas/.script/classgen/Makefile.latex ./Makefile
|
||||
}
|
||||
|
||||
source $HOME/.config/dotfiles/zsh/update.zsh
|
||||
|
||||
# cdg : cd to a git repo
|
||||
if [ -d "$GCLONE_PATH" ]; then
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
pull-dotfiles() {
|
||||
current_dir=$PWD
|
||||
echo "\033[32;1m=== Updating dotfiles ===\033[0m"
|
||||
cd ~/.config/dotfiles && git pull
|
||||
echo "\033[32;1m=== Updating oh-my-zsh ===\033[0m"
|
||||
cd ~/.config/oh-my-zsh && git pull
|
||||
cd $current_dir
|
||||
}
|
||||
|
||||
update() {
|
||||
|
||||
echo "\033[32;1m=== Starting the update, please enter your password ===\033[0m"
|
||||
|
||||
# Ask for sudo right now
|
||||
sudo true
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not get sudo..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "\033[32;1m=== Updating system ===\033[0m"
|
||||
|
||||
# Debian based systems
|
||||
command -v apt > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo apt update -y
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo apt upgrade -y
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo apt autoremove -y
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Archlinux based systems
|
||||
command -v yaourt > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
yaourt -Syu
|
||||
else
|
||||
command -v pacman > /dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo pacman -Syu
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fedora based systems
|
||||
command -v dnf > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
dnf upgrade
|
||||
fi
|
||||
|
||||
# Update rust if installed
|
||||
command -v rustup > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "\033[32;1m=== Updating rustup ===\033[0m"
|
||||
rustup self update
|
||||
|
||||
echo "\033[32;1m=== Updating rust ===\033[0m"
|
||||
rustup update
|
||||
|
||||
cargo install-update --help > /dev/null 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "\033[32;1m=== Updating rust packages ===\033[0m"
|
||||
cargo install-update -ag
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update the dotfiles
|
||||
pull-dotfiles
|
||||
|
||||
echo "\033[32;1m=== Update finished ===\033[0m"
|
||||
}
|
Loading…
Reference in New Issue