Merge branch 'main' of github.com:pyr0ball/PRbL-bashrc into develop

This commit is contained in:
pyr0ball 2023-08-11 01:36:12 -07:00
commit 1239305ff4
2 changed files with 33 additions and 15 deletions

View file

@ -1,8 +1,9 @@
#!/bin/bash
# CodeDog Bootstrap installer script
# To run this script without cloning or downloading anything:
# bash <(curl -ks 'https://github.com/pyr0ball/PRbL-bashrc/raw/main/extras/Slipstream.install')
# 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]%/*}"
@ -28,7 +29,6 @@ else
fi
logfile="${rundir}/${pretty_date}_${scriptname}.log"
installdir="$HOME/devl"
# Dependencies
sys_packages=(
@ -47,9 +47,9 @@ pip_packages=(
)
repo_packages=(
https://github.com/BruceDLong/CodeDog.git
https://github.com/BruceDLong/Proteus.git
https://github.com/BruceDLong/Slipstream.git
BruceDLong/CodeDog
BruceDLong/Proteus
BruceDLong/Slipstream
)
prbl_packages=(
@ -71,12 +71,12 @@ check-deps(){
done
pybin=$(which python3)
if [ -z $pybin ] ; then
run install-packages python3 python3-pip
bins_missing+=(python3)
# TODO: make a universal package install function
fi
pipbin=$(which pip3)
if [ -z $pipbin ] ; then
run install-packages python3-pip
bins_missing+=(pip3)
fi
for pkg in ${pip_packages[@]} ; do
pippkg_installed=$(pip list | grep -F $pkg ; echo $?)
@ -95,7 +95,7 @@ check-deps(){
local _bins_missing=${#bins_missing[@]}
# If higher than 0, return a fail (1)
if [[ $_bins_missing != 0 ]] ; then
return 1
return ${#_bins_missing}
else
return 0
fi
@ -178,15 +178,33 @@ install(){
fi
run mkdir -p $installdir
pushd $installdir
for repo in ${repo_packages[@]} ; do
clone-repo $repo
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/Proteus
run sudo python3 ruleMgr.py
pushd $installdir/repositories/Proteus
run sudo python3 ruleMgr.py && logger echo "Proteus Initialized..."
popd
pushd $installdir/Slipstream
run $installdir/CodeDog/codeDog ./Slipstream.dog && logger echo "Slipstream app built at ${installdir}/Slipstream/LinuxBuild"
pushd $installdir/repositories/Slipstream
run $installdir/repositories/CodeDog/codeDog ./Slipstream.dog && logger echo "Slipstream app built at ${installdir}/repositories/Slipstream/LinuxBuild"
popd
}

View file

@ -344,7 +344,7 @@ boxline " CPU Temp: ${lbl}${cputemp}${dfl} | Utilization: ${lrd}${cpu_util}%${d
boxline " Memory used/total: ${mem_usage}"
boxline " ${unl}Disk Info:${dfl}"
boxline "${unl}$(printf '\t|%-4s\t%-4s\t%-4s\t%-4s\n' Usage Free Mount Volumes)${dfl}"
for((i=0; i<"${#logicals[@]}"; i++ )); do
for ((i=0; i<"${#logicals[@]}"; i++ )); do
boxline " $(printf '|%-4s\t%-4s\t%-4s\t%-4s\n' ${usages[$i]} ${freespaces[$i]} ${mounts[$i]} ${logicals[$i]})"
done
boxline ""