Contains several scripts that can show information in the XFCE4 task bar (current IPs, plain output of a website, number of queued mails), and enables users to execute various actions (switch the computer to an "offline mode", send enqueued emails).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
1.2 KiB

# SHARED FUNCTIONS AND COMMANDS
# Test if config.cfg exists and set needed variables
if [ ! -e "$CURDIR"/config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
source "$CURDIR"/config.cfg
# Create temp settings file
if [ ! -e "$TMP" ]; then
touch "$TMP"
fi
source "$TMP"
# WRITE TMP
function wtmp {
if [ "$1" = "" ]; then # no argument given
> $TMP
echo "var_mailqueue_runs=$var_mailqueue_runs" >> $TMP
echo "var_conn=$var_conn" >> $TMP
echo "var_ip4=$var_ip4" >> $TMP
echo "var_ip6=$var_ip6" >> $TMP
echo "var_vpn=$var_vpn" >> $TMP
echo "var_ns=$var_ns" >> $TMP
else # certain variables given, so only update these variables' values (avoids overlaps, esp. if status-misc.sh needs longer to be executed)
NO=$#
for ((i = 1; i <= $NO; i++)); do
VAR_NAME=${!i} # variable name
VAR_VAL=${!VAR_NAME} # value of the variable's name
if [ $(grep -q "^$VAR_NAME=" $TMP; echo $?) == 0 ] ; then # variable already exists in status file
sed -Ei "s/^$VAR_NAME=.*/$VAR_NAME=$VAR_VAL/" $TMP
else
echo "$VAR_NAME=$VAR_VAL" >> $TMP
fi
done
fi
}