|
@@ -733,6 +733,99 @@ function set_tls_time_source {
|
733
|
733
|
esac
|
734
|
734
|
}
|
735
|
735
|
|
|
736
|
+function set_static_IP {
|
|
737
|
+ STATIC_IP='192.168.1.60'
|
|
738
|
+ STATIC_GATEWAY='192.168.1.1'
|
|
739
|
+ NEW_STATIC_IP=
|
|
740
|
+ NEW_STATIC_GATEWAY=
|
|
741
|
+ if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
|
742
|
+ STATIC_IP=$(cat /etc/network/interfaces | grep "address " | awk -F ' ' '{print $2}' | head -n 1)
|
|
743
|
+ STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | awk -F ' ' '{print $2}' | head -n 1)
|
|
744
|
+ fi
|
|
745
|
+
|
|
746
|
+ # get the IP for the box
|
|
747
|
+ data=$(tempfile 2>/dev/null)
|
|
748
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
749
|
+ dialog --title $"Set a static local IP address" \
|
|
750
|
+ --backtitle $"Freedombone Control Panel" \
|
|
751
|
+ --inputbox $"In order to forward incoming internet traffic to this system most internet routers need to know a static local IP address to send the data to.\n\n
|
|
752
|
+Enter a static local IP address for this system.\n\nIt will typically be 192.168.1.x" 15 60 "$STATIC_IP" 2>$data
|
|
753
|
+ sel=$?
|
|
754
|
+ case $sel in
|
|
755
|
+ 0) NEW_STATIC_IP=$(<$data)
|
|
756
|
+ if [[ "$NEW_STATIC_IP" != *"."* ]]; then
|
|
757
|
+ return
|
|
758
|
+ fi
|
|
759
|
+ if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
|
760
|
+ if [[ "$NEW_STATIC_IP" != "$STATIC_IP" ]]; then
|
|
761
|
+ sed -i "s|${STATIC_IP}|${NEW_STATIC_IP}|g" /etc/network/interfaces
|
|
762
|
+ fi
|
|
763
|
+ fi
|
|
764
|
+ ;;
|
|
765
|
+ esac
|
|
766
|
+
|
|
767
|
+ # get the gateway
|
|
768
|
+ data=$(tempfile 2>/dev/null)
|
|
769
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
770
|
+ dialog --title $"Set the IP address of your internet router/modem" \
|
|
771
|
+ --backtitle $"Freedombone Control Panel" \
|
|
772
|
+ --inputbox $"Set the local IP address for your internet router or ADSL modem.\n\nIt will typically be 192.168.1.1, 192.168.1.254, or similar" 12 60 "$STATIC_GATEWAY" 2>$data
|
|
773
|
+ sel=$?
|
|
774
|
+ case $sel in
|
|
775
|
+ 0) NEW_STATIC_GATEWAY=$(<$data)
|
|
776
|
+ if [[ "$NEW_STATIC_GATEWAY" != *"."* ]]; then
|
|
777
|
+ return
|
|
778
|
+ fi
|
|
779
|
+ if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
|
780
|
+ if [[ "$NEW_STATIC_GATEWAY" != "$STATIC_GATEWAY" ]]; then
|
|
781
|
+ sed -i "s|${STATIC_GATEWAY}|${NEW_STATIC_GATEWAY}|g" /etc/network/interfaces
|
|
782
|
+ fi
|
|
783
|
+ return
|
|
784
|
+ fi
|
|
785
|
+ ;;
|
|
786
|
+ esac
|
|
787
|
+
|
|
788
|
+ if ! grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
|
789
|
+ if [ "$NEW_STATIC_GATEWAY" && "$NEW_STATIC_IP" ]; then
|
|
790
|
+ echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
|
|
791
|
+ echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
|
|
792
|
+ echo '' >> /etc/network/interfaces
|
|
793
|
+ echo '# The loopback network interface' >> /etc/network/interfaces
|
|
794
|
+ echo 'auto lo' >> /etc/network/interfaces
|
|
795
|
+ echo 'iface lo inet loopback' >> /etc/network/interfaces
|
|
796
|
+ echo '' >> /etc/network/interfaces
|
|
797
|
+ echo '# The primary network interface' >> /etc/network/interfaces
|
|
798
|
+ echo 'auto eth0' >> /etc/network/interfaces
|
|
799
|
+ echo 'iface eth0 inet static' >> /etc/network/interfaces
|
|
800
|
+ echo " address ${NEW_STATIC_IP}" >> /etc/network/interfaces
|
|
801
|
+ echo ' netmask 255.255.255.0' >> /etc/network/interfaces
|
|
802
|
+ echo " gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces
|
|
803
|
+ echo " dns-nameservers 213.73.91.35 85.214.20.141" >> /etc/network/interfaces
|
|
804
|
+ echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
|
|
805
|
+ echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
|
|
806
|
+ echo '' >> /etc/network/interfaces
|
|
807
|
+ echo '# The secondary network interface' >> /etc/network/interfaces
|
|
808
|
+ echo '#auto eth1' >> /etc/network/interfaces
|
|
809
|
+ echo '#iface eth1 inet dhcp' >> /etc/network/interfaces
|
|
810
|
+ echo '' >> /etc/network/interfaces
|
|
811
|
+ echo '# WiFi Example' >> /etc/network/interfaces
|
|
812
|
+ echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces
|
|
813
|
+ echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces
|
|
814
|
+ echo '# wpa-ssid "essid"' >> /etc/network/interfaces
|
|
815
|
+ echo '# wpa-psk "password"' >> /etc/network/interfaces
|
|
816
|
+ echo '' >> /etc/network/interfaces
|
|
817
|
+ echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces
|
|
818
|
+ echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces
|
|
819
|
+ echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces
|
|
820
|
+ echo '#iface usb0 inet static' >> /etc/network/interfaces
|
|
821
|
+ echo '# address 192.168.7.2' >> /etc/network/interfaces
|
|
822
|
+ echo '# netmask 255.255.255.0' >> /etc/network/interfaces
|
|
823
|
+ echo '# network 192.168.7.0' >> /etc/network/interfaces
|
|
824
|
+ echo '# gateway 192.168.7.1' >> /etc/network/interfaces
|
|
825
|
+ fi
|
|
826
|
+ fi
|
|
827
|
+}
|
|
828
|
+
|
736
|
829
|
function menu_backup_restore {
|
737
|
830
|
while true
|
738
|
831
|
do
|
|
@@ -885,7 +978,7 @@ function menu_top_level {
|
885
|
978
|
trap "rm -f $data" 0 1 2 5 15
|
886
|
979
|
dialog --backtitle $"Freedombone Control Panel" \
|
887
|
980
|
--title $"Control Panel" \
|
888
|
|
- --radiolist $"Choose an operation:" 22 70 15 \
|
|
981
|
+ --radiolist $"Choose an operation:" 23 70 16 \
|
889
|
982
|
1 $"Backup and Restore" off \
|
890
|
983
|
2 $"Show SIP Phone Extensions" off \
|
891
|
984
|
3 $"Reset Tripwire" off \
|
|
@@ -897,10 +990,11 @@ function menu_top_level {
|
897
|
990
|
9 $"Media menu" off \
|
898
|
991
|
10 $"Change the name of this system" off \
|
899
|
992
|
11 $"Set the TLS date/time source" off \
|
900
|
|
- 12 $"Check for updates" off \
|
901
|
|
- 13 $"Power off the system" off \
|
902
|
|
- 14 $"Restart the system" off \
|
903
|
|
- 15 $"Exit" on 2> $data
|
|
993
|
+ 12 $"Set a static local IP address" off \
|
|
994
|
+ 13 $"Check for updates" off \
|
|
995
|
+ 14 $"Power off the system" off \
|
|
996
|
+ 15 $"Restart the system" off \
|
|
997
|
+ 16 $"Exit" on 2> $data
|
904
|
998
|
sel=$?
|
905
|
999
|
case $sel in
|
906
|
1000
|
1) exit 1;;
|
|
@@ -918,10 +1012,11 @@ function menu_top_level {
|
918
|
1012
|
9) menu_media;;
|
919
|
1013
|
10) change_system_name;;
|
920
|
1014
|
11) set_tls_time_source;;
|
921
|
|
- 12) check_for_updates;;
|
922
|
|
- 13) shut_down_system;;
|
923
|
|
- 14) restart_system;;
|
924
|
|
- 15) break;;
|
|
1015
|
+ 12) set_static_IP;;
|
|
1016
|
+ 13) check_for_updates;;
|
|
1017
|
+ 14) shut_down_system;;
|
|
1018
|
+ 15) restart_system;;
|
|
1019
|
+ 16) break;;
|
925
|
1020
|
esac
|
926
|
1021
|
done
|
927
|
1022
|
}
|