2023-02-17 11:11:48 -05:00
|
|
|
#!/bin/bash
|
2023-02-26 10:32:15 -05:00
|
|
|
# _ _ __ _ _
|
|
|
|
# __| | ___ | |_ / _(_) | ___ ___
|
|
|
|
# / _` |/ _ \| __| |_| | |/ _ \/ __|
|
|
|
|
# | (_| | (_) | |_| _| | | __/\__ \
|
|
|
|
# \__,_|\___/ \__|_| |_|_|\___||___/
|
|
|
|
#
|
|
|
|
# by Stephan Raabe (2023)
|
2023-02-17 11:11:48 -05:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install Script for dotfiles and configuration
|
|
|
|
# yay must be installed
|
|
|
|
# ------------------------------------------------------
|
|
|
|
|
2023-04-12 06:27:35 -04:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Confirm Start
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
clear
|
2023-04-12 06:27:35 -04:00
|
|
|
echo " _ _ __ _ _ "
|
|
|
|
echo " __| | ___ | |_ / _(_) | ___ ___ "
|
|
|
|
echo " / _' |/ _ \| __| |_| | |/ _ \/ __| "
|
|
|
|
echo "| (_| | (_) | |_| _| | | __/\__ \ "
|
|
|
|
echo " \__,_|\___/ \__|_| |_|_|\___||___/ "
|
|
|
|
echo " "
|
|
|
|
echo "by Stephan Raabe (2023)"
|
|
|
|
echo "-------------------------------------"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
|
|
|
echo "Installation started."
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
exit;
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
2023-02-17 11:11:48 -05:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install required packages
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
echo ""
|
2023-02-17 11:11:48 -05:00
|
|
|
echo "-> Install main packages"
|
2023-04-12 05:36:57 -04:00
|
|
|
|
2023-04-15 13:26:17 -04:00
|
|
|
packagesPacman=("alacritty" "scrot" "nitrogen" "picom" "starship" "slock" "neomutt" "neovim" "rofi" "dunst" "ueberzug" "mpv" "freerdp" "spotifyd" "xfce4-power-manager" "python-pip" "thunar" "mousepad" "ttf-font-awesome" "ttf-fira-sans" "ttf-fira-code" "ttf-firacode-nerd" "figlet" "cmatrix" "lxappearance" "polybar" "breeze" "breeze-gtk" "rofi-calc");
|
2023-04-12 05:36:57 -04:00
|
|
|
|
2023-04-13 04:11:34 -04:00
|
|
|
packagesYay=("brave-bin" "pfetch" "bibata-cursor-theme");
|
2023-04-13 09:18:36 -04:00
|
|
|
# pywal installation below
|
2023-04-12 05:36:57 -04:00
|
|
|
|
2023-04-12 09:25:19 -04:00
|
|
|
packagesPip=("psutil" "rich" "click");
|
2023-04-12 05:36:57 -04:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# 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[@]}";
|
2023-04-13 04:11:34 -04:00
|
|
|
sudo pacman --noconfirm -S "${toInstall[@]}";
|
2023-04-12 05:36:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_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[@]}";
|
2023-04-13 04:11:34 -04:00
|
|
|
yay --noconfirm -S "${toInstall[@]}";
|
2023-04-12 05:36:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_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[@]}";
|
|
|
|
}
|
2023-02-17 11:11:48 -05:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install required packages
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
_installPackagesPacman "${packagesPacman[@]}";
|
|
|
|
_installPackagesYay "${packagesYay[@]}";
|
|
|
|
_installPackagesPip "${packagesPip[@]}";
|
2023-03-15 05:13:45 -04:00
|
|
|
|
2023-04-12 09:25:19 -04:00
|
|
|
# pywal requires dedicated installation
|
2023-04-13 09:18:36 -04:00
|
|
|
if [ -f /usr/bin/wal ]; then
|
|
|
|
echo "pywal already installed."
|
|
|
|
else
|
|
|
|
yay --noconfirm -S pywal
|
|
|
|
fi
|
2023-04-12 09:25:19 -04:00
|
|
|
|
2023-03-15 05:13:45 -04:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Enable services
|
|
|
|
# ------------------------------------------------------
|
|
|
|
sudo systemctl enable preload
|
2023-02-17 11:11:48 -05:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
# Create .config folder
|
2023-02-17 11:11:48 -05:00
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
echo ""
|
|
|
|
echo "-> Install .config folder"
|
|
|
|
|
|
|
|
if [ -d ~/.config ]; then
|
2023-04-12 06:27:35 -04:00
|
|
|
echo ".config folder already exists."
|
2023-04-12 05:36:57 -04:00
|
|
|
else
|
|
|
|
mkdir ~/.config
|
2023-04-12 06:27:35 -04:00
|
|
|
echo ".config folder created."
|
2023-04-12 05:36:57 -04:00
|
|
|
fi
|
2023-02-17 11:11:48 -05:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Create symbolic links
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
echo ""
|
|
|
|
echo "-> Install symbolic links"
|
|
|
|
|
|
|
|
_installSymLink() {
|
|
|
|
symlink="$1";
|
|
|
|
linksource="$2";
|
|
|
|
linktarget="$3";
|
|
|
|
if [ -L "${symlink}" ]; then
|
2023-04-12 06:27:35 -04:00
|
|
|
echo "Link ${symlink} exists already."
|
2023-04-12 05:36:57 -04:00
|
|
|
else
|
|
|
|
if [ -d ${symlink} ]; then
|
2023-04-12 06:27:35 -04:00
|
|
|
echo "Directory ${symlink}/ exists."
|
2023-04-12 05:36:57 -04:00
|
|
|
else
|
|
|
|
if [ -f ${symlink} ]; then
|
2023-04-12 06:27:35 -04:00
|
|
|
echo "File ${symlink} exists."
|
2023-04-12 05:36:57 -04:00
|
|
|
else
|
|
|
|
ln -s ${linksource} ${linktarget}
|
2023-04-12 06:27:35 -04:00
|
|
|
echo "Link ${linksource} -> ${linktarget} created."
|
2023-04-12 05:36:57 -04:00
|
|
|
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
|
2023-04-12 07:33:44 -04:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install .bashrc
|
|
|
|
# ------------------------------------------------------
|
|
|
|
echo ""
|
|
|
|
echo "-> Install .bashrc"
|
|
|
|
while true; do
|
|
|
|
read -p "Do you want to replace the existing .bashrc file? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
|
|
|
rm ~/.bashrc
|
|
|
|
echo ".bashrc removed"
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
echo "Replacement of .bashrc skipped."
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
2023-04-12 05:36:57 -04:00
|
|
|
_installSymLink ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc
|
2023-04-10 11:04:46 -04:00
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install Theme, Icons and Cursor
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 07:33:44 -04:00
|
|
|
echo ""
|
|
|
|
echo "-> Install Theme"
|
|
|
|
while true; do
|
|
|
|
read -p "Do you want to replace the existing theme configuration? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
2023-04-13 04:11:34 -04:00
|
|
|
if [ -d ~/.config/gtk-3.0 ]; then
|
|
|
|
rm -r ~/.config/gtk-3.0
|
|
|
|
echo "gtk-3.0 removed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ~/.gtkrc-2.0 ]; then
|
|
|
|
rm ~/.gtkrc-2.0
|
|
|
|
echo ".gtkrc-2.0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ~/.Xresources ]; then
|
|
|
|
rm ~/.Xresources
|
|
|
|
echo ".Xresources removed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ~/.icons ]; then
|
|
|
|
rm -r ~/.icons
|
|
|
|
echo ".icons removed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
_installSymLink ~/.gtkrc-2.0 ~/dotfiles/.gtkrc-2.0 ~/.gtkrc-2.0
|
|
|
|
_installSymLink ~/.config/gtk-3.0 ~/dotfiles/gtk-3.0/ ~/.config/
|
|
|
|
_installSymLink ~/.Xresources ~/dotfiles/.Xresources ~/.Xresources
|
|
|
|
_installSymLink ~/.icons ~/dotfiles/.icons/ ~/
|
|
|
|
|
2023-04-12 07:33:44 -04:00
|
|
|
echo "Existing theme removed"
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
echo "Replacement of theme skipped."
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
2023-02-17 11:11:48 -05:00
|
|
|
|
2023-04-04 05:22:52 -04:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install custom issue (login prompt)
|
|
|
|
# ------------------------------------------------------
|
2023-04-12 05:36:57 -04:00
|
|
|
echo ""
|
|
|
|
echo "-> Install login screen"
|
2023-04-12 06:27:35 -04:00
|
|
|
while true; do
|
|
|
|
read -p "Do you want to install the custom login promt? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
|
|
|
sudo cp ~/dotfiles/issue /etc/issue
|
|
|
|
echo "Login promt installed."
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
echo "Custom login promt skipped."
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
2023-04-04 05:22:52 -04:00
|
|
|
|
2023-04-13 10:41:22 -04:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Install wallpapers
|
|
|
|
# ------------------------------------------------------
|
|
|
|
echo ""
|
|
|
|
echo "-> Install wallapers"
|
|
|
|
while true; do
|
|
|
|
read -p "Do you want to clone the wallpapers? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
|
|
|
if [ -d ~/wallpaper/ ]; then
|
|
|
|
echo "wallpaper folder already exists."
|
|
|
|
else
|
|
|
|
git clone https://gitlab.com/stephan-raabe/wallpaper.git ~/wallpaper
|
|
|
|
echo "wallpaper installed."
|
|
|
|
fi
|
|
|
|
echo "Wallpaper installed."
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
if [ -d ~/wallpaper/ ]; then
|
|
|
|
echo "wallpaper folder already exists."
|
|
|
|
else
|
|
|
|
mkdir ~/wallpaper
|
|
|
|
fi
|
|
|
|
cp ~/dotfiles/default.jpg ~/wallpaper
|
|
|
|
echo "Default wallpaper installed."
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# ------------------------------------------------------
|
|
|
|
# Init pywal
|
|
|
|
# ------------------------------------------------------
|
|
|
|
echo ""
|
|
|
|
echo "-> Init pywal"
|
2023-04-13 12:04:04 -04:00
|
|
|
wal -i ~/dotfiles/default.jpg
|
2023-04-13 10:41:22 -04:00
|
|
|
echo "pywal initiated."
|
|
|
|
|
2023-02-17 11:11:48 -05:00
|
|
|
# ------------------------------------------------------
|
2023-04-12 06:27:35 -04:00
|
|
|
# DONE
|
2023-02-17 11:11:48 -05:00
|
|
|
# ------------------------------------------------------
|
2023-04-13 12:04:04 -04:00
|
|
|
clear
|
|
|
|
echo "DONE!"
|