This commit is contained in:
Bob Mottram 2016-01-03 11:24:10 +00:00
parent 4a9b267a1f
commit c4f02011d5
1 changed files with 110 additions and 16 deletions

View File

@ -114,23 +114,117 @@ function add_user {
fi fi
} }
function show_sip_extensions { function show_domains {
if [ ! -f $SIP_CONFIG_FILE ]; then echo 'Domains'
return; echo '======='
echo ''
if grep -q "Email onion domain" $COMPLETION_FILE; then
echo -n -e 'Email \t'
echo "$(cat ${COMPLETION_FILE} | grep 'Email onion domain' | awk -F ':' '{print $2}')"
fi fi
clear if grep -q "Wiki domain" $COMPLETION_FILE; then
echo $"SIP phone extensions:" echo -n -e 'Wiki \t'
echo " " echo -n "$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')"
while read ext; do echo -n -e '\t'
if [[ $ext == *"user id"* ]]; then if [ -d /var/lib/tor/hidden_service_wiki ]; then
echo -n " " echo -n "$(cat /var/lib/tor/hidden_service_wiki/hostname)"
echo -n $(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}')
echo -n " "
fi fi
if [[ $ext == *"extension"* ]]; then echo ''
echo $(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}') fi
if grep -q "Hubzilla domain" $COMPLETION_FILE; then
echo -n -e 'Hubzilla \t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'Hubzilla domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_hubzilla ]; then
echo -n "$(cat /var/lib/tor/hidden_service_hubzilla/hostname)"
fi fi
done < $SIP_CONFIG_FILE echo ''
fi
if grep -q "Blog domain" $COMPLETION_FILE; then
echo -n -e 'Blog \t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'Blog domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_blog ]; then
echo -n "$(cat /var/lib/tor/hidden_service_blog/hostname)"
fi
echo ''
fi
if grep -q "GNU Social domain" $COMPLETION_FILE; then
echo -n -e 'GNU Social\t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'GNU Social domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_microblog ]; then
echo -n "$(cat /var/lib/tor/hidden_service_microblog/hostname)"
fi
echo ''
fi
if grep -q "Owncloud domain" $COMPLETION_FILE; then
echo -n -e 'Owncloud \t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'Owncloud domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_owncloud ]; then
echo -n "$(cat /var/lib/tor/hidden_service_owncloud/hostname)"
fi
echo ''
fi
if grep -q "Gogs domain" $COMPLETION_FILE; then
echo -n -e 'Gogs \t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'Gogs domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_git ]; then
echo -n "$(cat /var/lib/tor/hidden_service_gogs/hostname)"
fi
echo ''
fi
if grep -q "XMPP domain" $COMPLETION_FILE; then
echo -n -e 'XMPP \t'
echo -n "$(cat ${COMPLETION_FILE} | grep 'XMPP domain' | awk -F ':' '{print $2}')"
echo -n -e '\t'
if [ -d /var/lib/tor/hidden_service_xmpp ]; then
echo -n "$(cat /var/lib/tor/hidden_service_xmpp/hostname)"
fi
echo ''
fi
echo ''
}
function show_users {
echo 'Users'
echo '====='
echo ''
for d in /home/*/ ; do
USRNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $USRNAME != "git" ]]; then
echo -n "$USERNAME"
# get the SIP extension
SIPEXT=
while read ext; do
if [[ $ext == *"user id"* ]]; then
CURR_UID=$(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}')
fi
if [[ $ext == *"extension"* ]]; then
if [[ $CURR_UID == $USRNAME ]]; then
SIPEXT=$(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
fi
fi
done < $SIP_CONFIG_FILE
echo -e -n '\t'
if [ $SIPEXT ]; then
echo -n "SIP:${SIPEXT}"
fi
# size of the home directory
echo -e -n '\t'
echo -n "$(du -s -h /home/${USRNAME} | awk -F ' ' '{print $1}')"
echo ''
fi
done
}
function show_about {
show_domains
show_users
any_key any_key
} }
@ -1242,7 +1336,7 @@ function menu_top_level {
--title $"Control Panel" \ --title $"Control Panel" \
--radiolist $"Choose an operation:" 25 70 18 \ --radiolist $"Choose an operation:" 25 70 18 \
1 $"Backup and Restore" off \ 1 $"Backup and Restore" off \
2 $"Show SIP Phone Extensions" off \ 2 $"About this system" off \
3 $"Reset Tripwire" off \ 3 $"Reset Tripwire" off \
4 $"Logging on/off" off \ 4 $"Logging on/off" off \
5 $"Ping enable/disable" off \ 5 $"Ping enable/disable" off \
@ -1266,7 +1360,7 @@ function menu_top_level {
esac esac
case $(cat $data) in case $(cat $data) in
1) menu_backup_restore;; 1) menu_backup_restore;;
2) show_sip_extensions;; 2) show_about;;
3) reset_tripwire;; 3) reset_tripwire;;
4) logging_on_off;; 4) logging_on_off;;
5) ping_enable_disable;; 5) ping_enable_disable;;