From ac0c3b3f79abf25fca6643bec4c2f486fb99c119 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Thu, 17 Aug 2023 20:56:53 +0200 Subject: [PATCH] Updates --- 1-install.sh | 103 ++++--------------------------------------- 2-qtile.sh | 84 ++++++++++++++++++++++++++++++++++- 3-hyprland.conf | 54 +++++++++++++++++++++++ scripts/library.sh | 106 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 252 insertions(+), 95 deletions(-) create mode 100755 3-hyprland.conf create mode 100755 scripts/library.sh diff --git a/1-install.sh b/1-install.sh index 7d7be82..23946ff 100755 --- a/1-install.sh +++ b/1-install.sh @@ -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 # ------------------------------------------------------ diff --git a/2-qtile.sh b/2-qtile.sh index 66c84e6..0dd61b3 100755 --- a/2-qtile.sh +++ b/2-qtile.sh @@ -41,7 +41,89 @@ echo "" # ------------------------------------------------------ # Install required packages # ------------------------------------------------------ -sudo pacman -S --noconfirm qtile +echo "" +echo "-> Install main packages" + +packagesPacman=("qtile" "picom" "rofi" "dunst" "polybar" "rofi-calc"); + +# 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 +# ------------------------------------------------------ +_installPackagesPacman "${packagesPacman[@]}"; +# _installPackagesYay "${packagesYay[@]}"; # ------------------------------------------------------ # Create symbolic links diff --git a/3-hyprland.conf b/3-hyprland.conf new file mode 100755 index 0000000..40e96fd --- /dev/null +++ b/3-hyprland.conf @@ -0,0 +1,54 @@ +#!/bin/bash +# _ _ _ _ +# | | | |_ _ _ __ _ __| | __ _ _ __ __| | +# | |_| | | | | '_ \| '__| |/ _` | '_ \ / _` | +# | _ | |_| | |_) | | | | (_| | | | | (_| | +# |_| |_|\__, | .__/|_| |_|\__,_|_| |_|\__,_| +# |___/|_| +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- +# Install Script for Hyprland +# ------------------------------------------------------ + +# ------------------------------------------------------ +# Confirm Start +# ------------------------------------------------------ +clear +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 +echo "" + +# ------------------------------------------------------ +# Install required packages +# ------------------------------------------------------ +sudo pacman -S --noconfirm qtile + +# ------------------------------------------------------ +# Create symbolic links +# ------------------------------------------------------ +echo "-> Create symbolic link for startx" +rm ~/.xinitrc +ln -s ~/dotfiles/qtile/.xinitrc ~/.xinitrc + +echo "DONE!" diff --git a/scripts/library.sh b/scripts/library.sh new file mode 100755 index 0000000..07a0a29 --- /dev/null +++ b/scripts/library.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# _ _ _ +# | | (_) |__ _ __ __ _ _ __ _ _ +# | | | | '_ \| '__/ _` | '__| | | | +# | |___| | |_) | | | (_| | | | |_| | +# |_____|_|_.__/|_| \__,_|_| \__, | +# |___/ +# +# by Stephan Raabe (2023) +# ----------------------------------------------------- + +# ------------------------------------------------------ +# 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[@]}"; +} + + +# ------------------------------------------------------ +# Create 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 +}