New install script incl. update feature

This commit is contained in:
Stephan Raabe 2023-04-12 11:36:57 +02:00
parent dbec423595
commit b5fca04302

View File

@ -11,20 +11,129 @@
# yay must be installed # yay must be installed
# ------------------------------------------------------ # ------------------------------------------------------
read -p "Do you want to start? yay must be installed! " s clear
echo "START INSTALLATION..." echo "DO YOU WANT TO START THE INSTALLATION NOW?"
read -p "(Return to start, Ctrl+c to cancel)" c
# ------------------------------------------------------ # ------------------------------------------------------
# Install required packages # Install required packages
# ------------------------------------------------------ # ------------------------------------------------------
echo ""
echo "-> Install main packages" echo "-> Install main packages"
sudo pacman -S alacritty scrot nitrogen picom starship slock neomutt neovim rofi dunst ueberzug mpv freerdp spotifyd xfce4-power-manager python-pip thunar mousepad lxappearance papirus-icon-theme ttf-font-awesome ttf-fira-sans ttf-fira-code ttf-firacode-nerd figlet cmatrix qalculate-gtk adapta-gtk-theme terminator polybar
packagesPacman=("alacritty" "scrot" "nitrogen" "picom" "starship" "slock" "neomutt" "neovim" "rofi" "dunst" "ueberzug" "mpv" "freerdp" "spotifyd" "xfce4-power-manager" "python-pip" "thunar" "mousepad" "papirus-icon-theme" "ttf-font-awesome" "ttf-fira-sans" "ttf-fira-code" "ttf-firacode-nerd" "figlet" "cmatrix" "qalculate-gtk" "adapta-gtk-theme" "terminator" "polybar");
packagesYay=("brave-bin" "timeshift" "tela-circle-icon-theme-orange" "pfetch" "preload" "bibata-cursor-theme");
packagesPip=("psutil" "rich" "click" "pywal");
# ------------------------------------------------------
# Function: Is package installed
# ------------------------------------------------------
_isInstalledPacman() {
package="$1";
check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
_isInstalledYay() {
package="$1";
check="$(yay -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
_isInstalledPip() {
package="$1";
check="$(pip list | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0;
else
echo 1;
fi
}
# ------------------------------------------------------
# Function Install all package if not installed
# ------------------------------------------------------
_installPackagesPacman() {
toInstall=();
for pkg; do
if [[ $(_isInstalledPacman "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All pacman packages are already installed.";
return;
fi;
printf "Packages not installed:\n%s\n" "${toInstall[@]}";
sudo pacman -S "${toInstall[@]}";
}
_installPackagesYay() {
toInstall=();
for pkg; do
if [[ $(_isInstalledYay "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All packages are already installed.";
return;
fi;
printf "AUR ackages not installed:\n%s\n" "${toInstall[@]}";
yay -S "${toInstall[@]}";
}
_installPackagesPip() {
toInstall=();
for pkg; do
if [[ $(_isInstalledPip "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All packages are already installed.";
return;
fi;
printf "Pip packages not installed:\n%s\n" "${toInstall[@]}";
pip install "${toInstall[@]}";
}
# ------------------------------------------------------ # ------------------------------------------------------
# Install required packages # Install required packages
# ------------------------------------------------------ # ------------------------------------------------------
echo "-> Install AUR packages" _installPackagesPacman "${packagesPacman[@]}";
yay -S brave-bin pywal timeshift tela-circle-icon-theme-orange pfetch preload bibata-cursor-theme _installPackagesYay "${packagesYay[@]}";
_installPackagesPip "${packagesPip[@]}";
# ------------------------------------------------------ # ------------------------------------------------------
# Enable services # Enable services
@ -32,62 +141,92 @@ yay -S brave-bin pywal timeshift tela-circle-icon-theme-orange pfetch preload bi
sudo systemctl enable preload sudo systemctl enable preload
# ------------------------------------------------------ # ------------------------------------------------------
# Install Pip packages # Create .config folder
# ------------------------------------------------------ # ------------------------------------------------------
echo "-> Install Pip packages" echo ""
pip install psutil rich click echo "-> Install .config folder"
if [ -d ~/.config ]; then
echo ".config folder already exists"
else
mkdir ~/.config
echo ".config folder created"
fi
# ------------------------------------------------------ # ------------------------------------------------------
# Create symbolic links # Create symbolic links
# ------------------------------------------------------ # ------------------------------------------------------
echo "-> Create symbolic links" echo ""
mkdir ~/.config echo "-> Install symbolic links"
ln -s ~/dotfiles/qtile/ ~/.config
ln -s ~/dotfiles/alacritty/ ~/.config _installSymLink() {
ln -s ~/dotfiles/neomutt/ ~/.config symlink="$1";
ln -s ~/dotfiles/picom/ ~/.config linksource="$2";
ln -s ~/dotfiles/ranger/ ~/.config linktarget="$3";
ln -s ~/dotfiles/rofi/ ~/.config if [ -L "${symlink}" ]; then
ln -s ~/dotfiles/spotifyd/ ~/.config echo "Link ${symlink} exists already!"
ln -s ~/dotfiles/vim/ ~/.config else
ln -s ~/dotfiles/nvim/ ~/.config if [ -d ${symlink} ]; then
ln -s ~/dotfiles/polybar ~/.config echo "Directory ${symlink}/ exists"
ln -s ~/dotfiles/dunst ~/.config else
ln -s ~/dotfiles/starship/starship.toml ~/.config/starship.toml if [ -f ${symlink} ]; then
rm ~/.bashrc echo "File ${symlink} exists"
ln -s ~/dotfiles/.bashrc ~/.bashrc else
ln -s ${linksource} ${linktarget}
echo "Link ${linksource} -> ${linktarget} created"
fi
fi
fi
}
_installSymLink ~/.config/qtile ~/dotfiles/qtile/ ~/.config
_installSymLink ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config
_installSymLink ~/.config/neomutt ~/dotfiles/neomutt/ ~/.config
_installSymLink ~/.config/picom ~/dotfiles/picom/ ~/.config
_installSymLink ~/.config/ranger ~/dotfiles/ranger/ ~/.config
_installSymLink ~/.config/rofi ~/dotfiles/rofi/ ~/.config
_installSymLink ~/.config/spotifyd ~/dotfiles/spotifyd/ ~/.config
_installSymLink ~/.config/vim ~/dotfiles/vim/ ~/.config
_installSymLink ~/.config/nvim ~/dotfiles/nvim/ ~/.config
_installSymLink ~/.config/polybar ~/dotfiles/polybar/ ~/.config
_installSymLink ~/.config/dunst ~/dotfiles/dunst/ ~/.config
_installSymLink ~/.config/starship.toml ~/dotfiles/starship/starship.toml ~/.config/starship.toml
_installSymLink ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc
# ------------------------------------------------------ # ------------------------------------------------------
# Install Theme, Icons and Cursor # Install Theme, Icons and Cursor
# ------------------------------------------------------ # ------------------------------------------------------
rm ~/.gtkrc-2.0 _installSymLink ~/.gtkrc-2.0 ~/dotfiles/.gtkrc-2.0 ~/.gtkrc-2.0
ln -s ~/dotfiles/.gtkrc-2.0 ~/.gtkrc-2.0 _installSymLink ~/.config/gtk-3.0 ~/dotfiles/gtk-3.0/ ~/.config/
rm -r ~/.config/gtk-3.0/ _installSymLink ~/.Xresources ~/dotfiles/.Xresources ~/.Xresources
ln -s ~/dotfiles/gtk-3.0/ ~/.config/ _installSymLink ~/.icons ~/dotfiles/.icons/ ~/
rm ~/.Xresources
ln -s ~/dotfiles/.Xresources ~/.Xresources
rm -r ~/.icons
ln -s ~/dotfiles/.icons/ ~/
# ------------------------------------------------------ # ------------------------------------------------------
# Clone wallpapers # Clone wallpapers
# ------------------------------------------------------ # ------------------------------------------------------
echo ""
echo "-> Install wallpapers" echo "-> Install wallpapers"
git clone https://gitlab.com/stephan-raabe/wallpaper.git ~/wallpaper if [ -d ~/wallpaper/ ]; then
echo "wallpaper folder already exists"
# ------------------------------------------------------ else
# Install startship plain text git clone https://gitlab.com/stephan-raabe/wallpaper.git ~/wallpaper
# ------------------------------------------------------ echo "wallpaper installed"
# starship preset plain-text-symbols > ~/.config/starship.toml fi
# ------------------------------------------------------ # ------------------------------------------------------
# Install custom issue (login prompt) # Install custom issue (login prompt)
# ------------------------------------------------------ # ------------------------------------------------------
echo ""
echo "-> Install login screen"
sudo cp ~/dotfiles/issue /etc/issue sudo cp ~/dotfiles/issue /etc/issue
echo "Login screen installed"
# ------------------------------------------------------ # ------------------------------------------------------
# Init pywal # Init pywal
# ------------------------------------------------------ # ------------------------------------------------------
echo ""
echo "-> Init pywal"
wal -i ~/wallpaper/default.jpg -n wal -i ~/wallpaper/default.jpg -n
echo "pywal initiated"
echo ""
echo "DONE! Reboot suggested..." echo "DONE! Reboot suggested..."