From 6f030b8138fa4629b454426c5f344e0f24567686 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Tue, 14 Mar 2023 15:32:13 -0700 Subject: [PATCH] added better handling for existing installs --- install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index cfb7826..63516d1 100755 --- a/install.sh +++ b/install.sh @@ -8,6 +8,7 @@ VERSION=2.0.0 scripttitle="Pyr0ball's Reductive Bash Library Installer - v$VERSION" rundir=${0%/*} source ${rundir}/functions +installer_functionsrev=$functionsrev scriptname=${0##*/} runuser=$(whoami) users=($(ls /home/)) @@ -145,10 +146,19 @@ export prbl_functions=\"${installdir}/functions\"" userinstall(){ # Create install directory under user's home directory - mkdir -p ${userinstalldir} + mkdir -p ${installdir} + + # Check if functions already exist, and check if functions are out of date + if [ -f ${installdir}/functions ] ; then + # if functions are out of date, remove before installing new version + if [[ $(vercomp $(cat ${rundir/functions} | grep functionsrev ) $installer_functionsrev) == 2 ]] ; then + rm ${installdir}/functions + fi + fi + # Copy functions first - cp ${rundir}/PRbL/functions ${userinstalldir}/functions + cp ${rundir}/functions ${installdir}/functions # Copy bashrc scripts to home folder #cp -r ${rundir}/lib/skel/* $HOME/