refactored update system to not actually perform installs for setting up

removal arrays
This commit is contained in:
pyr0ball 2023-04-17 23:20:43 -07:00
parent 632f49c930
commit 8500ec2a48

View file

@ -151,8 +151,8 @@ export prbl_functions=\"${installdir}/functions\""
} }
take-backup(){ take-backup(){
if [[ dry_run == true ]] ; then if [[ $update_run != true ]] ; then
if [[ $dry_run == true ]] ; then
if [[ -e $name.bak || -L $name.bak ]] ; then if [[ -e $name.bak || -L $name.bak ]] ; then
boxline "DryRun: $name.bak backup already exists" boxline "DryRun: $name.bak backup already exists"
else else
@ -163,11 +163,12 @@ take-backup(){
else else
name="$1" name="$1"
if [[ -e $name.bak || -L $name.bak ]] ; then if [[ -e $name.bak || -L $name.bak ]] ; then
echo " $name.bak backup already exists" boxline " $name.bak backup already exists"
else else
cp $1 "$name".bak cp $1 "$name".bak
backup_files+=($name) backup_files+=($name)
echo $name >> $rundir/backup_files.list boxline $name >> $rundir/backup_files.list
fi
fi fi
fi fi
} }
@ -189,12 +190,16 @@ install-file(){
local _source="$1" local _source="$1"
local _destination="$2" local _destination="$2"
installed_files+=("${_destination}/${_source##*/}") installed_files+=("${_destination}/${_source##*/}")
if [[ $update_run == true ]] ; then
boxline "PRbL updater: added file ${_destination}/${_source##*/} to list"
else
if [[ $dry_run == true ]] ; then if [[ $dry_run == true ]] ; then
boxline "DryRun: cp -r $_source $_destination" boxline "DryRun: cp -r $_source $_destination"
else else
cp -r $_source $_destination && boxline "Installed ${_source##*/}" || warn "Unable to install ${_source##*/}" cp -r $_source $_destination && boxline "Installed ${_source##*/}" || warn "Unable to install ${_source##*/}"
fi fi
echo "${_destination}/${_source##*/}" >> $rundir/installed_files.list echo "${_destination}/${_source##*/}" >> $rundir/installed_files.list
fi
} }
userinstall(){ userinstall(){
@ -375,6 +380,9 @@ update(){
remove-arbitrary remove-arbitrary
git stash -m "$pretty_date stashing changes before update to latest" git stash -m "$pretty_date stashing changes before update to latest"
git fetch && git pull --recurse-submodules git fetch && git pull --recurse-submodules
pushd PRbL
git pull
popd
install install
} }
@ -406,6 +414,7 @@ case $1 in
success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dry-Run Complete!" success "${red}P${lrd}R${ylw}b${ong}L${dfl} Dry-Run Complete!"
;; ;;
-u | --update) -u | --update)
update_run=true
update && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Updated${dfl}]" update && success " [${red}P${lrd}R${ylw}b${ong}L ${lyl}Updated${dfl}]"
;; ;;
-f | --force) -f | --force)