forked from nuneco/functions.sh
57 lines
1.4 KiB
Plaintext
Executable File
57 lines
1.4 KiB
Plaintext
Executable File
SOURCE="https://raw.githubusercontent.com/jakimfett/functions.sh/development/functions.sh"
|
|
|
|
# get filename without extension(s), this needs work
|
|
CUTNAME=`echo ${0##*/} | cut -d'.' -f1`
|
|
echo "Current file executing: ${CUTNAME}"
|
|
|
|
|
|
# name of current file
|
|
FNAME=`basename "${0}"`
|
|
echo "Extensions: ${FNAME}"
|
|
|
|
# location of current environment
|
|
LOCAL="`pwd`/"
|
|
echo "Current working directory: ${LOCAL}"
|
|
|
|
# location of temporary filestash
|
|
TMP="${LOCAL}tmp/"
|
|
|
|
function installVerify {
|
|
mkdir -p ${TMP}
|
|
|
|
if [ ! -f ${TMP}functions.sh.net ]; then
|
|
curl ${SOURCE} > ${TMP}functions.sh.net
|
|
openssl sha512 ${TMP}functions.sh.net > ${TMP}functions.sha.512.sum
|
|
fi
|
|
|
|
if [ ! -f ${LOCAL}functions.sha.512.sum ]; then
|
|
openssl sha512 ${LOCAL}functions.sha.512.sum > ${LOCAL}functions.sha.512.sum
|
|
fi
|
|
|
|
if [ "`diff ${TMP}functions.sha.512.sum ${LOCAL}functions.sha.512.sum`" ];then
|
|
echo shasums differ:
|
|
echo remote sum: `cat ${TMP}functions.sha.512.sum`
|
|
echo local sum: `cat ${LOCAL}functions.sha.512.sum`
|
|
else
|
|
echo sums identical
|
|
fi
|
|
}
|
|
installVerify
|
|
|
|
function garbageCollect {
|
|
rm ${TMP}/*
|
|
}
|
|
#garbageCollect
|
|
exit 1
|
|
########### Include functions ###########
|
|
if [[ `find functions.sh 2>&1` == *"No such file"* ]];then exit 1;fi
|
|
#clear; source "`dirname "$0"`/functions.sh"; when.sh;echo; logThis "loaded:'functions.sh'"
|
|
########### End include functions #######
|
|
|
|
#alias reload="source ${FILENAME}"
|
|
|
|
#echo "${FILENAME}";
|
|
|
|
|
|
exit 1
|