working my way through initial run through of scirpts, this is a wip

This commit is contained in:
Solomon Laing 2021-08-25 17:44:33 +09:30
parent 0ea46c6a00
commit 5ceab93dd5
15 changed files with 669 additions and 135 deletions

6
.gitmodules vendored Normal file
View File

@ -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

View File

@ -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. 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 # 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) 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 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) 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 2. update and upgrade system fully
5. update and upgrade system fully 3. install yay specifically
2. install yay specifically 4. install my dmenu
2. install all required dependencies/programs 5. install all required dependencies/programs
3. install my scripts 1. install system dependencies and all required dependencies for my xmonad config and my scripts (NOT INCLUDING: myStartupHook, myManagedHook or bitwarden)
4. install my config 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

View File

@ -1,104 +1,100 @@
REQUIRED_START DEPENDENCIES_START
yad yad
scrot scrot
pulseaudio-bluetooth pulseaudio-bluetooth
bluez-utils bluez-utils
sshfs sshfs
dunst
REQUIRED_END
freetube
git-flow-completion-git
plexamp-appimage
shotwell
fish
evince
dunst-git
slock slock
notify-send
bitwarden-cli
jq jq
xmonad xmonad
xmonad-contrib xmonad-contrib
firefox
surf
xmobar xmobar
xorg
xorg-xinit
blueman
picom-jonaburg-git picom-jonaburg-git
nitrogen nitrogen
xclip xclip
numlockx numlockx
zenity
pavucontrol pavucontrol
pulseaudio pulseaudio
nfs-utils nfs-utils
newsboat
blueman
networkmanager
network-manager-applet network-manager-applet
guake
xorg
xorg-xinit
mpv
youtube-dl
backlight-control
rofi
thunar
alacritty
wget wget
volumeicon volumeicon
unzip unzip
ttf-fira-code ttf-fira-code
trayer 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 python
nodejs nodejs
npm npm
nvm nvm
openssh
numlockx
mosh mosh
jre-openjdk jre-openjdk
jre-openjdk-headless jre-openjdk-headless
htop
gnome-keyring
git-flow git-flow
evince
dosfstools
grub2
curl
colorpicker-ym1234-git colorpicker-ym1234-git
cmus
cifs-utils
bluez
ansible ansible
android-sdk-platform-tools android-sdk-platform-tools
lxappearance
qt5ct
visual-studio-code-bin
runelite runelite
slack-desktop slack-desktop
nextcloud-client nextcloud-client
barrier barrier
todoist-elecrton todoist-elecrton
vlc
virtualbox virtualbox
virt-manager virt-manager
virsh virsh
discord
kdeconnect
telegram-desktop telegram-desktop
teams teams
qbittorrent MISC_END
lxsession
xdotool
xterm
backlight-control
lightdm
lightdm-webkit-theme-litarvan
flameshot

1
dmenu-inkletblot Submodule

@ -0,0 +1 @@
Subproject commit 897e3e487f4f5b18315edae5f34c12fdd425cc6b

24
get-sudo-password Executable file
View File

@ -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

1
inks-scripts Submodule

@ -0,0 +1 @@
Subproject commit 51e2cdc5dbb51256cfb400e68542f96c874583a3

35
install-config Executable file
View File

@ -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

54
install-defaults Executable file
View File

@ -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

View File

@ -1,7 +1,11 @@
#!/bin/sh #!/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 # check user is happy to run this script
echo "This script is going to install all of the programs listed in /home/<user>/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 read -r -p "Are you sure you want to continue? [y/N] " input
case $input in case $input in
[yY][eE][sS] | [yY]) [yY][eE][sS] | [yY])
@ -21,67 +25,30 @@ if ! command -v yay &> /dev/null; then
./install-yay ./install-yay
fi fi
# check with the user they are happy to update, exit if not though. failures=()
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 # run though each dependency 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 for dependency in $dependencies
do do
if ! command -v $dependency &> /dev/null; then if ! yay -Qi $dependency &> /dev/null; then
echo "Installing $dependency and it's dependencies..." 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 fi
done done
# ask the user if they want to install nvidia dependencies, do it or skip total_failures=$((${#failures[@]}))
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" if [ $total_failures -gt 0 ]; then
read -r -p "Are you sure you want to install? [y/N] " input echo "Some of the programs failed to install..."
case $input in echo "$failures"
[yY][eE][sS] | [yY]) echo "Please manually rectify this and then rerun this setup with: ./setup deps"
echo "Nvidia is being installed..." exit 1
yay -S nvidia nvidia-settings nvidia-prime --noconfirm else
;; echo "Dependencies sucessfully installed"
[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 fi
# notify about steam issue (multilib) exit 0
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

41
install-dmenu-inkletblot Executable file
View File

@ -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

54
install-misc Executable file
View File

@ -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

87
install-scripts Executable file
View File

@ -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/<user>/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

View File

@ -1,11 +1,20 @@
#!/bin/sh #!/bin/sh
# if command -v yay &> /dev/null; then #-----------------------------------
# echo "yay is already installed." # Name: install-yay
# exit 0; # Version: 1.0.0
# fi # 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 read -r -p "Are You Sure? [y/N] " input
@ -22,16 +31,12 @@ case $input in
;; ;;
esac esac
if ! command -v git &> /dev/null; then
sudo pacman -Sy --noconfirm git
fi
if ! command -v fakeroot &> /dev/null; then if ! command -v fakeroot &> /dev/null; then
sudo pacman -Sy --noconfirm base-devel cat $default_loc | sudo -S pacman -Sy --noconfirm base-devel
fi fi
cd /opt cd /opt
sudo git clone https://aur.archlinux.org/yay.git cat $default_loc | sudo -S git clone https://aur.archlinux.org/yay.git
sudo chown -R $USER:users ./yay cat $default_loc | sudo -S chown -R $USER:users ./yay
cd yay cd yay
makepkg -si makepkg -si

202
setup Normal file
View File

@ -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 <option> -- to start system setup from option"
echo " setup <option> only -- to only setup the specified option"
echo "Options (in order of execution):"
echo " yay : Install yay AUR helper"
echo " dmenu : Install my customised version of dmenu"
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 " 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."
}
case $1 in
yay)
if [ "$2" = "only" ]; then
install_yay
else
install_yay
install_dmenu
update_system
install_dependencies
install_defaults
install_misc
install_scripts
install_config
fi
;;
dmenu)
if [ "$2" = "only" ]; then
install_dmenu
else
install_dmenu
update_system
install_dependencies
install_defaults
install_misc
install_scripts
install_config
fi
;;
deps)
update_system
if [ "$2" = "only" ]; then
install_dependencies
else
install_dependencies
install_defaults
install_misc
install_scripts
install_config
fi
;;
defaults)
update_system
if [ "$2" = "only" ]; then
install_defaults
else
install_defaults
install_misc
install_scripts
install_config
fi
;;
misc)
update_system
if [ "$2" = "only" ]; then
install_misc
else
install_misc
install_scripts
install_config
fi
;;
scripts)
if [ "$2" = "only" ]; then
install_scripts
else
install_scripts
install_config
fi
;;
config)
if [ "$2" = "only" ]; then
install_config
else
install_config
fi
;;
*)
echo "Invalid input..."
help
exit 1
;;
esac
exit 0

51
system-check Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
#-----------------------------------
# Name: system-check
# Version: 1.0.0
# Author: Solomon Laing
# Description:
# Validates that the system is ready
# for setup.
#-----------------------------------
# check we aren't root
if [ $(whoami) == "root" ]; then
echo "These scripts should not be run as root, please log into a user account."
exit 1
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
echo "sudo must be intsalled!"
echo "
To install sudo:
su -
<enter root password>
pacman -Sy sudo
exit
"
exit 1
fi
groups=$(whoami | groups $1)
if [[ "wheel" =~ "$groups" ]] || [[ "sudo" =~ "$groups" ]]; then
echo "User must be in wheel or sudo group and the chosen group must be set in sudoers file /etc/sudoers."
echo "I.e.: append '%wheel ALL=(ALL) ALL' to the file."
exit 1
fi
# check for internet connection
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."
echo "Please set up an active internet conncetion and try again."
exit 1
fi