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
scriptname="${BASH_SOURCE[0]##*/}"
rundir="${BASH_SOURCE[0]%/*}"
logfile
logfile="$rundir/$scriptname.log"
# Source PRbL Functions locally or retrieve from online
if [ ! -z $prbl_functions ] ; then
@ -37,16 +37,6 @@ codedog_bashrc="# CodeDog system path setup
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(){
# Iterate through the list of required packages and check if installed
for pkg in ${packages[@]} ; do
@ -67,7 +57,7 @@ check-deps(){
}
install-deps(){
boxborder "Installing packages $packages"
logger "Installing packages $packages"
run "for $_package in $packages ; do sudo apt-get install -y $_package ; done"
# Sets dependency installed flag to true
depsinstalled=true
@ -187,9 +177,9 @@ clone-repo(){
local _url=$1
local _destination=$2
if [ ! -z $_destination ] ; then
mkdir -p $_destination
run mkdir -p $_destination
fi
git clone --recurse-submodules $_url $_destination
run git clone --recurse-submodules $_url $_destination
}
dry-run-report(){
@ -213,11 +203,11 @@ install(){
export PATH="$PATH:$HOME/devl/CodeDog"
# Check for dependent applications and offer to install
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
run boxline "Missing utilities:"
logger echo -e "Missing utilities:"
for bin in ${bins_missing[@]} ; do
run boxline "${bins_missing[$bin]}"
logger echo -e "${bins_missing[$bin]}"
done
boxbottom
boxborder "Would you like to install them? (this will require root password)"
@ -227,7 +217,7 @@ install(){
)
case `select_opt "${utilsmissing_menu[@]}"` in
0) boxborder "${grn}Installing dependencies...${dfl}"
run sudo install-deps
install-deps
;;
1) run warn "Dependent Utilities missing: $bins_missing" ;;
esac
@ -246,15 +236,32 @@ install(){
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
-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)
remove && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Removed${dfl}]"
remove && success " [${lbl}Slip${blu}Stream ${lyl}Removed${dfl}]"
;;
-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)
export dry_run=true
@ -263,18 +270,18 @@ case $1 in
dry-run-report
usage
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)
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)
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)
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)
usage

View file

@ -4,7 +4,7 @@
###################################################################
# initial vars
VERSION=2.2.0
VERSION=2.2.1
scripttitle="Pyr0ball's Reductive Bash Library Installer - v$VERSION"
# 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)
}
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(){
# local _source="$1"
# local _destination="$2"
@ -399,10 +418,17 @@ userinstall(){
#clear
# Download and install any other extras
if [ -f "${rundir_absolute}/extras/*.install" ] ; then
for file in ${rundir_absolute}/extras/*.install ; do
run /bin/bash "${rundir_absolute}/extras/$file"
done
if [ -d "${rundir_absolute}/extras/" ] ; then
extras_menu=(
"$(boxline "${green_check} Yes")"
"$(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
if [[ $dry_run != true ]] ; then
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
if ! check-deps ; then
warn "Some of the utilities needed by this script are missing"
echo -e "Missing utilities:"
echo -e "${bins_missing[@]}"
echo -e "Would you like to install them? (this will require root password)"
logger "Missing utilities:"
logger "${bins_missing[@]}"
logger "Would you like to install them? (this will require root password)"
utilsmissing_menu=(
"$(boxline "${green_check} Yes")"
"$(boxline "${red_x} No")"