#!/bin/sh # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list DHCP_USED="no" # "/etc/sysconfig/network/ifconfig.lo" file creation cat > /etc/sysconfig/network/ifconfig.lo << "EOF" && ONBOOT="yes" BOOTPROTO="static" IPADDR="127.0.0.1" PREFIX_LENGTH=8 IFSCOPE="scope host" EOF LOOP_INDEX="0" for nic_device in ${INTERFACES}; do file="/etc/sysconfig/network/ifconfig.${nic_device}" echo "ONBOOT=\"yes\"" >> ${file} && echo "BOOTPROTO=\"${BOOTPROTO[${LOOP_INDEX}]}\"" >> ${file} && echo "IPADDR=\"${IP_ADDRESS[${LOOP_INDEX}]}\"" >> ${file} && echo "PREFIX_LENGTH=\"${PREFIX_LENGTH[${LOOP_INDEX}]}\"" >> ${file} && echo "IFSCOPE=\"\"" >> ${file} && evaluate_retval if [ x${BOOTPROTO[${LOOP_INDEX}]} == "xdhcp" ]; then GATEWAY="" DHCP_USED="yes" fi LOOP_INDEX=$((${LOOP_INDEX} + 1)) done # "/etc/sysconfig/network/network-parameters" file creation echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters && echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters && echo "DEFAULT_HOSTNAME=\"${MACHINE_NAME}.${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters && echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters && echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters && echo "GATEWAY=\"${GATEWAY}\"" >> /etc/sysconfig/network/network-parameters && cat >> /etc/sysconfig/network/network-parameters << EOF && # On which network interface(s) to activate the DHCP server. # Leave empty or comment the line to disable the DHCP server. #DHCP_SERVER_IF="eth0" # Set to "yes" to enable the NFS server: NFS_SERVER_ENA="no" # Set FIREWALL_ENA to "yes" to enable the firewall: FIREWALL_ENA="no" # Set FIREWALL_LAN to the ethernet interface connected to the internal LAN: FIREWALL_LAN="eth0" # Set FIREWALL_WWW to the ethernet interface connected to the outside world (internet): FIREWALL_WWW="eth1" EOF # "/etc/resolv.conf" file if [ x${DHCP_USED} == "xno" ]; then if [ -f /etc/resolv.conf ]; then rm -f /etc/resolv.conf || exit 1 fi touch /etc/resolv.conf && for i in $(seq 0 $((${#NAMESERVER[@]} - 1))); do echo "nameserver ${NAMESERVER[i]}" >> /etc/resolv.conf || exit 1 done chmod 644 /etc/resolv.conf evaluate_retval fi # /etc/hosts file echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts evaluate_retval if [ x${DHCP_USED} == "xno" ]; then echo "${IP_ADDRESS[0]} ${MACHINE_NAME}.${DOMAIN} ${MACHINE_NAME}" >> /etc/hosts || exit 1 fi chmod 644 /etc/hosts && # Clock settings cat > /etc/sysconfig/clock << "EOF" && UTC=1 EOF # Keyboard settings cat > /etc/sysconfig/keyboard << "EOF" && # Keyboard language: us, cf, fr, etc. KEYBOARD=us EOF # Replacing 'KEYBOARD=us' entry with appropriate keyboard layout specified by user in sysinfos if [ "x${KEYBOARD}" != "x" ]; then sed -i s/KEYBOARD=us/KEYBOARD=${KEYBOARD}/ /etc/sysconfig/keyboard || exit 1 fi # Copying boot scripts STAGE2_BOOTSCRIPTS="functions rc checkfs cleanfs dhcp halt ifdown ifup initlog keyboard modules mountfs \ mountkernfs mountnetfs network nfs portmap reboot sendsignals setclock sshd swap sysklogd udev udev_retry" mkdir -p /etc/rc.d/init.d && for bootscript in ${STAGE2_BOOTSCRIPTS}; do cp -a -f bootscripts/${bootscript} /etc/rc.d/init.d || exit 1 done && # Creating runlevels links for level in S 0 1 2 3 4 5 6; do dir=/etc/rc.d/rc${level}.d if [ -d ${dir} ]; then # Removing old links rm -f ${dir}/* || exit 1 else # Creating basic directory structure mkdir -v -p ${dir} || exit 1 fi done && # rcS.d bootscript_add_rcS initlog 05 00 && bootscript_add_rcS mountkernfs 10 00 && bootscript_add_rcS modules 15 00 && bootscript_add_rcS udev 20 00 && bootscript_add_rcS swap 25 94 && bootscript_add_rcS checkfs 30 00 && bootscript_add_rcS mountfs 35 95 && bootscript_add_rcS cleanfs 40 00 && bootscript_add_rcS udev_retry 45 00 && bootscript_add_rcS sysklogd 50 93 && bootscript_add_rcS keyboard 55 00 && bootscript_add_rcS setclock 60 92 && # rc0.d bootscript_add_manual 0 sendsignals 95 00 && bootscript_add_manual 0 halt 99 00 && # rc3.d bootscript_add_rc3 network 05 80 && bootscript_add_rc3 portmap 10 75 && bootscript_add_rc3 nfs 15 74 && bootscript_add_rc3 dhcp 20 73 && bootscript_add_rc3 sshd 25 70 && bootscript_add_rc3 mountnetfs 30 10 && # rc6.d is almost identical to rc0.d bootscript_add_manual 6 sendsignals 95 00 && bootscript_add_manual 6 reboot 99 00 && chown -R root:root /etc/rc.d /etc/sysconfig # Return last error exit $?