home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- ende() {
- IP=`cat /tmp/ip`
-
- if [ -r /tmp/fail ]
- then
- dialog --clear --title "Finish installation" --msgbox \
- "\nCongratulations!\n
- You probably installed Server-on-CD successfully. But with the
- automatical network check no workstation with fitting IP-number
- could be found. Please check the network wiring and the network
- settings at the workstations (Start -> Settings -> Control Panel
- -> Network). Further information can be found in the help-files
- on the CD - see per webbrowser." 15 74
-
- else
- dialog --clear --title "Finish installation" --msgbox \
- "\nCongratulations!\n
- You installed Server-on-CD successfully. The further required
- configurations are to enter at one of the connected workstations.
- Therefore please enter into the address line of the webbrowser of
- the workstation the following IP-number:
- http://$IP:150" 15 72
- fi
-
- rm /tmp/{setup.*,ip,ipnr,pass,fail} 2>&1 1>&/dev/null
-
- startdienste
-
- setterm -default
- setterm -blank 15
- }
-
-
- dhcp()
- {
- dialog --clear --title "DHCP IP-Numbers" --inputbox \
- "\nPlease enter the IP-number for your DHCP-server or press <ENTER>
- for the IP-number 192.168.0.1. The third group of figures
- (default=0) defines the network scope for the DHCP-Server, the
- fourth group of figures (default=1) defines the number of the
- server. The first group of figures should sound in \"192\", the
- second in \"168\".\n\n" 20 72 "192.168.0.1" 2>/tmp/setup.$$
- antwort=$?
-
-
- if [ $antwort -eq 0 ]
- then
- if [ -z `cat /tmp/setup.$$` ]
- then
- /sbin/ifconfig eth0 192.168.0.1 2>&1 1>&/dev/null
- echo -n "192.168.0.1" >/etc/IPNR
- echo " 0" >>/etc/IPNR
- echo "ddns-update-style ad-hoc;" >/etc/dhcpd.conf
- echo "subnet $IPNR netmask 255.255.255.0 {" >>/etc/dhcpd.conf
- echo " range 192.168.0.2 192.168.0.254;">>/etc/dhcpd.conf
- echo "max-lease-time 2419200;">>/etc/dhcpd.conf
- echo "default-lease-time 2419200;">>/etc/dhcpd.conf
- echo "}">>/etc/dhcpd.conf
- echo "option netbios-node-type 1;">>/etc/dhcpd.conf
- echo "option routers 192.168.0.1;">>/etc/dhcpd.conf
- echo "option domain-name-servers 192.168.0.1;">>/etc/dhcpd.conf
-
- else
-
- /bin/testip `cat /tmp/setup.$$`
- if [ $? -ne 0 ]
- then
- fehlernetz
- return 1
- fi
-
- IP=`cat /tmp/setup.$$`
- echo $IP >/tmp/ip
- NET=`awk -F. '{print $1"."$2"."$3}' /tmp/setup.$$`
-
- /sbin/ifconfig eth0 $IP up 2>&1 1>&/dev/null
-
- IPNET=`awk -F. '{print $4+0}' /tmp/setup.$$`
-
- if [ $IPNET -lt 3 ]
- then
- IPMI=3
- IPMA=254
- elif [ $IPNET -gt 253 ]
- then
- IPMI=1
- IPMA=253
- else
- MAX2=`expr $IPNET - 1`
- MIN2=`expr $IPNET + 1`
- fi
-
- echo -n $IP >/etc/IPNR
- echo " 0" >>/etc/IPNR
-
- echo "ddns-update-style ad-hoc;" >/etc/dhcpd.conf
- echo "subnet $NET.0 netmask 255.255.255.0 {" >>/etc/dhcpd.conf
-
- if [ $MAX2 -lt $IPNET ]
- then
- echo " range $NET.1 $NET.$MAX2;" >> /etc/dhcpd.conf
- echo " range $NET.$MIN2 $NET.254;" >> /etc/dhcpd.conf
- else
- echo " range $NET.$IPMI $NET.$IPMA;">>/etc/dhcpd.conf
- fi
-
- echo "max-lease-time 2419200;">>/etc/dhcpd.conf
- echo "default-lease-time 2419200;">>/etc/dhcpd.conf
- echo "}">>/etc/dhcpd.conf
- echo "option netbios-node-type 1;">>/etc/dhcpd.conf
- echo "option routers $IP;">>/etc/dhcpd.conf
- echo "option domain-name-servers $IP;">>/etc/dhcpd.conf
- fi
- else
- /etc/rc.d/rc.install.en
- exit
- fi
-
- /usr/bin/dhcpd 2>&1 1>&/dev/null
- echo "1" >/etc/DHCP
- passwort
- testpass
- ende
- init 2
- exit
- }
-
- ethkonfig()
- {
- zahl=$1
- IPNR=$2
-
- /sbin/ifconfig eth$zahl $IPNR up 2>&1 1>&/dev/null
-
- if [ $? -ne 0 ]
- then
- return 0
- fi
-
- echo -n $IPNR >/etc/IPNR
-
- dialog --title "Checking netconfiguration" --infobox "\n\n Please wait..." 8 72
-
- sleep 1
-
- /usr/bin/myping $IPNR
-
- if [ $? -ne 0 ]
- then
- /sbin/ifconfig eth$zahl 10.0.0.$(($zahl+1)) 2>&1 1>&/dev/null
- return 0
- else
- echo " $zahl" >>/etc/IPNR
- return 1
- fi
- }
-
- fehlerpass()
- {
- dialog --clear --title "Password" --inputbox \
- "\nThe selected password is too short. It has to feature at
- least four symbols." 20 72 2>/tmp/setup.$$
- antwort=$?
- testpass
- }
-
-
- passwort()
- {
- dialog --clear --title "Password for Server-on-CD" --inputbox \
- "\nPlease enter a password for the administrator. The password
- is required to modify the system settings. Is has to feature at
- least four symbols. It may be composed of only figures and
- letters. You are able to later modify the password at a
- workstation.\n" 20 72 2>/tmp/setup.$$
- antwort=$?
-
-
-
-
- if [ $antwort -eq 1 ]
- then
- until netz
- do foo
- done
- passwort
- testpass
- return
- fi
-
- }
-
- testpass()
- {
- COUNT=$(wc -c </tmp/setup.$$)
- if [ $COUNT -lt 4 ]
- then
- fehlerpass $IPNR 1
- unset COUNT
- return 1
- fi
- unset COUNT
- writepass
- }
-
- writepass()
- {
- echo -n "root:" > /tmp/pass
- cat /tmp/setup.$$ >> /tmp/pass
- echo -e "" >> /tmp/pass
- chpasswd </tmp/pass
- /usr/bin/htpasswd -bc /etc/apache/passwd supervisor `cat /tmp/setup.$$` 2>&1 1>&/dev/null
- rm /tmp/setup.$$
- rm /tmp/pass
- }
-
- fehlernetz()
- {
- dialog --clear --title "Wrong input" --msgbox \
- "\nThe selected IP-Number is invalid. Please mind the format
- information.\n" 10 72
- }
-
-
- testnetz()
- {
- if [ ! -r /tmp/setup.$$ ]
- then
- fehlernetz
- fi
- IPNR=`awk -F. '{print $1+0"."$2+0"."$3+0"."$4+0}' /tmp/setup.$$`
- echo $IPNR >/tmp/ipnr
-
- /bin/testip -a $IPNR
- if [ $? -ne 0 ]
- then
- fehlernetz
- return 1
- fi
-
- for i in 0 1 2 3
- do
- ethkonfig $i $IPNR
- rueck=$?
- if [ $rueck -eq 1 ]
- then
- break
- fi
- done
-
- if [ $rueck -eq 0 ]
- then
- dialog --title "Attention" --menu "\n
- The network does not answer. Maybe no any other PCs with
- fitting IP-numbers are attached or switched-on. Fitting
- IP-numbers match within the first three figures.
- Please select:\n" 17 72 2 \
- "1" "Continue configuration" \
- "2" "Re-execute the network configuration" 2>/tmp/setup.$$
- antwort=$?
-
-
-
-
- if [ $antwort = 0 ]
- then
- ANTWORT=`cat /tmp/setup.$$`
- case $ANTWORT in
- 2) netz
- return ;;
- 1) /sbin/ifconfig eth0 $IPNR
- echo -n $IPNR >/etc/IPNR
- echo -e "1" >/tmp/fail
- echo " 0" >>/etc/IPNR ;;
-
- esac
- else
- netz
- return
- fi
- fi
-
- return 0
- }
-
-
- netzwerk()
- {
- dialog --clear --title "IP-number of the servers" --inputbox \
- "\nPlease enter \"DHCP\" for the auto-installation of Server-on-CD.
- Otherwise please enter the IP-number for this PC. The format has
- to be: 192.168.x.y (x=0-255, y=1-254). The value for x must be
- the same with all PCs in the network, the value for y must be
- unique. If you did not enter any IP-number in the network, we
- suggest 192.168.0.1 (default) for the fist workstation, for the
- second 192.168.0.2 and so on.\n\n" 20 72 "DHCP" \
- 2>/tmp/setup.$$
-
-
- antwort=$?
- if [ $antwort -eq 0 ]
- then
- cp /tmp/setup.$$ /tmp/ip
- else
- /etc/rc.d/rc.install.en
- exit
- fi
- }
-
- netz()
- {
- netzwerk
- if [ `grep -i -c "dhcp" /tmp/ip` -eq 1 ]
- then
- dhcp
- else
- testnetz
- if [ $? -ne 0 ]
- then
- return 1
- fi
- fi
- }
-
- foo()
- {
- return
- }
-
- startdienste()
- {
- /usr/sbin/apachectl start 2>&1 1>&/dev/null
- /usr/sbin/smbd -D -s /etc/samba/smb.conf 2>&1 1>&/dev/null
- /usr/sbin/nmbd -D -s /etc/samba/smb.conf 2>&1 1>&/dev/null
- }
-
- dialog --clear --title "Server-on-CD" --msgbox \
- "\nWelcome to your new Server-on-CD. Below you have to enter some
- specifications. After the successful installation you can
- administrate the server from any workstation in the network. This
- workstation only needs an actual webbrowser with activated
- Java-Script." 15 72
-
- cd /mnt/C 2>&1 1>&/dev/null
- if [ ! -d socd ]
- then
- mkdir socd 2>&1 1>&/dev/null
- fi
-
- until netz
- do
- foo
- done
-
- passwort
- testpass
- ende
-
- if [ -e /etc/DHCP ]
- then
- if [ `cat /etc/DHCP` -eq 1 ]
- then
- /usr/bin/dhcpd
- fi
- fi
-
-
-
-
-
-
-
-