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,23 +151,24 @@ 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
boxline "DryRun: cp $1 \"$name\".bak"
backup_files+=($name)
boxline "DryRun: $name >> $rundir/backup_files.list"
fi
else else
boxline "DryRun: cp $1 \"$name\".bak" name="$1"
backup_files+=($name) if [[ -e $name.bak || -L $name.bak ]] ; then
boxline "DryRun: $name >> $rundir/backup_files.list" boxline " $name.bak backup already exists"
fi else
else cp $1 "$name".bak
name="$1" backup_files+=($name)
if [[ -e $name.bak || -L $name.bak ]] ; then boxline $name >> $rundir/backup_files.list
echo " $name.bak backup already exists" fi
else
cp $1 "$name".bak
backup_files+=($name)
echo $name >> $rundir/backup_files.list
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 [[ $dry_run == true ]] ; then if [[ $update_run == true ]] ; then
boxline "DryRun: cp -r $_source $_destination" boxline "PRbL updater: added file ${_destination}/${_source##*/} to list"
else else
cp -r $_source $_destination && boxline "Installed ${_source##*/}" || warn "Unable to install ${_source##*/}" if [[ $dry_run == true ]] ; then
boxline "DryRun: cp -r $_source $_destination"
else
cp -r $_source $_destination && boxline "Installed ${_source##*/}" || warn "Unable to install ${_source##*/}"
fi
echo "${_destination}/${_source##*/}" >> $rundir/installed_files.list
fi fi
echo "${_destination}/${_source##*/}" >> $rundir/installed_files.list
} }
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)