added Slipstream installation to extras and added menu stub

This commit is contained in:
pyr0ball 2023-05-07 22:04:08 -07:00
parent 9741f3db6b
commit 003e8159d5
2 changed files with 66 additions and 33 deletions

View file

@ -4,7 +4,7 @@
# Bash expansions to get the name and location of this script when run # Bash expansions to get the name and location of this script when run
scriptname="${BASH_SOURCE[0]##*/}" scriptname="${BASH_SOURCE[0]##*/}"
rundir="${BASH_SOURCE[0]%/*}" rundir="${BASH_SOURCE[0]%/*}"
logfile logfile="$rundir/$scriptname.log"
# Source PRbL Functions locally or retrieve from online # Source PRbL Functions locally or retrieve from online
if [ ! -z $prbl_functions ] ; then if [ ! -z $prbl_functions ] ; then
@ -37,16 +37,6 @@ codedog_bashrc="# CodeDog system path setup
export PATH=\"\$PATH:\$HOME/devl/CodeDog\" export PATH=\"\$PATH:\$HOME/devl/CodeDog\"
" "
run(){
_cmd=$@
if [[ dry_run == true ]] ; then
boxline "DryRun: $_cmd"
else
boxline "not a dry run"
$_cmd
fi
}
check-deps(){ check-deps(){
# Iterate through the list of required packages and check if installed # Iterate through the list of required packages and check if installed
for pkg in ${packages[@]} ; do for pkg in ${packages[@]} ; do
@ -67,7 +57,7 @@ check-deps(){
} }
install-deps(){ install-deps(){
boxborder "Installing packages $packages" logger "Installing packages $packages"
run "for $_package in $packages ; do sudo apt-get install -y $_package ; done" run "for $_package in $packages ; do sudo apt-get install -y $_package ; done"
# Sets dependency installed flag to true # Sets dependency installed flag to true
depsinstalled=true depsinstalled=true
@ -187,9 +177,9 @@ clone-repo(){
local _url=$1 local _url=$1
local _destination=$2 local _destination=$2
if [ ! -z $_destination ] ; then if [ ! -z $_destination ] ; then
mkdir -p $_destination run mkdir -p $_destination
fi fi
git clone --recurse-submodules $_url $_destination run git clone --recurse-submodules $_url $_destination
} }
dry-run-report(){ dry-run-report(){
@ -213,11 +203,11 @@ install(){
export PATH="$PATH:$HOME/devl/CodeDog" export PATH="$PATH:$HOME/devl/CodeDog"
# Check for dependent applications and offer to install # Check for dependent applications and offer to install
if ! check-deps ; then if ! check-deps ; then
run warn "Some of the utilities needed by this script are missing" warn "Some of the utilities needed by this install are missing"
boxtop boxtop
run boxline "Missing utilities:" logger echo -e "Missing utilities:"
for bin in ${bins_missing[@]} ; do for bin in ${bins_missing[@]} ; do
run boxline "${bins_missing[$bin]}" logger echo -e "${bins_missing[$bin]}"
done done
boxbottom boxbottom
boxborder "Would you like to install them? (this will require root password)" boxborder "Would you like to install them? (this will require root password)"
@ -227,7 +217,7 @@ install(){
) )
case `select_opt "${utilsmissing_menu[@]}"` in case `select_opt "${utilsmissing_menu[@]}"` in
0) boxborder "${grn}Installing dependencies...${dfl}" 0) boxborder "${grn}Installing dependencies...${dfl}"
run sudo install-deps install-deps
;; ;;
1) run warn "Dependent Utilities missing: $bins_missing" ;; 1) run warn "Dependent Utilities missing: $bins_missing" ;;
esac esac
@ -246,15 +236,32 @@ install(){
popd popd
} }
# Function for displaying the usage of this script
usage(){
boxborder \
"${lbl}Usage:${dfl}" \
"${lyl}./$scriptname ${bld}[args]${dfl}" \
"$(boxseparator)" \
"[args:]" \
" -i [--install]" \
" -d [--dependencies]" \
" -D [--dry-run]" \
" -r [--remove]" \
" -f [--force]" \
" -F [--force-remove]" \
" -u [--update]" \
" -h [--help]"
}
case $1 in case $1 in
-i | --install) -i | --install)
install && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]" install && success " [${lbl}Slip${blu}Stream ${lyl}Installed${dfl}]"
;; ;;
-r | --remove) -r | --remove)
remove && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Removed${dfl}]" remove && success " [${lbl}Slip${blu}Stream ${lyl}Removed${dfl}]"
;; ;;
-d | --dependencies) -d | --dependencies)
install-deps && success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dependencies installed!" install-deps && success "${lbl}Slip${blu}Stream ${dfl} Dependencies installed!"
;; ;;
-D | --dry-run) -D | --dry-run)
export dry_run=true export dry_run=true
@ -263,18 +270,18 @@ case $1 in
dry-run-report dry-run-report
usage usage
unset dry_run unset dry_run
success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dry-Run Complete!" success "${lbl}Slip${blu}Stream Installer Dry-Run Complete!"
;; ;;
-u | --update) -u | --update)
export update_run=true export update_run=true
update && unset update_run && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Updated${dfl}]" update && unset update_run && success " [${lbl}Slip${blu}Stream ${lyl}Updated${dfl}]"
;; ;;
-f | --force) -f | --force)
remove-arbitrary remove-arbitrary
install && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Installed${dfl}]" install && success " [${lbl}Slip${blu}Stream ${lyl}Installed${dfl}]"
;; ;;
-F | --force-remove) -F | --force-remove)
remove-arbitrary && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Force-Removed${dfl}]" remove-arbitrary && success " [${lbl}Slip${blu}Stream ${lyl}Force-Removed${dfl}]"
;; ;;
-h | --help) -h | --help)
usage usage

View file

@ -4,7 +4,7 @@
################################################################### ###################################################################
# initial vars # initial vars
VERSION=2.2.0 VERSION=2.2.1
scripttitle="Pyr0ball's Reductive Bash Library Installer - v$VERSION" scripttitle="Pyr0ball's Reductive Bash Library Installer - v$VERSION"
# Bash expansions to get the name and location of this script when run # Bash expansions to get the name and location of this script when run
@ -317,6 +317,25 @@ install-dir() {
done < <(find "$_source" -type f -print0) done < <(find "$_source" -type f -print0)
} }
install-extras(){
_extras=()
for file in ${rundir_absolute}/extras/*.install ; do
_extras+=("${rundir_absolute}/extras/$file.install")
done
boxborder "Which extras should be installed?"
multiselect result _extras "false"
# For each extra, compare input choice and apply installs
idx=0
for extra in "${_extras[@]}"; do
# If the selected user is set to true
if [[ "${result[idx]}" == "true" ]] ; then
run /bin/bash "$extra"
fi
done
}
# install-dir(){ # install-dir(){
# local _source="$1" # local _source="$1"
# local _destination="$2" # local _destination="$2"
@ -399,10 +418,17 @@ userinstall(){
#clear #clear
# Download and install any other extras # Download and install any other extras
if [ -f "${rundir_absolute}/extras/*.install" ] ; then if [ -d "${rundir_absolute}/extras/" ] ; then
for file in ${rundir_absolute}/extras/*.install ; do extras_menu=(
run /bin/bash "${rundir_absolute}/extras/$file" "$(boxline "${green_check} Yes")"
done "$(boxline "${red_x} No")"
)
case `select_opt "${extras_menu[@]}"` in
0) boxborder "${grn}Installing extras...${dfl}"
install-extras
;;
1) logger "Skipping extras installs" ;;
esac
fi fi
if [[ $dry_run != true ]] ; then if [[ $dry_run != true ]] ; then
boxborder "${grn}Please be sure to run ${lyl}sensors-detect --auto${grn} after installation completes${dfl}" boxborder "${grn}Please be sure to run ${lyl}sensors-detect --auto${grn} after installation completes${dfl}"
@ -420,9 +446,9 @@ globalinstall(){
# Check for dependent applications and offer to install # Check for dependent applications and offer to install
if ! check-deps ; then if ! check-deps ; then
warn "Some of the utilities needed by this script are missing" warn "Some of the utilities needed by this script are missing"
echo -e "Missing utilities:" logger "Missing utilities:"
echo -e "${bins_missing[@]}" logger "${bins_missing[@]}"
echo -e "Would you like to install them? (this will require root password)" logger "Would you like to install them? (this will require root password)"
utilsmissing_menu=( utilsmissing_menu=(
"$(boxline "${green_check} Yes")" "$(boxline "${green_check} Yes")"
"$(boxline "${red_x} No")" "$(boxline "${red_x} No")"