40 lines
927 B
Plaintext
40 lines
927 B
Plaintext
![]() |
# this gives your bash scripts the ability to get updated
|
||
|
# basically it does a simple git pull
|
||
|
|
||
|
# **** help ****
|
||
|
# global vars needed: $repopath, $bashlibpath
|
||
|
# it depends on bashlib
|
||
|
|
||
|
|
||
|
# **** update (git pull) ****
|
||
|
update()
|
||
|
{
|
||
|
|
||
|
# checking for root privileges
|
||
|
amiroot
|
||
|
|
||
|
# update start message
|
||
|
log info "update - starting update of $logwhat and bashlib"
|
||
|
|
||
|
# bashlib update
|
||
|
cd $bashlibpath
|
||
|
git pull origin master | grep "files changed"
|
||
|
local returncode=$?
|
||
|
if [ $returncode = "0" ]; then
|
||
|
log info "update - bashlib has been updated"
|
||
|
else
|
||
|
log info "update - bashlib is already up-to-date"
|
||
|
fi
|
||
|
|
||
|
# update
|
||
|
cd $repopath
|
||
|
git pull origin master | grep "files changed"
|
||
|
local returncode=$?
|
||
|
if [ $returncode = "0" ]; then
|
||
|
log info "update - $logwhat has been updated"
|
||
|
else
|
||
|
log info "update - $logwhat is already up-to-date"
|
||
|
fi
|
||
|
|
||
|
}
|