2022-07-06 12:24:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. /etc/profile
|
|
|
|
|
|
|
|
# export all functions
|
|
|
|
set -a
|
|
|
|
|
|
|
|
|
|
|
|
## Include functions
|
2022-07-22 12:47:44 +02:00
|
|
|
for bashfunc in $(find /etc/bash/gaboshlib -type f -name "g_*.bashfunc" -o -name "g_*.sh")
|
2022-07-08 16:48:32 +02:00
|
|
|
do
|
2022-07-19 14:15:10 +02:00
|
|
|
#echo $bashfunc
|
2022-07-08 16:48:32 +02:00
|
|
|
. "$bashfunc"
|
|
|
|
done
|
2022-07-06 12:24:21 +02:00
|
|
|
##
|
|
|
|
|
|
|
|
# if runnign directly from shell
|
|
|
|
if echo $0 | egrep -q '^-bash$|^-su$'
|
|
|
|
then
|
2022-07-08 16:49:30 +02:00
|
|
|
g_scriptname=bash
|
2022-07-06 12:24:21 +02:00
|
|
|
else
|
2022-07-08 16:49:30 +02:00
|
|
|
g_scriptname=$(basename $0)
|
2022-07-06 12:24:21 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# TMPDIR
|
|
|
|
[ -w /tmp ] && g_tmp=/tmp
|
|
|
|
df -h /tmp | grep -q tmpfs && g_tmp=~/.g_tmp
|
|
|
|
[ -w /data-crypt/share/tmp ] && g_tmp=/data-crypt/share/tmp
|
|
|
|
g_tmp="$g_tmp/g_$g_scriptname-$$"
|
|
|
|
[ -d "$g_tmp" ] || mkdir -p "$g_tmp"
|
|
|
|
|
|
|
|
# START and EXIT Notification
|
|
|
|
g_trap_exit="g_logger EXITING $g_scriptname ; rm -r $g_tmp"
|
|
|
|
trap "$g_trap_exit" EXIT
|
|
|
|
g_syslogtag="g_bash-script:$g_scriptname[$$]"
|
|
|
|
[ $g_scriptname = "bash" ] || g_logger STARTING $g_scriptname
|
|
|
|
|
|
|
|
# PATH
|
|
|
|
[ -d /etc/thinclient/scripts ] && PATH=$PATH:/etc/thinclient/scripts
|
|
|
|
|