This commit is contained in:
Stephan Raabe
2023-08-17 20:56:53 +02:00
parent d304b57617
commit ac0c3b3f79
4 changed files with 252 additions and 95 deletions

View File

@@ -10,6 +10,12 @@
# Install Script for dotfiles and configuration
# yay must be installed
# ------------------------------------------------------
# ------------------------------------------------------
# Load Library
# ------------------------------------------------------
source $(dirname "$0")/scripts/library.sh
clear
echo " _ _ __ _ _ "
echo " __| | ___ | |_ / _(_) | ___ ___ "
@@ -21,7 +27,7 @@ echo "by Stephan Raabe (2023)"
echo "-------------------------------------"
echo ""
echo "The script will not remove any folders or files."
echo "Symbolic links will be created instead if the folder or files doesn't exists."
echo "Symbolic links will be created instead when the folder or files doesn't exists."
echo "If you want to overwrite your configuration please remove the correspondig folder in your .config first."
echo "(For example ~/.config/qtile, etc.)"
echo ""
@@ -61,81 +67,11 @@ done
echo ""
echo "-> Install main packages"
packagesPacman=("alacritty" "scrot" "nitrogen" "picom" "starship" "slock" "neovim" "rofi" "dunst" "mpv" "freerdp" "xfce4-power-manager" "thunar" "mousepad" "ttf-font-awesome" "ttf-fira-sans" "ttf-fira-code" "ttf-firacode-nerd" "figlet" "lxappearance" "polybar" "breeze" "breeze-gtk" "rofi-calc" "vlc" "exa" "python-pip" "python-psutil" "python-rich" "python-click");
packagesPacman=("alacritty" "chromium" "scrot" "nitrogen" "starship" "slock" "neovim" "mpv" "freerdp" "xfce4-power-manager" "thunar" "mousepad" "ttf-font-awesome" "ttf-fira-sans" "ttf-fira-code" "ttf-firacode-nerd" "figlet" "lxappearance" "breeze" "breeze-gtk" "vlc" "exa" "python-pip" "python-psutil" "python-rich" "python-click");
packagesYay=("brave-bin" "pfetch" "bibata-cursor-theme");
# pywal installation below
# ------------------------------------------------------
# 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
}
# ------------------------------------------------------
# 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 --noconfirm -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 --noconfirm -S "${toInstall[@]}";
}
# ------------------------------------------------------
# Install required packages
# ------------------------------------------------------
@@ -168,28 +104,6 @@ fi
echo ""
echo "-> Install symbolic links"
_installSymLink() {
symlink="$1";
linksource="$2";
linktarget="$3";
if [ -L "${symlink}" ]; then
echo "Link ${symlink} exists already."
else
if [ -d ${symlink} ]; then
echo "Directory ${symlink}/ exists."
ln -s ${linksource} ${linktarget}
else
if [ -f ${symlink} ]; then
echo "File ${symlink} exists."
ln -s ${linksource} ${linktarget}
else
ln -s ${linksource} ${linktarget}
echo "Link ${linksource} -> ${linktarget} created."
fi
fi
fi
}
_installSymLink ~/.config/alacritty ~/dotfiles/alacritty/ ~/.config
_installSymLink ~/.config/picom ~/dotfiles/picom/ ~/.config
_installSymLink ~/.config/rofi ~/dotfiles/rofi/ ~/.config
@@ -236,6 +150,7 @@ while true; do
esac
done
_installSymLink ~/.bashrc ~/dotfiles/.bashrc ~/.bashrc
# ------------------------------------------------------
# Install Theme, Icons and Cursor
# ------------------------------------------------------