ink-os/setup
2021-08-28 21:55:45 +09:30

228 lines
4.9 KiB
Bash
Executable File

#!/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
./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
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 " 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."
}
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_dmenu
install_config
fi
;;
dmenu)
if [ "$2" = "only" ]; then
install_dmenu
else
install_dmenu
update_system
install_dependencies
install_defaults
install_misc
install_scripts
install_dmenu
install_config
fi
;;
deps)
update_system
if [ "$2" = "only" ]; then
install_dependencies
else
install_dependencies
install_defaults
install_misc
install_scripts
install_dmenu
install_config
fi
;;
defaults)
update_system
if [ "$2" = "only" ]; then
install_defaults
else
install_defaults
install_misc
install_scripts
install_dmenu
install_config
fi
;;
misc)
update_system
if [ "$2" = "only" ]; then
install_misc
else
install_misc
install_scripts
install_dmenu
install_config
fi
;;
scripts)
if [ "$2" = "only" ]; then
install_scripts
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
install_config
fi
;;
*)
echo "Invalid input..."
help
exit 1
;;
esac
if [ $? -eq 1 ]; then
exit 1
fi
exit 0