From 8065b790fe67c811eb22ee054c3f4ebcc3d72e72 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Tue, 4 Jul 2023 21:33:01 +0200 Subject: [PATCH] safer apply scripts --- conf-only.sh | 2 ++ desktop-config.sh | 20 ++++++++------------ distrobox-config.sh | 18 ++++++------------ kali-config.sh | 17 +++++++---------- minimal.sh | 18 ++++++++++++++++++ server-config.sh | 13 +++++++------ termux-config.sh | 13 +++++++------ 7 files changed, 55 insertions(+), 46 deletions(-) create mode 100755 minimal.sh diff --git a/conf-only.sh b/conf-only.sh index b9f6224..554fde5 100755 --- a/conf-only.sh +++ b/conf-only.sh @@ -1 +1,3 @@ +#!/bin/bash +set -e cp -r $(pwd)/home/.config ~ diff --git a/desktop-config.sh b/desktop-config.sh index c43166e..a9a7e9c 100755 --- a/desktop-config.sh +++ b/desktop-config.sh @@ -1,12 +1,13 @@ #!/bin/bash +set -e -rm -rf ~/.zsh-very-old -mv ~/.zsh-old ~/.zsh-very-old -mv ~/.zsh ~/.zsh-old +[ -f ~/.zsh-very.old ] && rm -rf ~/.zsh-very-old +[ -f ~/.zsh-old ] && mv ~/.zsh-old ~/.zsh-very-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old -rm -rf ~/.zshrc-very-old -mv ~/.zshrc-old ~/.zshrc-very-old -mv ~/.zshrc ~/.zshrc-old +[ -f ~/.zshrc-very-old ] && rm -rf ~/.zshrc-very-old +[ -f ~/.zshrc-old ] && mv ~/.zshrc-old ~/.zshrc-very-old +[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zshrc-old cp -r $(pwd)/home/.gitconfig ~ cp -r $(pwd)/home/.p10k.zsh ~ @@ -16,12 +17,7 @@ cp -r $(pwd)/home/.vimrc ~ cp -r $(pwd)/home/.local ~ cp -r $(pwd)/home/.config ~ cp -r $(pwd)/home/.tmux.conf ~ + touch ~/.local.zsh ln ~/.zsh/zshrc ~/.zshrc - -# Install Vim Stuff -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' diff --git a/distrobox-config.sh b/distrobox-config.sh index 881af40..4f74c30 100755 --- a/distrobox-config.sh +++ b/distrobox-config.sh @@ -1,12 +1,12 @@ #!/bin/bash -rm -rf ~/.zsh-very-old -mv ~/.zsh-old ~/.zsh-very-old -mv ~/.zsh ~/.zsh-old +[ -f ~/.zsh-very.old ] && rm -rf ~/.zsh-very-old +[ -f ~/.zsh-old ] && mv ~/.zsh-old ~/.zsh-very-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old -rm -rf ~/.zshrc-very-old -mv ~/.zshrc-old ~/.zshrc-very-old -mv ~/.zshrc ~/.zshrc-old +[ -f ~/.zshrc-very-old ] && rm -rf ~/.zshrc-very-old +[ -f ~/.zshrc-old ] && mv ~/.zshrc-old ~/.zshrc-very-old +[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zshrc-old cp -r $(pwd)/home/.gitconfig ~ cp -r $(pwd)/home/.p10k.zsh ~ @@ -18,9 +18,3 @@ cp -r $(pwd)/home/.tmux.conf ~ touch ~/.local.zsh ln ~/.zsh-distrobox/zshrc ~/.zshrc - -# Install Vim Stuff -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' diff --git a/kali-config.sh b/kali-config.sh index 6a928b7..b2d1834 100755 --- a/kali-config.sh +++ b/kali-config.sh @@ -1,8 +1,9 @@ #!/bin/bash +set -e -rm -rf ~/.zsh-very-old -mv ~/.zsh-old ~/.zsh-very-old -mv ~/.zsh ~/.zsh-old +[ -f ~/.zsh-very.old ] && rm -rf ~/.zsh-very-old +[ -f ~/.zsh-old ] && mv ~/.zsh-old ~/.zsh-very-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old cp -r $(pwd)/home/.zsh-kali ~ cp -r $(pwd)/home/.vimrc ~ @@ -11,10 +12,6 @@ cp -r $(pwd)/home/.config ~ cp -r $(pwd)/home/.tmux-server.conf ~/.tmux.conf touch ~/.local.zsh -echo "source ~/.zsh-kali/zshrc" >> ~/.zshrc - -# Install Vim Stuff -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +if [ tail -n 1 ~/.zshrc != "source ~/.zsh-kali/zshrc" ]; then + echo "source ~/.zsh-kali/zshrc" >> ~/.zshrc +fi diff --git a/minimal.sh b/minimal.sh new file mode 100755 index 0000000..6068464 --- /dev/null +++ b/minimal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +[ -f ~/.zsh-old ] && rm -rf ~/.zsh-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old + +[ -f ~/.zshrc-old ] && rm -rf ~/.zshrc-old +[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zshrc-old + +cp -r $(pwd)/home/.zsh-server ~ +cp -r $(pwd)/home/.vimrc ~ +mkdir -p ~/.config/nvim +cp -r $(pwd)/home/.config/nvim/init.vim ~/.config/nvim +cp -r $(pwd)/home/.config/nvim/common.vim ~/.config/nvim +cp -r $(pwd)/home/.tmux-server.conf ~/.tmux.conf +touch ~/.local.zsh + +ln ~/.zsh-server/zshrc ~/.zshrc diff --git a/server-config.sh b/server-config.sh index cd075ec..b8923fc 100755 --- a/server-config.sh +++ b/server-config.sh @@ -1,12 +1,13 @@ #!/bin/bash +set -e -rm -rf ~/.zsh-very-old -mv ~/.zsh-old ~/.zsh-very-old -mv ~/.zsh ~/.zsh-old +[ -f ~/.zsh-very.old ] && rm -rf ~/.zsh-very-old +[ -f ~/.zsh-old ] && mv ~/.zsh-old ~/.zsh-very-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old -rm -rf ~/.zshrc-very-old -mv ~/.zshrc-old ~/.zshrc-very-old -mv ~/.zshrc ~/.zshrc-old +[ -f ~/.zshrc-very-old ] && rm -rf ~/.zshrc-very-old +[ -f ~/.zshrc-old ] && mv ~/.zshrc-old ~/.zshrc-very-old +[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zshrc-old cp -r $(pwd)/home/.zsh-server ~ cp -r $(pwd)/home/.vimrc ~ diff --git a/termux-config.sh b/termux-config.sh index ad93d16..0790ce4 100755 --- a/termux-config.sh +++ b/termux-config.sh @@ -1,12 +1,13 @@ #!/bin/bash +set -e -rm -rf ~/.zsh-very-old -mv ~/.zsh-old ~/.zsh-very-old -mv ~/.zsh ~/.zsh-old +[ -f ~/.zsh-very.old ] && rm -rf ~/.zsh-very-old +[ -f ~/.zsh-old ] && mv ~/.zsh-old ~/.zsh-very-old +[ -f ~/.zsh ] && mv ~/.zsh ~/.zsh-old -rm -rf ~/.zshrc-very-old -mv ~/.zshrc-old ~/.zshrc-very-old -mv ~/.zshrc ~/.zshrc-old +[ -f ~/.zshrc-very-old ] && rm -rf ~/.zshrc-very-old +[ -f ~/.zshrc-old ] && mv ~/.zshrc-old ~/.zshrc-very-old +[ -f ~/.zshrc ] && mv ~/.zshrc ~/.zshrc-old cp -r $(pwd)/home/.p10k-standart-fonts.zsh ~/.p10k.zsh cp -r $(pwd)/home/.zsh ~