Update of /cvsroot/devil-linux/build/scripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22625/scripts/scripts
Modified Files:
Tag: rel-1-2-patches
setup
Log Message:
I was getting tired of configuring NTP manually! :-)
Index: setup
===================================================================
RCS file: /cvsroot/devil-linux/build/scripts/scripts/setup,v
retrieving revision 1.20.2.3
retrieving revision 1.20.2.4
diff -u -d -r1.20.2.3 -r1.20.2.4
--- setup 2 May 2005 14:03:21 -0000 1.20.2.3
+++ setup 25 Jul 2005 20:20:33 -0000 1.20.2.4
@@ -19,6 +19,7 @@
CONFIG="/etc/sysconfig/config"
DHCPDCONF="/etc/dhcpd.conf"
NICDIR="/etc/sysconfig/nic"
+NTPCONF="/etc/ntp.conf"
INITDIR="/etc/init.d"
RESOLVE="/etc/resolv.conf"
RESULT="/tmp/setup-result"
@@ -849,6 +850,42 @@
done
}
+setupother () {
+ NETDEF="NTP"
+ NTPSERVER=""
+ for n in $(tail -n1 $NTPCONF|grep -i "^server "|grep -v " 127\.")
+ do
+ NTPSERVER=$n
+ done
+ while true; do
+ $DIALOG $BACKLAB --title "Other Services Menu" --backtitle "$BACKTITLE" \
+ --default-item "$NETDEF" \
+ --menu "Navigate with the arror keys, and press ENTER to select" 0 0 0 \
+ 'NTP' '--> Setup the NTP (time) Service ' \
+ 2> $RESULT
+ RETURN=$?
+ NETDEF="$(cat $RESULT)"
+ if [ $RETURN -eq 0 ]; then
+ case $NETDEF in
+ NTP)
+ inputbox "NTP" "Enter your NTP server name or IP" "$NTPSERVER" && \
+ eval NTPSERVER="$(cat $RESULT)"
+ if [ $(tail -n1 $NTPCONF|grep -i "^server "|grep -v " 127\."|wc -l) -eq 1 ]; then
+ let l=$(cat $NTPCONF|wc -l)-1
+ cp -a $NTPCONF ${NTPCONF}.temp
+ chmod u+w $NTPCONF ${NTPCONF}.temp
+ head -n$l ${NTPCONF}.temp > ${NTPCONF}
+ fi
+ [ ${#NTPSERVER} -gt 0 ] && echo "server $NTPSERVER" >> $NTPCONF
+ ;;
+ esac
+ else
+ return
+ fi
+
+ done
+}
+
# The main menu seen when program is first started.
mainmenu() {
MAINDEF="Basic"
@@ -861,6 +898,7 @@
'Services' '--> Select which services are started on boot ' \
'NET' '--> Setup network cards and firewalling ' \
'DHCP' '--> Configure a basic DHCP server on your Internal network ' \
+ 'Other' '--> Configure other services ' \
'LoginPW' "Change ${USER}'s login password " \
'Config' '--> Save your configuration ' \
2> $RESULT
@@ -871,10 +909,6 @@
Basic)
configmenu
;;
-# Packages)
-# echo -en "\n\nLoading all packages, please wait ..."
-# packages
-# ;;
Services)
echo -en "\n\nLoading all services, please wait ..."
startservices
@@ -882,6 +916,9 @@
NET)
setupnetworking
;;
+ Other)
+ setupother
+ ;;
DHCP)
# dhcpserver 1
# above only is valid, if dhcpd should be running on eth1.
|