diff --git a/arch/setup b/arch/_old/setup similarity index 100% rename from arch/setup rename to arch/_old/setup diff --git a/arch/system-check b/arch/check similarity index 88% rename from arch/system-check rename to arch/check index 70a54ce..dbc3703 100755 --- a/arch/system-check +++ b/arch/check @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: system-check +# Name: check # Version: 1.0.0 # Author: Solomon Laing # Description: @@ -17,7 +17,7 @@ fi # check sudo is installed and user is in sudo or wheel group # if not, direct user how to resolve -if ! command -v sudo &> /dev/null; then +if ! command -v sudo &>/dev/null; then echo "sudo must be intsalled!" echo " To install sudo: @@ -38,7 +38,10 @@ if [[ "wheel" =~ "$groups" ]] || [[ "sudo" =~ "$groups" ]]; then fi # check for internet connection -connectivity=$(ping -c 1 -q google.com >&/dev/null; echo $?) +connectivity=$( + ping -c 1 -q google.com >&/dev/null + echo $? +) if [ $connectivity -ne 0 ]; then echo "You must be connected to the internet to run this collection of scripts. If you cloned these scripts in arch-chroot you may have problems." diff --git a/arch/inkos-run b/arch/inkos-run new file mode 100755 index 0000000..9ab60d6 --- /dev/null +++ b/arch/inkos-run @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +echo "This script is going to attempt set up my system and it's dependencies. As such it will ask for root privilages." + +read -r -p "Are you sure you want to continue? [Y/n] " input +case $input in +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "continuing..." + ;; +esac + +check + +script_dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +filter="" +dry="0" + +while [[ $# -gt 0 ]]; do + if [[ $1 == "--dry" ]]; then + dry="1" + else + filter="$1" + fi + shift +done + +log() { + if [[ dry -eq "1" ]]; then + echo "[DRY_RUN]: $@" + else + echo "$@" + fi +} + +execute() { + log "execute $*" + if [[ dry -eq "1" ]]; then + return + fi + + "$@" +} + +log "$script_dir -- $filter" + +cd "$script_dir" || exit 1 +scripts=$(find ./runs -maxdepth 1 -mindepth 1 -executable -type f) + +for script in $scripts; do + if echo "$script" | grep -qv "$filter"; then + log "filtering $script" + continue + fi + + execute "$script" +done diff --git a/arch/install-dmenu-inkletblot b/arch/install-dmenu-inkletblot deleted file mode 100755 index 0f193b6..0000000 --- a/arch/install-dmenu-inkletblot +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -#----------------------------------- -# Name: install-dmenu-inkletblot -# Version: 1.0.0 -# Author: Solomon Laing -# Description: -# Installs my customisation of dmenu -#----------------------------------- - -clear - -if command -v dmenu &> /dev/null; then - echo "dmenu is already installed on the system." - exit 0 -fi - -echo "This script is going to install dmenu, my fork of dmenu with my custom styling. As such it will ask for root privilages." - -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -cd /tmp -git clone https://gitlab.inkletblot.com/inkletblot/dmenu-inkletblot -cd dmenu-inkletblot -git checkout config -sudo -S make clean install - -if ! command -v dmenu &> /dev/null; then - echo "dmenu failed to install, please manually rectify this and then rerun this setup with: ./setup install-dmenu" - exit 1 -fi - -exit 0 diff --git a/arch/install-dwm-inkletblot b/arch/install-dwm-inkletblot deleted file mode 100755 index b590c53..0000000 --- a/arch/install-dwm-inkletblot +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -#----------------------------------- -# Name: install-dwm-inkletblot -# Version: 1.0.0 -# Author: Solomon Laing -# Description: -# Installs my customisation of dwm -#----------------------------------- - -clear - -if command -v dwm &> /dev/null; then - echo "dwm is already installed on the system." - exit 0 -fi - -echo "This script is going to install dwm, my fork of dwm with my custom styling. As such it will ask for root privilages." - -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -cd /tmp -git clone https://gitlab.inkletblot.com/inkletblot/dwm-inkletblot -cd dwm-inkletblot -git checkout config -sudo -S make clean install - -if ! command -v dwm &> /dev/null; then - echo "dwm failed to install, please manually rectify this and then rerun this setup with: ./setup install-dwm" - exit 1 -fi - -exit 0 diff --git a/arch/install-dwmblocks-inkletblot b/arch/install-dwmblocks-inkletblot deleted file mode 100755 index b29680d..0000000 --- a/arch/install-dwmblocks-inkletblot +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -#----------------------------------- -# Name: install-dwmblocks-inkletblot -# Version: 1.0.0 -# Author: Solomon Laing -# Description: -# Installs my customisation of dwmblocks -#----------------------------------- - -clear - -if command -v dwmblocks &> /dev/null; then - echo "dwmblocks is already installed on the system." - exit 0 -fi - -echo "This script is going to install dwmblocks, my fork of dmenu with my custom styling. As such it will ask for root privilages." - -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -cd /tmp -git clone https://gitlab.inkletblot.com/inkletblot/dwmblocks-inkletblot -cd dwmblocks-inkletblot -sudo -S make clean install - -if ! command -v dwmblocks &> /dev/null; then - echo "dwmblocks failed to install, please manually rectify this and then rerun this setup with: ./setup install-dwmblocks" - exit 1 -fi - -exit 0 diff --git a/arch/install-st-inkletblot b/arch/install-st-inkletblot deleted file mode 100755 index ed2f658..0000000 --- a/arch/install-st-inkletblot +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -#----------------------------------- -# Name: install-st-inkletblot -# Version: 1.0.0 -# Author: Solomon Laing -# Description: -# Installs my customisation of st -#----------------------------------- - -clear - -if command -v st &> /dev/null; then - echo "st is already installed on the system." - exit 0 -fi - -echo "This script is going to install st, my fork of st with my custom styling. As such it will ask for root privilages." - -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -cd /tmp -git clone https://gitlab.inkletblot.com/inkletblot/st-inkletblot -cd st-inkletblot -git checkout config -sudo -S make clean install - -if ! command -v st &> /dev/null; then - echo "st failed to install, please manually rectify this and then rerun this setup with: ./setup install-st" - exit 1 -fi - -exit 0 diff --git a/arch/install-config b/arch/runs/config similarity index 76% rename from arch/install-config rename to arch/runs/config index d269a54..9e7955d 100755 --- a/arch/install-config +++ b/arch/runs/config @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-dmenu-inkletblot +# Name: config # Version: 1.0.0 # Author: Solomon Laing # Description: @@ -12,17 +12,8 @@ clear echo "This script is going to install my dotfiles." -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac function config { - /usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ + /usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ } if [ ! -d $HOME/.cfg ]; then @@ -37,12 +28,12 @@ The script will now attempt to install the configs, if configs have been install config checkout main if [ $? = 0 ]; then - echo "Checked out config."; + echo "Checked out config." else - echo "Backing up pre-existing dot files."; + echo "Backing up pre-existing dot files." mkdir -p $HOME/.config-backup config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv $HOME/{} $HOME/.config-backup/{} -fi; +fi config checkout main diff --git a/arch/default-programs b/arch/runs/default-programs similarity index 100% rename from arch/default-programs rename to arch/runs/default-programs diff --git a/arch/install-defaults b/arch/runs/defaults similarity index 66% rename from arch/install-defaults rename to arch/runs/defaults index 0d55a9e..191a9d7 100755 --- a/arch/install-defaults +++ b/arch/runs/defaults @@ -1,12 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-yay +# Name: defoults # Version: 1.0.0 # Author: Solomon Laing # Description: -# Installs the AUR helper yay on the -# system. +# Installs all of my default programs #----------------------------------- clear @@ -18,34 +17,22 @@ dependencies=$(sed -n '/DEFAULTS_START/,/DEFAULTS_END/p' $default_programs | sed echo "This script is going to install all of my default programs, e.g.: browser, rss reader, etc. As such it will ask for root privilages." echo "Defaults:$dependencies" -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - # if yay is not installed the run the install script -if ! command -v yay &> /dev/null; then - ./install-yay +if ! command -v yay &>/dev/null; then + ./yay fi failures=() # run though each dependency and install it if it's not already installed -for dependency in $dependencies -do +for dependency in $dependencies; do sudo -v - clear - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then echo "Installing $dependency and it's dependencies..." yay -S --noconfirm $dependency fi - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then failures+=("$dependency\n") fi done @@ -55,7 +42,6 @@ total_failures=$((${#failures[@]})) if [ $total_failures -gt 0 ]; then echo "$total_failures of the programs failed to install..." echo -e "${failures[@]}" - echo "Please manually rectify this and then rerun this setup with: ./setup defaults" exit 1 else echo "Default programs sucessfully installed" diff --git a/arch/install-dependencies b/arch/runs/dependencies similarity index 71% rename from arch/install-dependencies rename to arch/runs/dependencies index 78e3856..85acd54 100755 --- a/arch/install-dependencies +++ b/arch/runs/dependencies @@ -1,12 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-yay +# Name: dependencies # Version: 1.0.0 # Author: Solomon Laing # Description: -# Installs the AUR helper yay on the -# system. +# Intsalls all of my system dependencies #----------------------------------- clear @@ -17,7 +16,7 @@ laptop_dependencies=$(sed -n '/DEPENDENCIES_LAPTOP_START/,/DEPENDENCIES_LAPTOP_E laptop=0 # check user is happy to run this script -echo "This script is going to install all of the programs required for my scripts and dotfiles to function in a bisic manner. As such it will ask for root privilages." +echo "This script is going to install all of the programs required for my scripts and dotfiles to function in a basic manner. As such it will ask for root privilages." echo "Dependencies:$dependencies" echo "" @@ -37,44 +36,32 @@ case $laptop_input in ;; esac -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - # if yay is not installed the run the install script -if ! command -v yay &> /dev/null; then - ./install-yay +if ! command -v yay &>/dev/null; then + ./yay fi failures=() # run though each dependency and install it if it's not already installed -for dependency in $dependencies -do +for dependency in $dependencies; do sudo -v - clear - if ! yay -Qi $dependency &> /dev/null; then #TODO: check whether this works as I'm expecting... + if ! yay -Qi $dependency &>/dev/null; then #TODO: check whether this works as I'm expecting... echo "Installing $dependency and it's dependencies..." yay -S --noconfirm $dependency fi - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then # there are likely some dependencies that won't have an associated command # TODO: find a better way to deal with this, eg have something like xorg COMMAND xprop in default programs # just catch everything, ik there are better ways to do this case $dependency in - xorg) - echo "xorg is has no command." + xorg) + echo "xorg is has no command." ;; - *) - failures+=("$dependency") + *) + failures+=("$dependency") ;; esac fi @@ -82,16 +69,14 @@ done if [ $laptop -eq 1 ]; then # run though each laptop dependency and install it if it's not already installed - for dependency in $laptop_dependencies - do - clear + for dependency in $laptop_dependencies; do sudo -v - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then echo "Installing $dependency and it's dependencies..." yay -S --noconfirm $dependency fi - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then failures+=("$dependency\n") fi done @@ -102,7 +87,6 @@ total_failures=$((${#failures[@]})) if [ $total_failures -gt 0 ]; then echo "$total_failures of the programs failed to install..." echo -e "${failures[@]}" - echo "Please manually rectify this and then rerun this setup with: ./setup deps" exit 1 else echo "Dependencies sucessfully installed" diff --git a/arch/runs/dmenu b/arch/runs/dmenu new file mode 100755 index 0000000..385e5d4 --- /dev/null +++ b/arch/runs/dmenu @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +#----------------------------------- +# Name: dmenu +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of dmenu +#----------------------------------- + +clear + +if command -v dmenu &>/dev/null; then + echo "dmenu is already installed on the system." + exit 0 +fi + +echo "This script is going to install my fork of dmenu with my custom styling. As such it will ask for root privilages." + +git clone https://gitlab.inkletblot.com/inkletblot/dmenu-inkletblot "$HOME/repos/gitlab.inkletblot.com/inkletblot/dmenu-inkletblot" +cd "$HOME/repos/gitlab.inkletblot.com/inkletblot/dmenu-inkletblot" || exit 1 +git checkout config +sudo -S make clean install + +if ! command -v dmenu &>/dev/null; then + echo "dmenu failed to install" + exit 1 +fi + +exit 0 diff --git a/arch/runs/dwm b/arch/runs/dwm new file mode 100755 index 0000000..56b01ce --- /dev/null +++ b/arch/runs/dwm @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +#----------------------------------- +# Name: dwm +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of dwm +#----------------------------------- + +clear + +if command -v dwm &>/dev/null; then + echo "dwm is already installed on the system." + exit 0 +fi + +echo "This script is going to install my fork of dwm with my custom styling. As such it will ask for root privilages." + +git clone https://gitlab.inkletblot.com/inkletblot/dwm-inkletblot "$HOME/repos/gitlab.inkletblot.com/inkletblot/dwm-inkletblot" +cd "$HOME/repos/gitlab.inkletblot.com/inkletblot/dwm-inkletblot" || exit 1 +git checkout config +sudo -S make clean install + +if ! command -v dwm &>/dev/null; then + echo "dwm failed to install" + exit 1 +fi + +exit 0 diff --git a/arch/runs/dwmblocks b/arch/runs/dwmblocks new file mode 100755 index 0000000..38dff93 --- /dev/null +++ b/arch/runs/dwmblocks @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +#----------------------------------- +# Name: dwmblocks +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of dwmblocks +#----------------------------------- + +clear + +if command -v dwmblocks &>/dev/null; then + echo "dwmblocks is already installed on the system." + exit 0 +fi + +echo "This script is going to install my fork of dmenu with my custom styling. As such it will ask for root privilages." + +git clone https://gitlab.inkletblot.com/inkletblot/dwmblocks-inkletblot "$HOME/repos/gitlab.inkletblot.com/inkletblot/dwmblocks-inkletblot" +cd "$HOME/repos/gitlab.inkletblot.com/inkletblot/dwmblocks-inkletblot" || exit 1 +sudo -S make clean install + +if ! command -v dwmblocks &>/dev/null; then + echo "dwmblocks failed to install." + exit 1 +fi + +exit 0 diff --git a/arch/install-fonts b/arch/runs/fonts similarity index 55% rename from arch/install-fonts rename to arch/runs/fonts index c5365d4..5e90e8c 100755 --- a/arch/install-fonts +++ b/arch/runs/fonts @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-fonts +# Name: fonts # Version: 1.0.0 # Author: Solomon Laing # Description: @@ -11,27 +11,15 @@ clear -if command -v getnf &> /dev/null; then +if command -v getnf &>/dev/null; then echo "getnf is already installed on the system." exit 0 fi echo "This script is going to attempt install getnf. As such it will ask for root privilages." -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -cd /tmp -sudo -S git clone https://github.com/ronniedroid/getnf -sudo -S chown -R $USER:users ./getnf -cd getnf +git clone https://github.com/ronniedroid/getnf "$HOME/repos/github.com/ronniedroid/getnf" +cd "$HOME/repos/github.com/ronniedroid/getnf" || exit 1 sudo ./install.sh @@ -40,9 +28,7 @@ case $input in [nN][oO] | [nN]) exit 0 ;; -*) - echo "The program will continue..." - ;; +*) ;; esac getnf diff --git a/arch/install-misc b/arch/runs/misc similarity index 69% rename from arch/install-misc rename to arch/runs/misc index 99abccb..5262b08 100755 --- a/arch/install-misc +++ b/arch/runs/misc @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-misc +# Name: misc # Version: 1.0.0 # Author: Solomon Laing # Description: @@ -18,34 +18,23 @@ dependencies=$(sed -n '/MISC_START/,/MISC_END/p' $default_programs | sed -e 's/M echo "This script is going to install all of my misc programs that I frequently use." echo "Misc programs:$dependencies" -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - # if yay is not installed the run the install script -if ! command -v yay &> /dev/null; then - ./install-yay +if ! command -v yay &>/dev/null; then + ./yay fi failures=() # run though each dependency and install it if it's not already installed -for dependency in $dependencies -do +for dependency in $dependencies; do sudo -v clear - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then echo "Installing $dependency and it's dependencies..." yay -S --noconfirm $dependency fi - if ! yay -Qi $dependency &> /dev/null; then + if ! yay -Qi $dependency &>/dev/null; then failures+=("$dependency\n") fi done @@ -55,7 +44,6 @@ total_failures=$((${#failures[@]})) if [ $total_failures -gt 0 ]; then echo "$total_failures of the programs failed to install..." echo -e "${failures[@]}" - echo "Please manually rectify this and then rerun this setup with: ./setup misc" exit 1 else echo "Misc programs sucessfully installed" diff --git a/arch/runs/neovim b/arch/runs/neovim new file mode 100755 index 0000000..5d51afe --- /dev/null +++ b/arch/runs/neovim @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +#----------------------------------- +# Name: neovim +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs neovim on the system. +#----------------------------------- + +clear + +if command -v neovim &>/dev/null; then + echo "neovim is already installed on the system." + exit 0 +fi + +echo "This script is going to attempt install neovim. As such it will ask for root privilages." + +git clone --depth 1 https://github.com/neovim/neovim "$HOME/repos/github.com/neovim/neovim" +sudo pacman -S base-devel cmake ninja curl || exit 1 + +cd "$HOME/repos/github.com/neovim/neovim" || exit 1 +make CMAKE_BUILD_TYPE=Release || exit 1 +sudo make install || exit 1 +exit 0 diff --git a/arch/runs/st b/arch/runs/st new file mode 100755 index 0000000..ce66584 --- /dev/null +++ b/arch/runs/st @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +#----------------------------------- +# Name: st +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of st +#----------------------------------- + +clear + +if command -v st &>/dev/null; then + echo "st is already installed on the system." + exit 0 +fi + +echo "This script is going to install my fork of st with my custom styling. As such it will ask for root privilages." + +git clone https://gitlab.inkletblot.com/inkletblot/st-inkletblot "$HOME/repos/gitlab.inkletblot.com/inkletblot/st-inkletblot" +cd "$HOME/repos/gitlab.inkletblot.com/inkletblot/st-inkletblot" || exit 1 +git checkout config +sudo -S make clean install + +if ! command -v st &>/dev/null; then + echo "st failed to install." + exit 1 +fi + +exit 0 diff --git a/arch/install-yay b/arch/runs/yay similarity index 63% rename from arch/install-yay rename to arch/runs/yay index da6e5e4..52aa15f 100755 --- a/arch/install-yay +++ b/arch/runs/yay @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env bash #----------------------------------- -# Name: install-yay +# Name: yay # Version: 1.0.0 # Author: Solomon Laing # Description: @@ -11,31 +11,21 @@ clear -if command -v yay &> /dev/null; then +if command -v yay &>/dev/null; then echo "yay is already installed on the system." exit 0 fi echo "This script is going to attempt install yay and it's dependencies. As such it will ask for root privilages." -read -r -p "Are you sure you want to continue? [Y/n] " input -case $input in -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "The program will continue..." - ;; -esac - -if ! command -v fakeroot &> /dev/null; then +if ! command -v fakeroot &>/dev/null; then sudo pacman -S --noconfirm base-devel fi -cd /opt +cd /opt || exit 1 sudo -S git clone https://aur.archlinux.org/yay.git sudo -S chown -R $USER:users ./yay -cd yay +cd yay || exit 1 makepkg -si exit 0