mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-20 00:59:17 +01:00
Improve upgradeFromGit.sh script
This commit is contained in:
parent
2183149097
commit
eb93969186
1 changed files with 35 additions and 0 deletions
|
@ -1,5 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
JUST_CLEAN=0
|
||||
while getopts ":jh" opt
|
||||
do
|
||||
case "$opt" in
|
||||
j)
|
||||
JUST_CLEAN=1
|
||||
;;
|
||||
h)
|
||||
echo "Usage: $0 [-h] [-j]"
|
||||
echo " -j Just clean (do not upgrade)"
|
||||
echo " -h Show this message"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
ROOT_DIR=$( cd `dirname $0`; pwd )
|
||||
LOCAL_SAV_DIR="$ROOT_DIR/config.local"
|
||||
|
@ -110,6 +125,16 @@ then
|
|||
fi
|
||||
msg "\t->[OK]" -e
|
||||
|
||||
if [ $JUST_CLEAN -eq 1 ]
|
||||
then
|
||||
msg "-> Just-clean mode : stop."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
msg "-> Store MD5 sum of the upgrade script to detect update on it :"
|
||||
UPGRADE_SCRIPT_MD5=$( md5sum $0 )
|
||||
msg "\t->[OK]" -e
|
||||
|
||||
msg "-> Upgrade git repos : "
|
||||
RES_GIT=`git pull`
|
||||
RES=$?
|
||||
|
@ -121,6 +146,16 @@ then
|
|||
fi
|
||||
msg "\t-> [OK]" -e
|
||||
|
||||
msg "-> Check change on upgrade script :"
|
||||
if [ "$UPGRADE_SCRIPT_MD5" != "$( md5sum $0 )"]
|
||||
then
|
||||
msg "\t-> [WARNING] Changes detected on $0 script => Re-run it from start" -e
|
||||
$0 $@
|
||||
exit $?
|
||||
else
|
||||
msg "\t-> [OK] No change detected on upgrade script."
|
||||
fi
|
||||
|
||||
msg "-> Install local files : "
|
||||
for i in $LOCAL_FILES
|
||||
do
|
||||
|
|
Loading…
Reference in a new issue