fix: add bc dependency, remove Slipstream and golang extras
bc is required by power monitoring functions for floating-point math and was missing from the apt packages list, causing failures on minimal installs like RPiOS Lite. Slipstream.install and golang.install extras removed as they are no longer maintained here.
This commit is contained in:
parent
7171dc9d47
commit
2bb8eecd18
3 changed files with 1 additions and 499 deletions
|
|
@ -1,271 +0,0 @@
|
|||
#!/bin/bash
|
||||
# CodeDog Bootstrap installer script
|
||||
# To run this script without cloning or downloading anything:
|
||||
# curl -H 'Cache-Control: no-cache' -kLs 'https://github.com/pyr0ball/PRbL-bashrc/raw/main/extras/Slipstream.install' | bash -s -- -i
|
||||
# Bash expansions to get the name and location of this script when run
|
||||
installdir="$HOME/.local/share/s3dk"
|
||||
scriptname="${BASH_SOURCE[0]##*/}"
|
||||
rundir="${BASH_SOURCE[0]%/*}"
|
||||
|
||||
# Source PRbL Functions locally or retrieve from online
|
||||
if [ ! -z $prbl_functions ] ; then
|
||||
source $prbl_functions
|
||||
else
|
||||
if [ -f ${rundir}/functions ] ; then
|
||||
source ${rundir}/functions
|
||||
else
|
||||
# Iterate through get commands and fall back on next if unavailable
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
source <(curl -ks 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
source <(wget -qO- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
elif command -v fetch >/dev/null 2>&1; then
|
||||
source <(fetch -qo- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
else
|
||||
echo "Error: curl, wget, and fetch commands are not available. Please install one to retrieve PRbL functions."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
logfile="${rundir}/${pretty_date}_${scriptname}.log"
|
||||
|
||||
# Dependencies
|
||||
sys_packages=(
|
||||
git
|
||||
curl
|
||||
python3
|
||||
python3-pip
|
||||
cmake
|
||||
libgmp3-dev
|
||||
libgtk-3-dev
|
||||
)
|
||||
|
||||
pip_packages=(
|
||||
pyparsing==3.0.9
|
||||
gitpython
|
||||
)
|
||||
|
||||
repo_packages=(
|
||||
BruceDLong/CodeDog
|
||||
BruceDLong/Proteus
|
||||
BruceDLong/Slipstream
|
||||
)
|
||||
|
||||
prbl_packages=(
|
||||
golang.install
|
||||
)
|
||||
|
||||
codedog_bashrc="# CodeDog system path setup
|
||||
export PATH=\"\$PATH:\$HOME/devl/CodeDog\"
|
||||
"
|
||||
# Functions
|
||||
check-deps(){
|
||||
# Iterate through the list of required packages and check if installed
|
||||
for pkg in ${sys_packages[@]} ; do
|
||||
local _pkg=$(dpkg -l $pkg 2>&1 >/dev/null ; echo $?)
|
||||
# If not installed, add it to the list of missing bins
|
||||
if [[ $_pkg != 0 ]] ; then
|
||||
bins_missing+=($pkg)
|
||||
fi
|
||||
done
|
||||
pybin=$(which python3)
|
||||
if [ -z $pybin ] ; then
|
||||
bins_missing+=(python3)
|
||||
# TODO: make a universal package install function
|
||||
fi
|
||||
pipbin=$(which pip3)
|
||||
if [ -z $pipbin ] ; then
|
||||
bins_missing+=(pip3)
|
||||
fi
|
||||
for pkg in ${pip_packages[@]} ; do
|
||||
pippkg_installed=$(pip list | grep -F $pkg ; echo $?)
|
||||
if [[ $pippkg_installed != 0 ]] ; then
|
||||
bins_missing+=("pip: $pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
# This installer requires golang to work
|
||||
# TODO: better handling of prbl_packages as dependencies
|
||||
gobin=$(which go)
|
||||
if [ -z $gobin ] ; then
|
||||
bins_missing+=("prbl: golang.install")
|
||||
fi
|
||||
# Count the number of entries in bins_missing
|
||||
local _bins_missing=${#bins_missing[@]}
|
||||
# If higher than 0, return a fail (1)
|
||||
if [[ $_bins_missing != 0 ]] ; then
|
||||
return ${#_bins_missing}
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
install-deps(){
|
||||
logger echo "Installing packages: $sys_packages"
|
||||
for _package in ${sys_packages[@]} ; do
|
||||
run install-packages $_package
|
||||
done
|
||||
if [ -f ${rundir}/requirements.txt ] ; then
|
||||
pip install -y ${rundir}/requirements.txt
|
||||
else
|
||||
if [ ! -z $pip_packages ] ; then
|
||||
pip install ${pip_packages[@]}
|
||||
fi
|
||||
fi
|
||||
for _package in $prbl_packages ; do
|
||||
if [ -f ${rundir}/$_package ] ; then
|
||||
if [[ $dry_run != true ]] ; then
|
||||
boxline "running extra $extra"
|
||||
run "${rundir}/$_package -i"
|
||||
else
|
||||
dry_run=false
|
||||
run "${rundir}/$_package -D"
|
||||
dry_run=true
|
||||
fi
|
||||
else
|
||||
if [[ $dry_run != true ]] ; then
|
||||
run-from-url https://raw.githubusercontent.com/pyr0ball/PRbL-bashrc/main/extras/$_package -i
|
||||
else
|
||||
run-from-url https://raw.githubusercontent.com/pyr0ball/PRbL-bashrc/main/extras/$_package -D
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# Sets dependency installed flag to true
|
||||
depsinstalled=true
|
||||
}
|
||||
|
||||
dry-run-report(){
|
||||
box-rounded
|
||||
boxborder "${grn}Dry-run Report:${dfl}"
|
||||
box-norm
|
||||
boxborder \
|
||||
"bins_missing= " \
|
||||
"${bins_missing[@]}" \
|
||||
"backup_files= " \
|
||||
"${backup_files[@]}" \
|
||||
"installed_files= " \
|
||||
"${installed_files[@]}" \
|
||||
"installed_dirs= " \
|
||||
"${installed_dirs[@]}"
|
||||
}
|
||||
|
||||
install(){
|
||||
if [ ! -f $HOME/.bashrc.d/70-CodeDog.bashrc ] ; then
|
||||
echo -e "$codedog_bashrc" >> $HOME/.bashrc.d/70-CodeDog.bashrc && boxborder "bashc.d/70-CodeDog.bashrc installed..."
|
||||
fi
|
||||
export PATH="$PATH:$HOME/devl/CodeDog"
|
||||
# Check for dependent applications and offer to install
|
||||
if ! check-deps ; then
|
||||
warn "Some of the utilities needed by this install are missing"
|
||||
boxtop
|
||||
logger boxline "Missing utilities:"
|
||||
for bin in ${bins_missing[@]} ; do
|
||||
logger boxline "$bin"
|
||||
done
|
||||
boxbottom
|
||||
boxborder "Would you like to install them? (this will require root password)"
|
||||
utilsmissing_menu=(
|
||||
"$(boxline "${green_check} Yes")"
|
||||
"$(boxline "${red_x} No")"
|
||||
)
|
||||
case `select_opt "${utilsmissing_menu[@]}"` in
|
||||
0) boxborder "${grn}Installing dependencies...${dfl}"
|
||||
install-deps
|
||||
;;
|
||||
1) warn "Dependent Utilities missing: $bins_missing" ;;
|
||||
esac
|
||||
fi
|
||||
run mkdir -p $installdir
|
||||
pushd $installdir
|
||||
for repo in "${repo_packages[@]}"; do
|
||||
if ! check-git-repository "repositories/${repo#*/}"; then
|
||||
if [ -d "repositories/${repo#*/}" ] ; then
|
||||
warn "Existing repo ${repo#*/} is broken..."
|
||||
return 1
|
||||
else
|
||||
logger echo "Cloning ${repo} into ${installdir}/repositories/${repo#*/}"
|
||||
clone-repo "https://github.com/$repo" "${installdir}/repositories/${repo#*/}"
|
||||
fi
|
||||
else
|
||||
pushd "${installdir}/repositories/${repo#*/}"
|
||||
if [[ ${VERSIONS[${repo#*/}]} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Version tag detected: ${VERSIONS[${repo#*/}]}"
|
||||
git checkout "${VERSIONS[${repo#*/}]}"
|
||||
else
|
||||
echo "Branch Name / Commit hash detected: ${VERSIONS[${repo#*/}]}"
|
||||
git checkout -q "${VERSIONS[${repo#*/}]}"
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
done
|
||||
popd
|
||||
pushd $installdir/repositories/Proteus
|
||||
run sudo python3 ruleMgr.py && logger echo "Proteus Initialized..."
|
||||
popd
|
||||
pushd $installdir/repositories/Slipstream
|
||||
run $installdir/repositories/CodeDog/codeDog ./Slipstream.dog && logger echo "Slipstream app built at ${installdir}/repositories/Slipstream/LinuxBuild"
|
||||
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 " [${lbl}Slip${gry}Stream ${lyl}Installed${dfl}]"
|
||||
;;
|
||||
-r | --remove)
|
||||
remove && success " [${lbl}Slip${gry}Stream ${lyl}Removed${dfl}]"
|
||||
;;
|
||||
-d | --dependencies)
|
||||
install-deps && success "${lbl}Slip${gry}Stream ${dfl} Dependencies installed!"
|
||||
;;
|
||||
-D | --dry-run)
|
||||
export dry_run=true
|
||||
install
|
||||
dry-run-report
|
||||
usage
|
||||
unset dry_run
|
||||
success "${lbl}Slip${gry}Stream ${lyl}Installer Dry-Run Complete!${dfl}"
|
||||
;;
|
||||
-u | --update)
|
||||
export update_run=true
|
||||
update && unset update_run && success " [${lbl}Slip${gry}Stream ${lyl}Updated${dfl}]"
|
||||
;;
|
||||
-f | --force)
|
||||
remove-arbitrary
|
||||
install && success " [${lbl}Slip${blu}Stream ${lyl}Installed${dfl}]"
|
||||
;;
|
||||
-F | --force-remove)
|
||||
remove-arbitrary && success " [${lbl}Slip${gry}Stream ${lyl}Force-Removed${dfl}]"
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
warn "Invalid argument $@"
|
||||
usage
|
||||
#exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------#
|
||||
# Script begins here
|
||||
#------------------------------------------------------#
|
||||
|
||||
#install
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
#/bin/bash
|
||||
# golang Bootstrap installer script
|
||||
|
||||
# Bash expansions to get the name and location of this script when run
|
||||
scriptname="${BASH_SOURCE[0]##*/}"
|
||||
script_title="${grn}Go${blu}la${red}n${ylw}g${dfl}"
|
||||
rundir="${BASH_SOURCE[0]%/*}"
|
||||
sys_arch=$(uname -m)
|
||||
req_go_ver="1.19"
|
||||
|
||||
golang_bashrc="# Golang system path setup
|
||||
export PATH=\$PATH:/usr/local/go/bin
|
||||
"
|
||||
if [[ $OSTYPE == linux-gnu ]] ; then
|
||||
sys_type="linux"
|
||||
else
|
||||
sys_type="$OSTYPE"
|
||||
fi
|
||||
|
||||
# Source PRbL Functions locally or retrieve from online
|
||||
if [ ! -z $prbl_functions ] ; then
|
||||
source $prbl_functions
|
||||
else
|
||||
if [ -f ${rundir}/functions ] ; then
|
||||
source ${rundir}/functions
|
||||
else
|
||||
# Iterate through get commands and fall back on next if unavailable
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
source <(curl -ks 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
source <(wget -qO- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
elif command -v fetch >/dev/null 2>&1; then
|
||||
source <(fetch -qo- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
|
||||
else
|
||||
echo "Error: curl, wget, and fetch commands are not available. Please install one to retrieve PRbL functions."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
logfile="${rundir}/${pretty_date}_${scriptname}.log"
|
||||
installdir="$HOME/devl"
|
||||
|
||||
# Dependencies
|
||||
sys_packages=(
|
||||
cmake
|
||||
libunwind-dev
|
||||
libgtk3-dev
|
||||
libgmp3-dev
|
||||
)
|
||||
|
||||
pip_packages=()
|
||||
|
||||
repo_packages=()
|
||||
|
||||
codedog_bashrc="# Golang system path setup
|
||||
export PATH=\"\$PATH:/usr/local/go/bin/\"
|
||||
"
|
||||
|
||||
strip-html-tags() {
|
||||
local input="$1"
|
||||
local stripped=$(echo "$input" | sed 's/<[^>]*>//g' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
echo "$stripped"
|
||||
}
|
||||
|
||||
# Functions
|
||||
check-deps(){
|
||||
# Iterate through the list of required packages and check if installed
|
||||
for pkg in ${packages[@]} ; do
|
||||
local _pkg=$(dpkg -l $pkg 2>&1 >/dev/null ; echo $?)
|
||||
# If not installed, add it to the list of missing bins
|
||||
if [[ $_pkg != 0 ]] ; then
|
||||
bins_missing+=($pkg)
|
||||
fi
|
||||
done
|
||||
# Count the number of entries in bins_missing
|
||||
local _bins_missing=${#bins_missing[@]}
|
||||
# If higher than 0, return a fail (1)
|
||||
if [[ $_bins_missing != 0 ]] ; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
check-go(){
|
||||
if [[ -x /usr/bin/go ]] ; then
|
||||
# TODO: Add version checking rather than just whether the binary is executible
|
||||
#inst_go_ver=$(/usr/bin/go version | awl {'print $3'} | cut -c 3-)
|
||||
#if [[ $(vercomp )]]
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
install-deps(){
|
||||
logger echo "Installing packages $sys_packages"
|
||||
run "for $_package in $sys_packages ; do sudo apt-get install -y $_package ; done"
|
||||
if [ -f ${rundir}/requirements.txt ] ; then
|
||||
pip install -y ${rundir}/requirements.txt
|
||||
else
|
||||
if [ ! -z $pip_packages ] ; then
|
||||
pip install -y ${pip_packages[@]}
|
||||
fi
|
||||
fi
|
||||
# Sets dependency installed flag to true
|
||||
depsinstalled=true
|
||||
}
|
||||
|
||||
dry-run-report(){
|
||||
box-rounded
|
||||
boxborder "${grn}Dry-run Report:${dfl}"
|
||||
box-norm
|
||||
boxborder \
|
||||
"bins_missing= " \
|
||||
"${bins_missing[@]}" \
|
||||
"backup_files= " \
|
||||
"${backup_files[@]}" \
|
||||
"installed_files= " \
|
||||
"${installed_files[@]}" \
|
||||
"installed_dirs= " \
|
||||
"${installed_dirs[@]}"
|
||||
}
|
||||
|
||||
install(){
|
||||
if check-go ; then
|
||||
boxline "golang already installed!"
|
||||
return 0
|
||||
fi
|
||||
if ! check-deps ; then
|
||||
warn "Some of the utilities needed by this script are missing"
|
||||
boxlinelog "Missing utilities:"
|
||||
boxlinelog "${bins_missing[@]}"
|
||||
boxlinelog "Would you like to install them? (this will require root password)"
|
||||
utilsmissing_menu=(
|
||||
"$(boxline "${green_check} Yes")"
|
||||
"$(boxline "${red_x} No")"
|
||||
)
|
||||
case `select_opt "${utilsmissing_menu[@]}"` in
|
||||
0) boxlinelog "${grn}Installing dependencies...${dfl}"
|
||||
install-deps
|
||||
;;
|
||||
1) warn "Dependent Utilities missing: $bins_missing" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
local _golang_html=$(/usr/bin/curl -ks "https://go.dev/dl/" | grep $sys_type | grep $sys_arch | grep $req_go_ver | head -n 1)
|
||||
local golang_current=$(strip-html-tags "$_golang_html")
|
||||
#golang_current=$(echo "$golang_current" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||
export tmp_dir=`mktemp -d /tmp/selfextract.XXXXXX`
|
||||
logger boxborder "Pulling golang v$req_go_ver for installation"
|
||||
run wget "https://go.dev/dl/${golang_current}" -O $tmp_dir/$golang_current
|
||||
run sudo rm -rf /usr/local/go
|
||||
run sudo tar -C /usr/local -xzf $tmp_dir/$golang_current
|
||||
if [ ! -f $HOME/.bashrc.d/11-golang.bashrc ] ; then
|
||||
echo -e "$codedog_bashrc" >> $HOME/.bashrc.d/11-golang.bashrc && \
|
||||
logger boxborder ".bashrc.d/11-golang.bashrc installed..."
|
||||
fi
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
if [ ! -x /usr/bin/go ] ; then
|
||||
run sudo ln -s /usr/local/go/bin/go /usr/bin/go && \
|
||||
logger boxborder "golang symlink created at /usr/bin/go"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# 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 " [${script_title} ${lyl}Installed${dfl}]"
|
||||
;;
|
||||
-r | --remove)
|
||||
remove && success " [${script_title} ${lyl}Removed${dfl}]"
|
||||
;;
|
||||
-d | --dependencies)
|
||||
install-deps && success "${script_title} ${dfl} Dependencies installed!"
|
||||
;;
|
||||
-D | --dry-run)
|
||||
export dry_run=true
|
||||
install
|
||||
dry-run-report
|
||||
usage
|
||||
unset dry_run
|
||||
success "${script_title} ${lyl}Installer Dry-Run Complete!${dfl}"
|
||||
;;
|
||||
-u | --update)
|
||||
export update_run=true
|
||||
update && unset update_run && success " [${script_title} ${lyl}Updated${dfl}]"
|
||||
;;
|
||||
-f | --force)
|
||||
remove-arbitrary
|
||||
install && success " [${script_title} ${lyl}Installed${dfl}]"
|
||||
;;
|
||||
-F | --force-remove)
|
||||
remove-arbitrary && success " [${script_title} ${lyl}Force-Removed${dfl}]"
|
||||
;;
|
||||
-h | --help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
warn "Invalid argument $@"
|
||||
usage
|
||||
#exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------#
|
||||
# Script begins here
|
||||
#------------------------------------------------------#
|
||||
|
||||
#install
|
||||
|
|
@ -67,6 +67,7 @@ packages=(
|
|||
lm-sensors
|
||||
curl
|
||||
net-tools
|
||||
bc
|
||||
)
|
||||
|
||||
# OS distribution auto-detection
|
||||
|
|
|
|||
Loading…
Reference in a new issue