From 5ceab93dd59d8907ae7cee9842e5bf12551a0e63 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Wed, 25 Aug 2021 17:44:33 +0930 Subject: [PATCH] working my way through initial run through of scirpts, this is a wip --- .gitmodules | 6 ++ README.md | 24 +++-- default-programs | 116 +++++++++++----------- dmenu-inkletblot | 1 + get-sudo-password | 24 +++++ inks-scripts | 1 + install-config | 35 +++++++ install-defaults | 54 +++++++++++ install-dependencies | 79 +++++---------- install-dmenu-inkletblot | 41 ++++++++ install-misc | 54 +++++++++++ install-scripts | 87 +++++++++++++++++ install-yay | 29 +++--- setup | 202 +++++++++++++++++++++++++++++++++++++++ system-check | 51 ++++++++++ 15 files changed, 669 insertions(+), 135 deletions(-) create mode 100644 .gitmodules create mode 160000 dmenu-inkletblot create mode 100755 get-sudo-password create mode 160000 inks-scripts create mode 100755 install-config create mode 100755 install-defaults create mode 100755 install-dmenu-inkletblot create mode 100755 install-misc create mode 100755 install-scripts create mode 100644 setup create mode 100755 system-check diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0fedc79 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "inks-scripts"] + path = inks-scripts + url = ssh://git@gitlab.inkletblot.com:10622/inkletblot/inks-scripts.git +[submodule "dmenu-inkletblot"] + path = dmenu-inkletblot + url = ssh://git@gitlab.inkletblot.com:10622/inkletblot/dmenu-inkletblot.git diff --git a/README.md b/README.md index a24b2c9..e375965 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,12 @@ I want this to be able to be used on a fresh arch install with 0 dependencies, s I also need to make sure that all required programs are then sucessfully installed, and that some configs are written. - Ill need to do this for lightdm and lightdm webkit3 greeter currently. +> Ill need to do this for lightdm and lightdm webkit3 greeter currently. +> will also need to set shell, if they install my default programs, to fish. +remove rofi from xmonad.hs + +review xmonad.sh for default programs / dependencies # Steps @@ -35,9 +39,15 @@ setup.sh will then... 1. make sure that there is an internet connection (user may have installed git in chroot and not setup network yet) 2. make sure sudo is installed and user is part of sudo or wheel group 3. request user for their password, put it in temp file (I can't think of a better way of doing this yet) - 4. make sure multilib in enabled - 5. update and upgrade system fully -2. install yay specifically -2. install all required dependencies/programs -3. install my scripts -4. install my config +2. update and upgrade system fully +3. install yay specifically +4. install my dmenu +5. install all required dependencies/programs + 1. install system dependencies and all required dependencies for my xmonad config and my scripts (NOT INCLUDING: myStartupHook, myManagedHook or bitwarden) + 2. ask user if they want to install my default programs (browser, shell, term, etc) + 1. warn user that they will need to install their own if they don't + 3. ask user if they want to install my misc programs (all the rest of my defaults that I like having) +6. install my scripts + 1. copy inks-scrips to /usr/local/bin as it should be in path by default +7. install my config + 1. warn user that if they didn't intstall default programs, they'll need to edit xmonad.hs diff --git a/default-programs b/default-programs index bd3a4fc..85bedbd 100644 --- a/default-programs +++ b/default-programs @@ -1,104 +1,100 @@ -REQUIRED_START +DEPENDENCIES_START yad scrot pulseaudio-bluetooth bluez-utils sshfs - - - - - -REQUIRED_END - - -freetube -git-flow-completion-git -plexamp-appimage - - -shotwell -fish -evince -dunst-git +dunst slock -notify-send -bitwarden-cli jq xmonad xmonad-contrib -firefox -surf xmobar +xorg +xorg-xinit +blueman picom-jonaburg-git nitrogen xclip numlockx -zenity pavucontrol pulseaudio nfs-utils -newsboat -blueman -networkmanager network-manager-applet -guake -xorg -xorg-xinit -mpv -youtube-dl -backlight-control -rofi -thunar -alacritty wget volumeicon unzip ttf-fira-code trayer +youtube-dl +openssh +numlockx +htop +gnome-keyring +dosfstools +grub2 +curl +cifs-utils +bluez +lxappearance +qt5ct +lightdm +lightdm-webkit-theme-litarvan +lxsession +xdotool +xterm +flameshot +simple-mtpfs +DEPENDENCIES_END + +DEPENDENCIES_LAPTOP_START +backlight_control +DEPENDENCIES_LAPTOP_END + +DEFAULTS_START +evince +firefox +fish +alacritty +thunar +newsboat +cmus +freetube +vlc +discord +qbittorrent +visual-studio-code-bin +DEFAULTS_END + +MISC_START +plexamp-appimage +mpv +kdeconnect +surf +git-flow-completion-git +shotwell +bitwarden-cli +zenity +guake python nodejs npm nvm -openssh -numlockx mosh jre-openjdk jre-openjdk-headless -htop -gnome-keyring git-flow -evince -dosfstools -grub2 -curl colorpicker-ym1234-git -cmus -cifs-utils -bluez ansible android-sdk-platform-tools -lxappearance -qt5ct -visual-studio-code-bin runelite slack-desktop nextcloud-client barrier todoist-elecrton -vlc virtualbox virt-manager virsh -discord -kdeconnect telegram-desktop teams -qbittorrent -lxsession -xdotool -xterm -backlight-control -lightdm -lightdm-webkit-theme-litarvan -flameshot +MISC_END \ No newline at end of file diff --git a/dmenu-inkletblot b/dmenu-inkletblot new file mode 160000 index 0000000..897e3e4 --- /dev/null +++ b/dmenu-inkletblot @@ -0,0 +1 @@ +Subproject commit 897e3e487f4f5b18315edae5f34c12fdd425cc6b diff --git a/get-sudo-password b/get-sudo-password new file mode 100755 index 0000000..1bce4c8 --- /dev/null +++ b/get-sudo-password @@ -0,0 +1,24 @@ +#!/bin/bash + +file=/tmp/sudo-password + +while true; +do + + read -r -s -p "Your password please: " password + + res=$(echo "$password" | sudo -S -k -l) + + echo $res + + if [ "$res" == "" ]; then + echo "Incorrect password, try again..." + else + break; + fi + +done + +rm $file --force # to ignore if it isn't there +touch $file +echo "$password" > $file \ No newline at end of file diff --git a/inks-scripts b/inks-scripts new file mode 160000 index 0000000..51e2cdc --- /dev/null +++ b/inks-scripts @@ -0,0 +1 @@ +Subproject commit 51e2cdc5dbb51256cfb400e68542f96c874583a3 diff --git a/install-config b/install-config new file mode 100755 index 0000000..1ca0246 --- /dev/null +++ b/install-config @@ -0,0 +1,35 @@ +#!/bin/sh + +#----------------------------------- +# Name: install-dmenu-inkletblot +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of dmenu +#----------------------------------- + +echo "This script is going to install dmenu-inkletblot, my fork of dmenu with my custom styling. As such it will ask for root privilages." + +read -r -p "Are You Sure? [y/N] " input + +case $input in +[yY][eE][sS] | [yY]) + echo "The program will continue..." + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +default_loc=/tmp/sudo-password + +if [ ! -f "$default_loc" ] ; then + get-sudo-password +fi + +cd dmenu-inkletblot +cat $default_loc | sudo -S make clean install \ No newline at end of file diff --git a/install-defaults b/install-defaults new file mode 100755 index 0000000..0ef6c2a --- /dev/null +++ b/install-defaults @@ -0,0 +1,54 @@ +#!/bin/sh + +default_programs="./default-programs" +dependencies=$(sed -n '/DEFAULTS_START/,/DEFAULTS_END/p' $default_programs | sed -e 's/DEFAULTS_START//' -e 's/DEFAULTS_END//') + +# check user is happy to run this script +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 +[yY][eE][sS] | [yY]) + echo "The program will continue..." + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +# if yay is not installed the run the install script +if ! command -v yay &> /dev/null; then + ./install-yay +fi + +failures=() + +# run though each dependency and install it if it's not already installed +for dependency in $dependencies +do + if ! yay -Qi $dependency &> /dev/null; then + echo "Installing $dependency and it's dependencies..." + yay -S --noconfirm $dependency &> /dev/null + fi + + if ! yay -Qi $dependency &> /dev/null; then + failures+=("$dependency\n") + fi +done + +total_failures=$((${#failures[@]})) + +if [ $total_failures -gt 0 ]; then + echo "Some of the programs failed to install..." + echo "$failures" + echo "Please manually rectify this and then rerun this setup with: ./setup defaults" + exit 1 +else + echo "Default programs sucessfully installed" +fi + +exit 0 \ No newline at end of file diff --git a/install-dependencies b/install-dependencies index b5626d1..c48b888 100755 --- a/install-dependencies +++ b/install-dependencies @@ -1,7 +1,11 @@ #!/bin/sh +default_programs="./default-programs" +dependencies=$(sed -n '/DEPENDENCIES_START/,/DEPENDENCIES_END/p' $default_programs | sed -e 's/DEPENDENCIES_START//' -e 's/DEPENDENCIES_END//') + # check user is happy to run this script -echo "This script is going to install all of the programs listed in /home//default-programs and their dependencies. 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 bisic manner. As such it will ask for root privilages." +echo "Dependencies:$dependencies" read -r -p "Are you sure you want to continue? [y/N] " input case $input in [yY][eE][sS] | [yY]) @@ -21,67 +25,30 @@ if ! command -v yay &> /dev/null; then ./install-yay fi -# check with the user they are happy to update, exit if not though. -echo "The system needs to be updated before this installation can happen. The upgrades will be applied without any user oversight which may be dangerous for out of date systems." -read -r -p "Are you sure you want to continue? [y/N] " input -case $input in -[yY][eE][sS] | [yY]) - # Make sure everything is up to date - echo "Making sure everything is up to date..." - yay -Syyu --noconfirm - ;; -[nN][oO] | [nN]) - exit 0 - ;; -*) - echo "Invalid input..." - exit 1 - ;; -esac +failures=() -# run though each default program and install it if it's not already installed -# note that yay, git, steam, dmenu-inkletblot, ly and nvidia related programs are not included -default_programs="/default-programs" -dependencies=$(cat $HOME/$default_programs) +# run though each dependency and install it if it's not already installed for dependency in $dependencies do - if ! command -v $dependency &> /dev/null; then + if ! yay -Qi $dependency &> /dev/null; then echo "Installing $dependency and it's dependencies..." - yay -S --noconfirm $dependency + yay -S --noconfirm $dependency &> /dev/null + fi + + if ! yay -Qi $dependency &> /dev/null; then + failures+=("$dependency\n") fi done -# ask the user if they want to install nvidia dependencies, do it or skip -if ! command -v yay &> /dev/null && ! command -v yay &> /dev/null && ! command -v yay &> /dev/null; then - echo "My computer requires nvidia, as such I install the required drivers and programs" - read -r -p "Are you sure you want to install? [y/N] " input - case $input in - [yY][eE][sS] | [yY]) - echo "Nvidia is being installed..." - yay -S nvidia nvidia-settings nvidia-prime --noconfirm - ;; - [nN][oO] | [nN]) - echo "Nvidia installation has been skipped. Programs: nvidia, nvidia-settings, nvidia-prime" - ;; - *) - echo "Nvidia installation has been skipped. Programs: nvidia, nvidia-settings, nvidia-prime" - ;; - esac +total_failures=$((${#failures[@]})) + +if [ $total_failures -gt 0 ]; then + echo "Some of the programs failed to install..." + echo "$failures" + echo "Please manually rectify this and then rerun this setup with: ./setup deps" + exit 1 +else + echo "Dependencies sucessfully installed" fi -# notify about steam issue (multilib) -echo "There are a few programs that can't be automatically installed. The main one of these is Steam which requires multilib to be enabled. Instructions for this can be found at: https://wiki.archlinux.org/index.php/Official_repositories#Enabling_multilib Once this is done steam can be installed." -read -r -p "Press [ENTER] to continue.." - -# notify about ly and dmenu-inkletblot scripts -echo "I use two programs that are installed from git directly: ly and dmenu-inkletblot." -echo "I do not have install scripts for both of these. They have dependencies I can't guarantee are installed." -read -r -p "Press [ENTER] to continue.." - -# notify user that there may be extra steps to finish install -echo "This script has installed all of my default programs however it may not have configure many things. My dotfiles may cover some of these but things such as gnome-keyring (using the pam method) will need to be implemented. As well as setting up nvidia and xorg. There are likely more that I have forgotton as well." -read -r -p "Press [ENTER] to complete.." - -# need scripts for these -# dmenu-inkletblot -# ly +exit 0 \ No newline at end of file diff --git a/install-dmenu-inkletblot b/install-dmenu-inkletblot new file mode 100755 index 0000000..1c061b1 --- /dev/null +++ b/install-dmenu-inkletblot @@ -0,0 +1,41 @@ +#!/bin/sh + +#----------------------------------- +# Name: install-dmenu-inkletblot +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs my customisation of dmenu +#----------------------------------- + +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-inkletblot, my fork of dmenu with my custom styling. As such it will ask for root privilages." + +read -r -p "Are You Sure? [y/N] " input + +case $input in +[yY][eE][sS] | [yY]) + echo "The program will continue..." + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +cd dmenu-inkletblot +sudo -S make clean install + +if ! command -v dmenu &> /dev/null; then + echo "dmenu-inkletblot failed to install, please manually rectify this and then rerun this setup with: ./setup deps" + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/install-misc b/install-misc new file mode 100755 index 0000000..529eeb0 --- /dev/null +++ b/install-misc @@ -0,0 +1,54 @@ +#!/bin/sh + +default_programs="./default-programs" +dependencies=$(sed -n '/MISC_START/,/MISC_END/p' $default_programs | sed -e 's/MISC_START//' -e 's/MISC_END//') + +# check user is happy to run this script +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 "Misc programs:$dependencies" +read -r -p "Are you sure you want to continue? [y/N] " input +case $input in +[yY][eE][sS] | [yY]) + echo "The program will continue..." + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +# if yay is not installed the run the install script +if ! command -v yay &> /dev/null; then + ./install-yay +fi + +failures=() + +# run though each dependency and install it if it's not already installed +for dependency in $dependencies +do + if ! yay -Qi $dependency &> /dev/null; then + echo "Installing $dependency and it's dependencies..." + yay -S --noconfirm $dependency &> /dev/null + fi + + if ! yay -Qi $dependency &> /dev/null; then + failures+=("$dependency\n") + fi +done + +total_failures=$((${#failures[@]})) + +if [ $total_failures -gt 0 ]; then + echo "Some of the programs failed to install..." + echo "$failures" + echo "Please manually rectify this and then rerun this setup with: ./setup misc" + exit 1 +else + echo "Misc programs sucessfully installed" +fi + +exit 0 \ No newline at end of file diff --git a/install-scripts b/install-scripts new file mode 100755 index 0000000..b5626d1 --- /dev/null +++ b/install-scripts @@ -0,0 +1,87 @@ +#!/bin/sh + +# check user is happy to run this script +echo "This script is going to install all of the programs listed in /home//default-programs and their 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 +[yY][eE][sS] | [yY]) + echo "The program will continue..." + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +# if yay is not installed the run the install script +if ! command -v yay &> /dev/null; then + ./install-yay +fi + +# check with the user they are happy to update, exit if not though. +echo "The system needs to be updated before this installation can happen. The upgrades will be applied without any user oversight which may be dangerous for out of date systems." +read -r -p "Are you sure you want to continue? [y/N] " input +case $input in +[yY][eE][sS] | [yY]) + # Make sure everything is up to date + echo "Making sure everything is up to date..." + yay -Syyu --noconfirm + ;; +[nN][oO] | [nN]) + exit 0 + ;; +*) + echo "Invalid input..." + exit 1 + ;; +esac + +# run though each default program and install it if it's not already installed +# note that yay, git, steam, dmenu-inkletblot, ly and nvidia related programs are not included +default_programs="/default-programs" +dependencies=$(cat $HOME/$default_programs) +for dependency in $dependencies +do + if ! command -v $dependency &> /dev/null; then + echo "Installing $dependency and it's dependencies..." + yay -S --noconfirm $dependency + fi +done + +# ask the user if they want to install nvidia dependencies, do it or skip +if ! command -v yay &> /dev/null && ! command -v yay &> /dev/null && ! command -v yay &> /dev/null; then + echo "My computer requires nvidia, as such I install the required drivers and programs" + read -r -p "Are you sure you want to install? [y/N] " input + case $input in + [yY][eE][sS] | [yY]) + echo "Nvidia is being installed..." + yay -S nvidia nvidia-settings nvidia-prime --noconfirm + ;; + [nN][oO] | [nN]) + echo "Nvidia installation has been skipped. Programs: nvidia, nvidia-settings, nvidia-prime" + ;; + *) + echo "Nvidia installation has been skipped. Programs: nvidia, nvidia-settings, nvidia-prime" + ;; + esac +fi + +# notify about steam issue (multilib) +echo "There are a few programs that can't be automatically installed. The main one of these is Steam which requires multilib to be enabled. Instructions for this can be found at: https://wiki.archlinux.org/index.php/Official_repositories#Enabling_multilib Once this is done steam can be installed." +read -r -p "Press [ENTER] to continue.." + +# notify about ly and dmenu-inkletblot scripts +echo "I use two programs that are installed from git directly: ly and dmenu-inkletblot." +echo "I do not have install scripts for both of these. They have dependencies I can't guarantee are installed." +read -r -p "Press [ENTER] to continue.." + +# notify user that there may be extra steps to finish install +echo "This script has installed all of my default programs however it may not have configure many things. My dotfiles may cover some of these but things such as gnome-keyring (using the pam method) will need to be implemented. As well as setting up nvidia and xorg. There are likely more that I have forgotton as well." +read -r -p "Press [ENTER] to complete.." + +# need scripts for these +# dmenu-inkletblot +# ly diff --git a/install-yay b/install-yay index cc04dd6..555aac4 100755 --- a/install-yay +++ b/install-yay @@ -1,11 +1,20 @@ #!/bin/sh -# if command -v yay &> /dev/null; then -# echo "yay is already installed." -# exit 0; -# fi +#----------------------------------- +# Name: install-yay +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Installs the AUR helper yay on the +# system. +#----------------------------------- -echo "This script is going to install yay and it's dependencies. As such it will ask for root privilages." +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? [y/N] " input @@ -22,16 +31,12 @@ case $input in ;; esac -if ! command -v git &> /dev/null; then - sudo pacman -Sy --noconfirm git -fi - if ! command -v fakeroot &> /dev/null; then - sudo pacman -Sy --noconfirm base-devel + cat $default_loc | sudo -S pacman -Sy --noconfirm base-devel fi cd /opt -sudo git clone https://aur.archlinux.org/yay.git -sudo chown -R $USER:users ./yay +cat $default_loc | sudo -S git clone https://aur.archlinux.org/yay.git +cat $default_loc | sudo -S chown -R $USER:users ./yay cd yay makepkg -si \ No newline at end of file diff --git a/setup b/setup new file mode 100644 index 0000000..fcdd91e --- /dev/null +++ b/setup @@ -0,0 +1,202 @@ +#!/bin/bash + +#----------------------------------- +# Name: setup +# Version: 1.0.0 +# Author: Solomon Laing +# Description: +# Sets up system with my configs, +# programs, and more. +# Usage: +# setup yay -- runs the system setup from installing yay onwards +# setup yay only -- only runs the yay section of the sysetm setup +#----------------------------------- + +working_dir=$(pwd) + +# perform basic system check +./system-check + +# install yay +function install_yay { + cd $working_dir + ./install-yay +} + +# install my dmenu +function install_dmenu { + cd $working_dir + git submodule init + git submodule update + ./install-dmenu-inkletblot +} + +# update the system +function update_system { + # check with the user they are happy to update, exit if not though. + echo "The system needs to be updated before this installation can happen. The upgrades will be applied without any user oversight which may be dangerous for out of date systems." + read -r -p "Are you sure you want to continue? [y/N] " input + case $input in + [yY][eE][sS] | [yY]) + # Make sure everything is up to date + echo "Making sure everything is up to date..." + yay -Syyu --noconfirm + ;; + [nN][oO] | [nN]) + exit 0 + ;; + *) + echo "Invalid input..." + exit 1 + ;; + esac +} + +# install all required dependencies/programs +function install_dependencies { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + ./install-dependencies +} + +# install all default programs +function install_defaults { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + ./install-defaults +} + +# install all misc programs +function install_misc { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + ./istall-misc +} + +# install my scripts +function install_scripts { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + git submodule init + git submodule update + ./install-scripts +} + +# install my config +function install_config { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + ./install-config +} + +function help{ +echo "Usage is:" +echo " setup