String padding
This commit is contained in:
parent
d29885ebbc
commit
8ed901bac4
|
@ -114,72 +114,77 @@ function add_user {
|
|||
fi
|
||||
}
|
||||
|
||||
function pad_string {
|
||||
echo -n -e "$1" | sed -e :a -e 's/^.\{1,15\}$/& /;ta'
|
||||
}
|
||||
|
||||
function show_domains {
|
||||
echo 'Domains'
|
||||
echo '======='
|
||||
echo ''
|
||||
if grep -q "Email onion domain" $COMPLETION_FILE; then
|
||||
echo -n -e 'Email \t'
|
||||
echo -n -e "$(pad_string 'Email')"
|
||||
echo -n -e "$(pad_string '')"
|
||||
echo "$(cat ${COMPLETION_FILE} | grep 'Email onion domain' | awk -F ':' '{print $2}')"
|
||||
fi
|
||||
if grep -q "Wiki domain" $COMPLETION_FILE; then
|
||||
echo -n -e 'Wiki \t'
|
||||
echo -n "$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')"
|
||||
echo -n -e '\t'
|
||||
echo -n -e "$(pad_string 'Wiki')"
|
||||
WIKIDOM=$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${WIKIDOM})"
|
||||
if [ -d /var/lib/tor/hidden_service_wiki ]; then
|
||||
echo -n "$(cat /var/lib/tor/hidden_service_wiki/hostname)"
|
||||
fi
|
||||
echo ''
|
||||
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'
|
||||
echo -n -e "$(pad_string 'Hubzilla')"
|
||||
HUBZILLADOM=$(cat ${COMPLETION_FILE} | grep 'Hubzilla domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${HUBZILLADOM})"
|
||||
if [ -d /var/lib/tor/hidden_service_hubzilla ]; then
|
||||
echo -n "$(cat /var/lib/tor/hidden_service_hubzilla/hostname)"
|
||||
fi
|
||||
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'
|
||||
echo -n -e "$(pad_string 'Blog')"
|
||||
BLOGDOM=$(cat ${COMPLETION_FILE} | grep 'Blog domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${BLOGDOM})"
|
||||
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'
|
||||
echo -n -e "$(pad_string 'GNU Social')"
|
||||
GNUSOCIALDOM=$(cat ${COMPLETION_FILE} | grep 'GNU Social domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${GNUSOCIALDOM})"
|
||||
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'
|
||||
echo -n -e "$(pad_string 'Owncloud')"
|
||||
OWNCLOUDDOM=$(cat ${COMPLETION_FILE} | grep 'Owncloud domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${OWNCLOUDDOM})"
|
||||
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'
|
||||
echo -n -e "$(pad_string 'Gogs')"
|
||||
GOGSDOM=$(cat ${COMPLETION_FILE} | grep 'Gogs domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${GOGSDOM})"
|
||||
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'
|
||||
echo -n -e "$(pad_string 'XMPP')"
|
||||
XMPPDOM=$(cat ${COMPLETION_FILE} | grep 'XMPP domain' | awk -F ':' '{print $2}')
|
||||
echo -n -e "$(pad_string ${XMPPDOM})"
|
||||
if [ -d /var/lib/tor/hidden_service_xmpp ]; then
|
||||
echo -n "$(cat /var/lib/tor/hidden_service_xmpp/hostname)"
|
||||
fi
|
||||
|
@ -195,7 +200,7 @@ function show_users {
|
|||
for d in /home/*/ ; do
|
||||
USRNAME=$(echo "$d" | awk -F '/' '{print $3}')
|
||||
if [[ $USRNAME != "git" ]]; then
|
||||
echo -n "$USRNAME"
|
||||
echo -n -e "$(pad_string '${USRNAME}')"
|
||||
# get the SIP extension
|
||||
SIPEXT=
|
||||
while read ext; do
|
||||
|
@ -208,16 +213,14 @@ function show_users {
|
|||
fi
|
||||
fi
|
||||
done < $SIP_CONFIG_FILE
|
||||
echo -e -n '\t'
|
||||
if [ $SIPEXT ]; then
|
||||
echo -n "SIP:${SIPEXT}"
|
||||
echo -n -e "$(pad_string 'SIP:${SIPEXT}')"
|
||||
else
|
||||
echo -n -e "$(pad_string '')"
|
||||
fi
|
||||
|
||||
# size of the home directory
|
||||
echo -e -n '\t'
|
||||
echo -n "$(du -s -h /home/${USRNAME} | awk -F ' ' '{print $1}')"
|
||||
|
||||
echo ''
|
||||
echo "$(du -s -h /home/${USRNAME} | awk -F ' ' '{print $1}')"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue