Some changes...

From: Marcel Ritter (Marcel.Ritter_at_rrze.uni-erlangen.de)
Date: Mon Oct 22 2001 - 11:13:01 CEST


Date: Mon, 22 Oct 2001 11:13:01 +0200 (MET DST)
From: Marcel Ritter <Marcel.Ritter@rrze.uni-erlangen.de>
Message-Id: <Pine.SOL.3.96.1011022110410.16601C-300000@cssun.rrze.uni-erlangen.de>
Subject: Some changes...

Hi again!

After some busy time I eventually found the time to check the newest (?)
alice release shipped with SuSE 7.3.

Some things are a little broken - so perhaps you could fix them:

bin/wait4_info_file should be renamed to bin/wait4_floppy_remove or at
least the script called in bin/make_all should be the same as the file
(currently not the case!)

Added some extra line to make_staticip (to get nice entries in
/etc/rc.config)

And once again I'd like to apply a very simple patch, that will allow
users to execute an arbitrary script at the end of installation that can
be as simple as:

<REAL_POST_SCRIPT>

echo "Hello world" > /tmp/I_WAS_HERE

</REAL_POST_SCRIPT>

(Any bash code should be possible here! People that have subscribed to
this list may remember this ...)

(I attached the changed make_all/make_staticip)

Ciao,
  Marcel

PS: Once again the bootdisk of SuSE 7.3 does not support DHCP installation
    - I already sent a mail to feedback@suse.de and hope this will be
    fixed ASAP.



#!/bin/sh
#
# $Id: make_all,v 1.47 2001/08/17 15:40:04 hernst Exp $
#
# ALICE
# Automatic Linux Installation and Configuration Environment
#
#############################################################################
#
# Copyright (c) 2000 SuSE Linux Solutions AG, Eschborn, Germany
# All rights reserved.
#
# This file is part of ALICE, which was sponsored by
# T-Online International AG
#
# Author: Fabian Herschel
#
#############################################################################
#
# make_all
# Master script
# starts them all :)
#
usage()
{
   echo "$_self -h | --help | -?"
   echo "$_self -fqhn"
}

# run SuSEconfig for those people who are in hurry and pressed ENTER,
# because they don't want SuSEconfig on Console 9 to be finished :-)
/sbin/SuSEconfig --module hostname

. /etc/rc.config
return=$rc_done

alice_dir=$(cd $(dirname $0)/..; pwd)
export alice_dir

# uncomment the following line, if you want make_all to show which
# files are searched...
# export CFG_DEBUG="--debug"


while [ $# -gt 0 ]
do
   case $1 in
       -h | --help | -? ) usage
                          exit 1
                          ;;
       --fqhn | -fqhn ) export fqhn=$2; shift
            ;;
   esac
   shift
done

. $alice_dir/lib/alicerc2 2>&1

aquire_config_files

. $alice_dir/lib/alicerc 2>&1
WELCOME | tee -a $alice_log_file
export PATH="${alice_bin_dir}:$PATH"
GET_CONFIGURATION sys $CFG_DEBUG
############################################################################
# And now we begin
#
# FH: do NOT source make files, because of the side effects
# (exit in make_goup exists make_all if make_group is sourced)
#. ${alice_bin_dir}/make_groups # Create groups
#
############################################################################
#
# MODULE_LIST: each cmd to be called must have a separate line!
# the line is truncated at the first position of a hash (#)!!!
# So something like 'echo "# this is a comment"' will be
# truncated to 'echo '.
#
MODULE_LIST="\
   module_accounts
#
# begin of the system param makes
#
   make_modules
   make_boot
   make_services
   make_syslog
   make_inetd
   make_cron
   make_etc_hosts
   make_dns_client
   make_routes
   make_printer
   make_ssh
#
# begin of the security makes
#
   module_firewall
#
"
#
# applications
#
if [ -n "$SYS_APPLICATION_SCRIPTS" ]; then
   MODULE_LIST="\
     $MODULE_LIST
     #
     # the applications
     #
     $SYS_APPLICATION_SCRIPTS
     #"
fi
#
# add optional special scripts...
#
if [ -n "$ALICE_POST_SCRIPT" ]; then
   MODULE_LIST="\
     $MODULE_LIST
     #
     # and an optional alice post script
     #
     $ALICE_POST_SCRIPT
     #"
fi

#
# end of the MODULE_LIST
#
touch /var/log/alice_state_warn.$$
touch /var/log/alice_state_error.$$
touch /var/log/alice_state_fatal.$$
echo "$MODULE_LIST" | while read CMDLINE
do
  # first truncate from the first hash (#) till the end of the line
  # then split the line into the command and the parameters part
  CMDLINE=${CMDLINE%%#*}
  CMD=$(echo $CMDLINE | ( read A B; echo $A ))
  PARAMS=$(echo $CMDLINE | ( read A B; echo $B ))
  if [ -n "$CMD" ]
  then
          $CMD $PARAMS 2>&1
          last_rc=$?
          case $last_rc in
              0 ) # everything looks well, we have nothing to do :))
                   ;;
              1) # the command gave at least one warning
                   echo $CMD >> /var/log/alice_state_warn.$$
                   ;;
              2) # the command reported at least one error
                   echo $CMD >> /var/log/alice_state_error.$$
                   ;;
              3) # the comand gave up due to a fatal error
                   echo $CMD >> /var/log/alice_state_fatal.$$
                   ;;
              4) # the comand reported a FATAL CONFIGURATION STOP
                   FATAL UNKNWN
                   ;;
             200) # need a reboot NOW (not implemented yet)
                   ;;
             201) # need a reboot after ALICE
           #
           # for some reason variables are not kept beyond the
           # scope of the "while ... do done" statement
           # -> store it in tmp file
                   NEED_REBOOT=yes
          echo -n "${NEED_REBOOT}" > /tmp/NEED_REBOOT.$$

                   ;;
             202) # need a network restart
                   nohup ${alice_bin_dir}/restart_network
                   ;;
          esac
  fi
done | tee -a $alice_log_file

eval "${REAL_POST_SCRIPT}"

#
# retrieve value of NEED_REBOOT from tmp file
#
if [ -f /tmp/NEED_REBOOT.$$ ]
then
   NEED_REBOOT=$(cat /tmp/NEED_REBOOT.$$)
   rm -f /tmp/NEED_REBOOT.$$
else
   NEED_REBOOT=""
fi

cleanup_config_files


#
############################################################################
# That´s all
FATALS=$(cat /var/log/alice_state_fatal.$$)
ERRORS=$(cat /var/log/alice_state_error.$$)
WARNINGS=$(cat /var/log/alice_state_warn.$$)
if [ -n "$FATALS" ]
then
   MESSAGE CONFIGFAILURES "$FATALS" | tee -a $alice_log_file
   return=$rc_failed
fi
if [ -n "$ERRORS" ]
then
   MESSAGE CONFIGERRORS "$ERRORS" | tee -a $alice_log_file
   return=$rc_failed
fi
if [ -n "$WARNINGS" ]
then
   MESSAGE CONFIGWARNINGS "$WARNINGS" | tee -a $alice_log_file
fi
if [ "${NEED_REBOOT}" = "yes" ]
then
   MESSAGE NEEDREBOOT
   #
   # wait until floppy is removed
   #
   wait4_remove_floppy
   shutdown -r now
fi
echo -e "$return"
GOOD_BYE | tee -a $alice_log_file



#!/bin/sh
#
# $Id: make_staticip,v 1.3 2001/08/23 12:58:11 hernst Exp $
#
# ALICE
# Automatic Linux Installation and Configuration Environment
#
# written by Marcel Ritter
# modified by Juergen Henge-Ernst (hernst@suse.de)
#
############################################################################
#
# make_staticip
# Configures static IP adresses from current DHCP setup
#

alice_dir=$(cd $(dirname $0)/..; pwd)
export alice_dir

while [ $# -gt 0 ]
do
   case $1 in
       -h | --help | -? ) usage
                          exit 1
                          ;;
       -fqhn ) export fqhn=$2; shift
            ;;

   esac
   shift
done

. $alice_dir/lib/alicerc

WELCOME

NUM=0
DEFAULT_GW_SET=0
HOSTNAME_SET=0
CHANGE=0

route_conf=/etc/route.conf

# remove the dhcpcd.rc.config, so the new RC_CONFIG_SET will not find the settings there
dhcpcd_conf=/etc/rc.config.d/dhcpcd.rc.config

NETCONFIG_INT=""

test -f ${route_conf} && mv ${route_conf} ${route_conf}.aliceold
test -f ${dhcpcd_conf} && mv ${dhcpcd_conf} ${dhcpcd_conf}.aliceold

for netdev in eth0 eth1 eth2 eth3; do

        if [ -f /var/state/dhcp/dhcpcd-$netdev.info ]; then
                #
                # this file was created by the DHCP client daemon
                #
                . /var/state/dhcp/dhcpcd-$netdev.info

                #
                # Change network setup in /etc/rc.config
                #
                RC_CONFIG_SET IPADDR_$NUM "$IPADDR"
                RC_CONFIG_SET NETDEV_$NUM "$netdev"
                RC_CONFIG_SET IFCONFIG_$NUM "$IPADDR broadcast $BROADCAST netmask $NETMASK up"
                NETCONFIG_INT="$NETCONFIG_INT _$NUM"
                if [ "$HOSTNAME_SET" = "0" ]; then
                        RC_CONFIG_SET FQHOSTNAME "$HOSTNAME.$DOMAIN"
                        HOSTNAME_SET=1
                fi

                echo "$NETWORK 0.0.0.0 $NETMASK $netdev" >> ${route_conf}
                NUM=$[ $NUM +1 ];

                CHANGE=1
        fi
done

#
# apply changes only if there are correct
# values supplied by the DHCP server
#
if [ "$CHANGE" = "1" ]; then
        if [ -n $GATEWAY ]; then
                echo "default $GATEWAY" >> ${route_conf}
        fi

        RC_CONFIG_SET NETCONFIG "$NETCONFIG_INT"
fi

GOOD_BYE



This archive was generated by hypermail 2.1.7 : Wed Jun 25 2003 - 22:19:26 CEST