Tidying
This commit is contained in:
parent
d02d8701de
commit
53f105e4eb
|
@ -1870,203 +1870,203 @@ function menu_users {
|
|||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) add_user;;
|
||||
2) delete_user;;
|
||||
3) change_password;;
|
||||
4) change_ssh_public_key;;
|
||||
5) break;;
|
||||
esac
|
||||
done
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) add_user;;
|
||||
2) delete_user;;
|
||||
3) change_password;;
|
||||
4) change_ssh_public_key;;
|
||||
5) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_hubzilla {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Hubzilla" \
|
||||
--radiolist $"Choose an operation:" 13 70 4 \
|
||||
1 $"Set channel directory server" off \
|
||||
2 $"Renew SSL certificate" off \
|
||||
3 $"Back to main menu" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) hubzilla_channel_directory_server;;
|
||||
2) hubzilla_renew_cert;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function menu_hubzilla {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Hubzilla" \
|
||||
--radiolist $"Choose an operation:" 13 70 4 \
|
||||
1 $"Set channel directory server" off \
|
||||
2 $"Renew SSL certificate" off \
|
||||
3 $"Back to main menu" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) hubzilla_channel_directory_server;;
|
||||
2) hubzilla_renew_cert;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_media {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Media Menu" \
|
||||
--radiolist $"Choose an operation:" 13 70 3 \
|
||||
1 $"Attach a drive containing playable media" off \
|
||||
2 $"Remove a drive containing playable media" off \
|
||||
3 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) remove-music
|
||||
attach-music;;
|
||||
2) remove-music;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function menu_media {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Media Menu" \
|
||||
--radiolist $"Choose an operation:" 13 70 3 \
|
||||
1 $"Attach a drive containing playable media" off \
|
||||
2 $"Remove a drive containing playable media" off \
|
||||
3 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) remove-music
|
||||
attach-music;;
|
||||
2) remove-music;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_wifi {
|
||||
hotspot_state=$'off'
|
||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||
hotspot_state=$'on'
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Wifi Menu" \
|
||||
--radiolist $"Choose an operation:" 12 70 4 \
|
||||
1 $"Configure wifi networks" off \
|
||||
2 $"Manually edit wifi networks file" off \
|
||||
3 $"Hotspot settings" off \
|
||||
4 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) wifi_settings;;
|
||||
2) editor $WIFI_NETWORKS_FILE;;
|
||||
3) hotspot_settings;;
|
||||
4) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function menu_wifi {
|
||||
hotspot_state=$'off'
|
||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||
hotspot_state=$'on'
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Wifi Menu" \
|
||||
--radiolist $"Choose an operation:" 12 70 4 \
|
||||
1 $"Configure wifi networks" off \
|
||||
2 $"Manually edit wifi networks file" off \
|
||||
3 $"Hotspot settings" off \
|
||||
4 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) wifi_settings;;
|
||||
2) editor $WIFI_NETWORKS_FILE;;
|
||||
3) hotspot_settings;;
|
||||
4) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_irc {
|
||||
if [ ! -d /etc/ngircd ]; then
|
||||
dialog --title $"IRC Menu" \
|
||||
--msgbox $"No IRC server is installed" 6 70
|
||||
return
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"IRC Menu" \
|
||||
--radiolist $"Choose an operation:" 14 70 4 \
|
||||
1 $"Set a password for all IRC users" off \
|
||||
2 $"Show current IRC login password" off \
|
||||
3 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) irc_set_global_password;;
|
||||
2) irc_show_password;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function menu_irc {
|
||||
if [ ! -d /etc/ngircd ]; then
|
||||
dialog --title $"IRC Menu" \
|
||||
--msgbox $"No IRC server is installed" 6 70
|
||||
return
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"IRC Menu" \
|
||||
--radiolist $"Choose an operation:" 14 70 4 \
|
||||
1 $"Set a password for all IRC users" off \
|
||||
2 $"Show current IRC login password" off \
|
||||
3 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) break;;
|
||||
255) break;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) irc_set_global_password;;
|
||||
2) irc_show_password;;
|
||||
3) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function menu_top_level {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Control Panel" \
|
||||
--radiolist $"Choose an operation:" 29 70 22 \
|
||||
1 $"About this system" off \
|
||||
2 $"Backup and Restore" off \
|
||||
3 $"Reset Tripwire" off \
|
||||
4 $"Logging on/off" off \
|
||||
5 $"Ping enable/disable" off \
|
||||
6 $"Manage Users" off \
|
||||
7 $"Email Filtering Rules" off \
|
||||
8 $"Outgoing Email Proxy" off \
|
||||
9 $"Security Settings" off \
|
||||
10 $"Set the main repository (repo mirrors)" off \
|
||||
11 $"Hubzilla" off \
|
||||
12 $"Media menu" off \
|
||||
13 $"IRC menu" off \
|
||||
14 $"Change your blog avatar" off \
|
||||
15 $"Change the name of this system" off \
|
||||
16 $"Set the TLS date/time source" off \
|
||||
17 $"Set a static local IP address" off \
|
||||
18 $"Wifi menu" off \
|
||||
19 $"Check for updates" off \
|
||||
20 $"Power off the system" off \
|
||||
21 $"Restart the system" off \
|
||||
22 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) show_about;;
|
||||
2) menu_backup_restore;;
|
||||
3) reset_tripwire;;
|
||||
4) logging_on_off;;
|
||||
5) ping_enable_disable;;
|
||||
6) menu_users;;
|
||||
7) menu_email;;
|
||||
8) smtp_proxy;;
|
||||
9) security_settings;;
|
||||
10) set_main_repo;;
|
||||
11) menu_hubzilla;;
|
||||
12) menu_media;;
|
||||
13) menu_irc;;
|
||||
14) change_blog_avatar;;
|
||||
15) change_system_name;;
|
||||
16) set_tls_time_source;;
|
||||
17) set_static_IP;;
|
||||
18) menu_wifi;;
|
||||
19) check_for_updates;;
|
||||
20) shut_down_system;;
|
||||
21) restart_system;;
|
||||
22) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
function menu_top_level {
|
||||
while true
|
||||
do
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Control Panel" \
|
||||
--title $"Control Panel" \
|
||||
--radiolist $"Choose an operation:" 29 70 22 \
|
||||
1 $"About this system" off \
|
||||
2 $"Backup and Restore" off \
|
||||
3 $"Reset Tripwire" off \
|
||||
4 $"Logging on/off" off \
|
||||
5 $"Ping enable/disable" off \
|
||||
6 $"Manage Users" off \
|
||||
7 $"Email Filtering Rules" off \
|
||||
8 $"Outgoing Email Proxy" off \
|
||||
9 $"Security Settings" off \
|
||||
10 $"Set the main repository (repo mirrors)" off \
|
||||
11 $"Hubzilla" off \
|
||||
12 $"Media menu" off \
|
||||
13 $"IRC menu" off \
|
||||
14 $"Change your blog avatar" off \
|
||||
15 $"Change the name of this system" off \
|
||||
16 $"Set the TLS date/time source" off \
|
||||
17 $"Set a static local IP address" off \
|
||||
18 $"Wifi menu" off \
|
||||
19 $"Check for updates" off \
|
||||
20 $"Power off the system" off \
|
||||
21 $"Restart the system" off \
|
||||
22 $"Exit" on 2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
case $(cat $data) in
|
||||
1) show_about;;
|
||||
2) menu_backup_restore;;
|
||||
3) reset_tripwire;;
|
||||
4) logging_on_off;;
|
||||
5) ping_enable_disable;;
|
||||
6) menu_users;;
|
||||
7) menu_email;;
|
||||
8) smtp_proxy;;
|
||||
9) security_settings;;
|
||||
10) set_main_repo;;
|
||||
11) menu_hubzilla;;
|
||||
12) menu_media;;
|
||||
13) menu_irc;;
|
||||
14) change_blog_avatar;;
|
||||
15) change_system_name;;
|
||||
16) set_tls_time_source;;
|
||||
17) set_static_IP;;
|
||||
18) menu_wifi;;
|
||||
19) check_for_updates;;
|
||||
20) shut_down_system;;
|
||||
21) restart_system;;
|
||||
22) break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
if [[ $USER != 'root' ]]; then
|
||||
# show the user version of the control panel
|
||||
freedombone-controlpanel-user
|
||||
exit 0
|
||||
fi
|
||||
if [[ $USER != 'root' ]]; then
|
||||
# show the user version of the control panel
|
||||
freedombone-controlpanel-user
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f $COMPLETION_FILE ]; then
|
||||
echo $'This command should only be run on an installed Freedombone system'
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f $COMPLETION_FILE ]; then
|
||||
echo $'This command should only be run on an installed Freedombone system'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
|
||||
read_repo_servers
|
||||
menu_top_level
|
||||
clear
|
||||
cat /etc/motd
|
||||
exit 0
|
||||
ADMIN_USER=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
|
||||
read_repo_servers
|
||||
menu_top_level
|
||||
clear
|
||||
cat /etc/motd
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue