From ad609ce24b9e843c36198980aafe941ce76b06e0 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Sat, 28 Aug 2021 21:17:59 +0930 Subject: [PATCH] first working version, I think --- README.md | 6 ++--- default-programs | 5 ++++- install-config | 8 +------ install-dependencies | 35 +++++++++++++++++++++++++++++ install-misc | 2 +- install-yay | 6 ++--- setup | 53 ++++++++++++++++++++++++++++++++------------ 7 files changed, 85 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index e375965..2718e0a 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,11 @@ This project is an effort to create a easy to use system to install a fresh vers I want this to be able to be used on a fresh arch install with 0 dependencies, so, I will need to make sure that the user has set up internet, or that an existing connection exists. -I also need to make sure that all required programs are then sucessfully installed, and that some configs are written. +I also need to make sure that all required programs are then successfully installed, and that some configs are written. > 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 @@ -50,4 +48,4 @@ setup.sh will then... 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 + 1. warn user that if they didn't install default programs, they'll need to edit xmonad.hs diff --git a/default-programs b/default-programs index 85bedbd..cc3543c 100644 --- a/default-programs +++ b/default-programs @@ -22,7 +22,7 @@ pulseaudio nfs-utils network-manager-applet wget -volumeicon +volctl unzip ttf-fira-code trayer @@ -45,6 +45,7 @@ xdotool xterm flameshot simple-mtpfs +micro DEPENDENCIES_END DEPENDENCIES_LAPTOP_START @@ -67,6 +68,8 @@ visual-studio-code-bin DEFAULTS_END MISC_START +lyx +kile plexamp-appimage mpv kdeconnect diff --git a/install-config b/install-config index 1ca0246..b52f58f 100755 --- a/install-config +++ b/install-config @@ -25,11 +25,5 @@ case $input in ;; 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 +sudo -S make clean install \ No newline at end of file diff --git a/install-dependencies b/install-dependencies index c48b888..f7d72e5 100755 --- a/install-dependencies +++ b/install-dependencies @@ -2,10 +2,30 @@ default_programs="./default-programs" dependencies=$(sed -n '/DEPENDENCIES_START/,/DEPENDENCIES_END/p' $default_programs | sed -e 's/DEPENDENCIES_START//' -e 's/DEPENDENCIES_END//') +laptop_dependencies=$(sed -n '/DEPENDENCIES_LAPTOP_START/,/DEPENDENCIES_LAPTOP_END/p' $default_programs | sed -e 's/DEPENDENCIES_LAPTOP_START//' -e 's/DEPENDENCIES_LAPTOP_END//') +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 "Dependencies:$dependencies" + +echo "" + +echo "If you are installing this on a laptop there are a couple of laptop specific dependencies that need to be installed as well..." +read -r -p "Would you like to install these? [y/N] " laptop_input +case $laptop_input in +[yY][eE][sS] | [yY]) + echo "The extra dependencies will be installed..." + laptop=1 + ;; +[nN][oO] | [nN]) + echo "Not installing extra dependencies..." + ;; +*) + echo "Invalid input... Not installing extra dependencies..." + ;; +esac + read -r -p "Are you sure you want to continue? [y/N] " input case $input in [yY][eE][sS] | [yY]) @@ -40,6 +60,21 @@ do fi 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 + 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 +fi + total_failures=$((${#failures[@]})) if [ $total_failures -gt 0 ]; then diff --git a/install-misc b/install-misc index 529eeb0..c0a1c68 100755 --- a/install-misc +++ b/install-misc @@ -4,7 +4,7 @@ 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 "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 diff --git a/install-yay b/install-yay index 555aac4..6396a81 100755 --- a/install-yay +++ b/install-yay @@ -32,11 +32,11 @@ case $input in esac if ! command -v fakeroot &> /dev/null; then - cat $default_loc | sudo -S pacman -Sy --noconfirm base-devel + sudo -S pacman -Sy --noconfirm base-devel fi cd /opt -cat $default_loc | sudo -S git clone https://aur.archlinux.org/yay.git -cat $default_loc | sudo -S chown -R $USER:users ./yay +sudo -S git clone https://aur.archlinux.org/yay.git +sudo -S chown -R $USER:users ./yay cd yay makepkg -si \ No newline at end of file diff --git a/setup b/setup index fcdd91e..944c3a1 100644 --- a/setup +++ b/setup @@ -56,7 +56,7 @@ function update_system { function install_dependencies { if [ $? -eq 1 ]; then exit 1 - fi + fi cd $working_dir ./install-dependencies } @@ -65,7 +65,7 @@ function install_dependencies { function install_defaults { if [ $? -eq 1 ]; then exit 1 - fi + fi cd $working_dir ./install-defaults } @@ -74,7 +74,7 @@ function install_defaults { function install_misc { if [ $? -eq 1 ]; then exit 1 - fi + fi cd $working_dir ./istall-misc } @@ -83,18 +83,24 @@ function install_misc { function install_scripts { if [ $? -eq 1 ]; then exit 1 - fi + fi cd $working_dir - git submodule init - git submodule update ./install-scripts } +function install_dmenu { + if [ $? -eq 1 ]; then + exit 1 + fi + cd $working_dir + ./install-dmenu-inkletblot +} + # install my config function install_config { if [ $? -eq 1 ]; then exit 1 - fi + fi cd $working_dir ./install-config } @@ -110,6 +116,7 @@ echo " deps : Install the dependencies for my scripts and window manager" echo " defaults : Install my chosen default programs" echo " misc : Install my collection of misc - nice to have - programs" echo " scripts : Install my scirpts" +echo " dmenu : Install my customisation of dmenu" echo " config : Install my dotfiles to the system" echo "" echo "Note: it is expected that the initial run of this script lets each stage complete sucessfully." @@ -120,7 +127,7 @@ case $1 in yay) if [ "$2" = "only" ]; then install_yay - else + else install_yay install_dmenu update_system @@ -128,19 +135,21 @@ case $1 in install_defaults install_misc install_scripts + install_dmenu install_config fi ;; dmenu) if [ "$2" = "only" ]; then install_dmenu - else + else install_dmenu update_system install_dependencies install_defaults install_misc install_scripts + install_dmenu install_config fi ;; @@ -148,11 +157,12 @@ case $1 in update_system if [ "$2" = "only" ]; then install_dependencies - else + else install_dependencies install_defaults install_misc install_scripts + install_dmenu install_config fi ;; @@ -160,10 +170,11 @@ case $1 in update_system if [ "$2" = "only" ]; then install_defaults - else + else install_defaults install_misc install_scripts + install_dmenu install_config fi ;; @@ -171,24 +182,34 @@ case $1 in update_system if [ "$2" = "only" ]; then install_misc - else + else install_misc install_scripts + install_dmenu install_config fi ;; scripts) if [ "$2" = "only" ]; then install_scripts - else + else install_scripts + install_dmenu + install_config + fi + ;; + dmenu) + if [ "$2" = "only" ]; then + install_dmenu + else + install_dmenu install_config fi ;; config) if [ "$2" = "only" ]; then install_config - else + else install_config fi ;; @@ -199,4 +220,8 @@ case $1 in ;; esac +if [ $? -eq 1 ]; then + exit 1 +fi + exit 0