From: ms Date: Thu, 29 Nov 2007 19:38:08 +0000 (+0000) Subject: Wrote nice initscripts for the installer. X-Git-Tag: v3.0-alpha1~1146 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b96312df10d8dedd82a3a7f7b69d51aa7f559aa;p=people%2Fms%2Fipfire-3.x.git Wrote nice initscripts for the installer. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@1106 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/etc/group b/config/etc/group index 8f7f7a49d..61ae9e25e 100644 --- a/config/etc/group +++ b/config/etc/group @@ -1,30 +1,27 @@ -root:x:0:root -bin:x:1:root,bin,daemon -daemon:x:2:root,bin,daemon -sys:x:3:root,bin -tty:x:5: -disk:x:6:root -lp:x:7:daemon -mem:x:8: -kmem:x:9: -wheel:x:10:root -mail:x:12:mail -uucp:x:14: -dialout:x:16: -floppy:x:19: -tape:x:20: +root:x:0: +bin:x:1: +sys:x:2: +kmem:x:3: +tty:x:4: +tape:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +video:x:12: +utmp:x:13: +usb:x:14: +cdrom:x:15: fcron:x:22: squid:x:23: +mail:x:34: ntp:x:38: -dip:x:40: -mysql:x:41: ftp:x:45: vsftpd:x:47: rsyncd:x:48: sshd:x:50: -stunnel:x:51: -lock:x:54: -pcap:x:77: nobody:x:99: users:x:100: snort:x:101: diff --git a/config/install/group b/config/install/group deleted file mode 100644 index 465a9cf41..000000000 --- a/config/install/group +++ /dev/null @@ -1,4 +0,0 @@ -root:x:0:root -tty:x:5: -disk:x:6: -uucp:x:14: diff --git a/config/install/halt b/config/install/halt index 666c27c64..cc12f3c00 100644 --- a/config/install/halt +++ b/config/install/halt @@ -1,21 +1,56 @@ -#!/bin/sh -# Clear screen -/bin/clear - -echo "Shutting down..." -echo "Sending all processes the TERM signal..." -/bin/killall5 -15 -sleep 3 -echo "Sending all processes the KILL signal..." -/bin/killall5 -9 -sleep 3 -echo "Unmounting filesystems" -/bin/umount /tmp -/bin/umount /sys -/bin/umount /dev/pts -/bin/umount /dev -/bin/umount /root -/bin/umount /proc -echo "Unmounting root" -/bin/mount -n -o remount,ro / -/bin/reboot +#!/bin/ash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +. /etc/functions + + boot_mesg "Unmounting all other currently mounted file systems..." + umount -a -d -r &>/dev/null + evaluate_retval + + + boot_mesg "Sending all processes the TERM signal..." ${WARN} + killall5 -15 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 ]; then + echo_ok + else + echo_failure + fi + + boot_mesg "Sending all processes the KILL signal..." ${ERR} + killall5 -9 + error_value=${?} + + sleep ${KILLDELAY} + + if [ "${error_value}" = 0 ]; then + echo_ok + else + echo_failure + fi + + + boot_mesg "Restarting system..." + reboot -d -f + diff --git a/config/install/inittab b/config/install/inittab index af94321c4..54277ea87 100644 --- a/config/install/inittab +++ b/config/install/inittab @@ -1,10 +1,8 @@ -# System initialization. -::sysinit:/etc/rc - -# Run gettys in standard runlevels -tty1::respawn:/bin/iowrap /dev/tty1 /bin/ash --login -c "/bin/install /dev/tty2" -tty2::respawn:/bin/iowrap /dev/tty2 /bin/ash --login -tty3::respawn:/bin/iowrap /dev/tty3 /bin/ash --login +# a number of shells +tty1::respawn:/sbin/getty -n -i -l /bin/ash 38400 tty1 +tty2::respawn:/sbin/getty -n -i -l /bin/ash 38400 tty2 +tty3::respawn:/sbin/getty -n -i -l /bin/ash 38400 tty3 +tty4::respawn:/sbin/getty -n -i -l /bin/ash 38400 tty4 # Stuff to do before rebooting ::ctrlaltdel:/etc/halt diff --git a/config/install/profile b/config/install/profile index 7f830af6c..905226c48 100644 --- a/config/install/profile +++ b/config/install/profile @@ -1,7 +1,29 @@ #!/bin/ash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### -TERM=linux -LANG=en_US.UTF-8 -export TERM LANG +. /etc/functions -/bin/unicode_start lat0-16 + TERM=linux + LANG=en_US.UTF-8 + export TERM LANG + + echo -en '\033%G' + kbd_mode -u diff --git a/config/install/rc b/config/install/rc index 48d02bb4f..0e465bf66 100644 --- a/config/install/rc +++ b/config/install/rc @@ -1,46 +1,123 @@ #!/bin/ash +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### -echo -n "Mounting filesystems: /tmp " -mount -n -t tmpfs tmpfs /tmp -o mode=1777 +## Set the defaults +STARTUP_MODE=install +HOSTNAME=ipfire.localdomain -echo -n "/proc " -mount -n -t proc none /proc -echo >/proc/sys/kernel/printk "1 4 1 7" +. /etc/functions -echo -n "/sys " -mount -n -t sysfs sysfs /sys + boot_mesg -n "Mounting kernel-based file systems:" ${INFO} -echo -n "/dev " -mount -n -t tmpfs tmpfs /dev -o mode=755 -mkdir -p -m 0755 /dev/pts -mkdir -p -m 0755 /dev/shm + boot_mesg -n " /proc" ${NORMAL} + mount -n -t proc proc /proc || failed=1 -echo -n "/dev/pts " -mount -n -t devpts devpts /dev/pts + boot_mesg -n " /sys" ${NORMAL} + mount -n -t sysfs sysfs /sys || failed=1 + + boot_mesg "" ${NORMAL} -echo "/root" -mount -n -t ramfs none /root + (exit ${failed}) + evaluate_retval -echo -n -e "\033[9;0]" -ln -snf /proc/self/fd /dev/fd -ln -snf /proc/self/fd/0 /dev/stdin -ln -snf /proc/self/fd/1 /dev/stdout -ln -snf /proc/self/fd/2 /dev/stderr -ln -s /proc/kcore /dev/core + boot_mesg "Silencing kernel..." + echo >/proc/sys/kernel/printk "1 4 1 7" + evaluate_retval -echo "Starting syslogd" -syslogd -O /dev/tty4 + + boot_mesg "Disabling screen blanking..." + echo -n -e "\033[9;0]" + evaluate_retval -echo "Starting udev daemon" -/sbin/udevd --daemon -/sbin/udevtrigger -/sbin/udevsettle -sleep 3 -for file in /dev/.udev/failed/*/uevent ; do - echo "add" >"${file}" -done 2>/dev/null -/sbin/udevsettle + boot_mesg "Mounting /dev" + mount -n -t tmpfs tmpfs /dev -o mode=755 + evaluate_retval + + boot_mesg "Populating /dev with device nodes..." + echo > /proc/sys/kernel/hotplug + + cp -a /lib/udev/devices/* /dev + /sbin/udevd --daemon + /sbin/udevtrigger + /sbin/udevsettle + evaluate_retval + + + boot_mesg "Bringing up the loopback interface..." + ip addr add 127.0.0.1/8 label lo dev lo + ip link set lo up + evaluate_retval + + + boot_mesg "Setting hostname to ${HOSTNAME}..." + hostname ${HOSTNAME} + evaluate_retval -echo "Loading Installer..." + + # Now check what mode= was passed to the kernel + for i in $(cat /proc/cmdline); do + case $i in + mode=*) + STARTUP_MODE=${i#mode=} + ;; + esac + done + + case $STARTUP_MODE in + install) + SYSLOGD_EXTRA="-O /root/install.log" + + boot_mesg "Detecting hardware..." + for MODULE in $(kudzu -qps -t 30 | grep driver: | cut -d ' ' -f 2 | sort | uniq); do + if [ "$MODULE" = "unknown" ] || \ + [ "$MODULE" = "ignore" ] || \ + [ "$MODULE" = "" ]; then + continue + fi + MODULE=$(find /lib/modules -name $(echo $MODULE | sed -e 's/[_-]/*/g')* 2>/dev/null) + [ "$MODULE" == "" ] && continue + MODULE=$(basename $MODULE | cut -d. -f1 | head -1) + + if grep -Eqe "^$MODULE " /proc/modules; then + continue + fi + + echo "$MODULE" >> /tmp/modules-found.txt + modprobe $MODULE + + done + echo_ok + ;; + rescue) + sed -i "s, -c /bin/installer,,g" /etc/inittab + ;; + esac + + + boot_mesg "Starting system log daemon..." + syslogd -O /dev/tty4 $SYSLOGD_EXTRA + evaluate_retval + + + exec init + diff --git a/config/install/udev/rules.d/05-udev-early.rules b/config/install/udev/rules.d/05-udev-early.rules deleted file mode 100644 index cd5d9f563..000000000 --- a/config/install/udev/rules.d/05-udev-early.rules +++ /dev/null @@ -1,3 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/config/install/udev/rules.d/23-usb.rules b/config/install/udev/rules.d/23-usb.rules deleted file mode 100644 index fa02c43fa..000000000 --- a/config/install/udev/rules.d/23-usb.rules +++ /dev/null @@ -1,2 +0,0 @@ -# Set group ownership for raw USB devices -SUBSYSTEM=="usb_device", GROUP="usb" diff --git a/config/install/udev/rules.d/25-lfs.rules b/config/install/udev/rules.d/25-lfs.rules deleted file mode 100644 index ea79b773c..000000000 --- a/config/install/udev/rules.d/25-lfs.rules +++ /dev/null @@ -1,136 +0,0 @@ -# /etc/udev/rules.d/25-lfs.rules: Rule definitions for LFS. - -# Core kernel devices - -KERNEL=="ptmx", MODE="0666", GROUP="tty" -KERNEL=="random", MODE="0444" -KERNEL=="urandom", MODE="0444" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="full", MODE="0666" -KERNEL=="aio", MODE="0444" -KERNEL=="kmsg", MODE="0600" -KERNEL=="rtc", MODE="0666" - -# Comms devices - -KERNEL=="ttyS[0-9]*", GROUP="dialout" -KERNEL=="ttyUSB[0-9]*", GROUP="dialout" -KERNEL=="rfcomm[0-9]*", GROUP="dialout" -KERNEL=="tty[BCDEFHILMPRSTUVWX][0-9]*", GROUP="dialout" -KERNEL=="ttyS[ACIR][0-9]*", GROUP="dialout" -KERNEL=="ttyUSB[0-9]*", GROUP="dialout" -KERNEL=="ttyACM[0-9]*", GROUP="dialout" -KERNEL=="ippp[0-9]*", GROUP="dialout" -KERNEL=="isdn[0-9]*", GROUP="dialout" -KERNEL=="isdnctrl[0-9]*", GROUP="dialout" -KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL=="capi?*", NAME="capi/%n", GROUP="dialout" -KERNEL=="dcbri[0-9]*", GROUP="dialout" -KERNEL=="ircomm[0-9]*", GROUP="dialout" - -# TTY's - -KERNEL=="tty", MODE="0666", GROUP="tty" -KERNEL=="tty[0-9]*", MODE="0666", GROUP="tty" -KERNEL=="vcs*", MODE="0600" -KERNEL=="console", MODE="0622", GROUP="tty" - -# ALSA devices go in their own subdirectory - -KERNEL=="controlC[0-9]*", GROUP="audio", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", GROUP="audio", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", GROUP="audio", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", GROUP="audio", NAME="snd/%k" -KERNEL=="timer", GROUP="audio", NAME="snd/%k" -KERNEL=="seq", GROUP="audio", NAME="snd/%k" - -# Sound devices - -KERNEL=="admmidi*", GROUP="audio" -KERNEL=="adsp*", GROUP="audio" -KERNEL=="aload*", GROUP="audio" -KERNEL=="amidi*", GROUP="audio" -KERNEL=="amixer*", GROUP="audio" -KERNEL=="audio*", GROUP="audio" -KERNEL=="dmfm*", GROUP="audio" -KERNEL=="dmmidi*", GROUP="audio" -KERNEL=="dsp*", GROUP="audio" -KERNEL=="midi*", GROUP="audio" -KERNEL=="mixer*", GROUP="audio" -KERNEL=="music", GROUP="audio" -KERNEL=="sequencer*", GROUP="audio" - -# Printing devices - -KERNEL=="lp[0-9]*", GROUP="lp" -KERNEL=="parport[0-9]*", GROUP="lp" -KERNEL=="irlpt[0-9]*", GROUP="lp" - -# Input devices go in their own subdirectory - -KERNEL=="mice", MODE="0644", NAME="input/%k" SYMLINK="mouse" -KERNEL=="mouse*", MODE="0644", NAME="input/%k" -KERNEL=="event*", MODE="0644", NAME="input/%k" -KERNEL=="js*", MODE="0644", NAME="input/%k" -KERNEL=="ts*", MODE="0644", NAME="input/%k" - -KERNEL=="psaux", MODE="0644" -KERNEL=="js", MODE="0644" -KERNEL=="djs", MODE="0644" - -# USB devices go in their own subdirectory - -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp", NAME="usb/%k" - -# DRI devices are managed by the X server, so prevent udev from creating them - -KERNEL=="card*", NAME="" - -# Video devices - -KERNEL=="fb[0-9]*", MODE="0620", GROUP="video" -KERNEL=="agpgart", GROUP="video" -KERNEL=="video[0-9]*", GROUP="video" -KERNEL=="radio[0-9]*", GROUP="video" -KERNEL=="vbi[0-9]*", GROUP="video" -KERNEL=="vtx[0-9]*", GROUP="video" - -# Storage/memory devices - -KERNEL=="fd[0-9]*", GROUP="floppy" -KERNEL=="ram[0-9]*", GROUP="disk" -KERNEL=="raw[0-9]*", GROUP="disk", NAME="raw/%k" -KERNEL=="hd*", GROUP="disk" -KERNEL=="sd[a-z]", GROUP="disk" -KERNEL=="sd[a-z][0-9]*", GROUP="disk" -KERNEL=="sd[a-i][a-z]", GROUP="disk" -KERNEL=="sd[a-i][a-z][0-9]*", GROUP="disk" -KERNEL=="dasd[0-9]*", GROUP="disk" -KERNEL=="loop[0-9]*", GROUP="disk" -KERNEL=="md[0-9]*", GROUP="disk" - -# dmsetup and lvm2 related programs create devicemapper devices so we prevent -# udev from creating them - -KERNEL=="dm-*", OPTIONS+="ignore_device" -KERNEL=="device-mapper", OPTIONS+="ignore_device" - -KERNEL=="ht[0-9]*", GROUP="tape" -KERNEL=="nht[0-9]*", GROUP="tape" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="npt[0-9]*", GROUP="tape" -KERNEL=="st[0-9]*", GROUP="tape" -KERNEL=="nst[0-9]*", GROUP="tape" - -# Network devices - -KERNEL=="tun", NAME="net/%k" diff --git a/config/install/udev/rules.d/26-modprobe.rules b/config/install/udev/rules.d/26-modprobe.rules deleted file mode 100644 index b377a6aec..000000000 --- a/config/install/udev/rules.d/26-modprobe.rules +++ /dev/null @@ -1,18 +0,0 @@ -# /etc/udev/rules.d/26-modprobe.rules: Rules that require modprobe. - -# Generic rule to allow loading modular drivers for existing hardware - -ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" - -# SCSI devices require different modules, dependent on their SYSFS{type}. All -# of them require 'sg' though. -# -# module name sysfs types -# sd 0 (TYPE_DISK), 7 (TYPE_MOD), 14 (TYPE_MOD) -# st/osst 1 (TYPE_TAPE) -# sr 4 (TYPE_WORM), 5 (TYPE_ROM) - -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" diff --git a/config/install/udev/rules.d/27-firmware.rules b/config/install/udev/rules.d/27-firmware.rules deleted file mode 100644 index 0e70d1a4a..000000000 --- a/config/install/udev/rules.d/27-firmware.rules +++ /dev/null @@ -1,3 +0,0 @@ -# /etc/udev/rules.d/27-firmware.rules: Load firmware for devices that need it - -ACTION=="add", SUBSYSTEM=="firmware", RUN+="firmware.sh" diff --git a/config/install/udev/rules.d/50-udev.rules b/config/install/udev/rules.d/50-udev.rules deleted file mode 100644 index bc8c8bdd6..000000000 --- a/config/install/udev/rules.d/50-udev.rules +++ /dev/null @@ -1,47 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -# if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" - -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - -# DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL="card*", NAME="dri/card%n" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# Network devices -KERNEL="tun", NAME="net/%k" - -# raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/config/install/udev/rules.d/60-persistent-storage.rules b/config/install/udev/rules.d/60-persistent-storage.rules deleted file mode 100644 index 80e7d6084..000000000 --- a/config/install/udev/rules.d/60-persistent-storage.rules +++ /dev/null @@ -1,49 +0,0 @@ -# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" - -# never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" - -# for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - - -LABEL="persistent_storage_end" diff --git a/config/install/udev/rules.d/81-cdrom.rules b/config/install/udev/rules.d/81-cdrom.rules deleted file mode 100644 index 5a38a7210..000000000 --- a/config/install/udev/rules.d/81-cdrom.rules +++ /dev/null @@ -1,3 +0,0 @@ -# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions. - -ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", GROUP="cdrom" diff --git a/config/install/udev/udev.conf b/config/install/udev/udev.conf deleted file mode 100644 index 41902c4f0..000000000 --- a/config/install/udev/udev.conf +++ /dev/null @@ -1,7 +0,0 @@ -# udev.conf - -# The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevcontrol log_priority=". -udev_log="err" - diff --git a/lfs/Config b/lfs/Config index 43374a95c..421c8ca90 100644 --- a/lfs/Config +++ b/lfs/Config @@ -34,7 +34,7 @@ # a site you should change its URL to that of a suitable mirror site. # URL_IPFIRE = http://source.ipfire.org/source-3.0 -URL_TOOLCHAIN = http://source.ipfire.org/toolchain +URL_TOOLCHAIN = http://source.ipfire.org/toolchains # Default compiler optimizations. # diff --git a/lfs/initramfs b/lfs/initramfs index 4f581725b..cbeb2dbb1 100644 --- a/lfs/initramfs +++ b/lfs/initramfs @@ -113,8 +113,9 @@ $(TARGET) : ### configuration # cp -avf $(DIR_CONF)/install/* $(INSTALLER_DIR)/etc/ + cp -vf $(DIR_SOURCE)/initscripts/init.d/functions $(INSTALLER_DIR)/etc/functions chmod -v 755 $(INSTALLER_DIR)/etc/{halt,rc} - ln -svf /etc/rc $(INSTALLER_DIR)/init + ln -svf etc/rc $(INSTALLER_DIR)/init cp -vf /etc/issue /etc/group $(INSTALLER_DIR)/etc/ cp -f /usr/share/terminfo/l/linux $(INSTALLER_DIR)/usr/share/terminfo/l @@ -127,11 +128,20 @@ $(TARGET) : # -mkdir -p $(INSTALLER_DIR)/lib/modules/$(KVER)/kernel/{drivers,fs} cp -avf \ - /lib/modules/$(KVER)/kernel/drivers/{pcmcia,scsi} \ + /lib/modules/$(KVER)/kernel/drivers/{ata,block,cdrom,dma,firewire,hid,ide,net,pcmcia,scsi,usb} \ $(INSTALLER_DIR)/lib/modules/$(KVER)/kernel/drivers cp -avf \ /lib/modules/$(KVER)/kernel/fs/{exportfs,ext{2,3},fat,ntfs,reiser{4,fs},udf,vfat,xfs} \ $(INSTALLER_DIR)/lib/modules/$(KVER)/kernel/fs + cp -f /lib/modules/$(KVER)/modules.* $(INSTALLER_DIR)/lib/modules/$(KVER) + + ### stripping + # + # We do the stripping here because we don't want to destroy our development tree by stripping all symbols + # Instead we strip all binaries and libraries as we create the initramfs. + # It's quite safe to do strip --strip-all on libraries if they will not be used for development. + cd $(INSTALLER_DIR) && find .{,/usr/}/bin .{,/usr/}/sbin -maxdepth 1 -type f -exec $(TOOLS_DIR)/bin/strip --strip-all '{}' ';' + cd $(INSTALLER_DIR) && find .{,/usr/}/lib -maxdepth 1 -type f -exec $(TOOLS_DIR)/bin/strip --strip-all '{}' ';' ### compressing everything # diff --git a/make.sh b/make.sh index 020f83c8b..04d13ca04 100755 --- a/make.sh +++ b/make.sh @@ -448,8 +448,8 @@ build) if [ ! -d $BASEDIR/cache ]; then exiterror "Use make.sh downloadsrc first!" fi - cd $BASEDIR/cache - PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.gz 2> /dev/null | head -n 1` + cd $BASEDIR/cache/toolchains + PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.bz2 2> /dev/null | head -n 1` #only restore on a clean disk echo -ne "Building for ${BOLD}${MACHINE} on ${MACHINE_REAL}${NORMAL}\n" @@ -610,7 +610,7 @@ toolchain) stdumount echo -ne "Tar creation " [ -d cache/toolchains ] || mkdir cache/toolchains - cd $BASEDIR && tar cvj \ + cd $BASEDIR && tar cj \ --exclude='log_${MACHINE}/_build.*.log' \ --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ build_${MACHINE} \ @@ -627,23 +627,23 @@ gettoolchain) if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains - echo "Load toolchain tar.bz2 for $MACHINE" | tee -a $LOGFILE + echo "Loading toolchain for $MACHINE" cd $BASEDIR/cache/toolchains wget -c -nv $URL_TOOLCHAIN/$TOOLCHAINNAME.tar.bz2 $URL_TOOLCHAIN/$TOOLCHAINNAME.md5 if [ $? -ne 0 ]; then - echo -ne "Error downloading toolchain for $MACHINE machine" | tee -a $LOGFILE + echo -n "ERROR: Downloading toolchain for $MACHINE machine" beautify message FAIL - echo "Precompiled toolchain not always available for every MACHINE" | tee -a $LOGFILE + echo "Precompiled toolchain not always available for every machine" else if [ "`md5sum $TOOLCHAINNAME.tar.bz2 | awk '{print $1}'`" = "`cat $TOOLCHAINNAME.md5 | awk '{print $1}'`" ]; then beautify message DONE - echo "Toolchain md5 ok" | tee -a $LOGFILE + echo "Toolchain md5 ok" else exiterror "$TOOLCHAINNAME.md5 did not match, check downloaded package" fi fi else - echo "Toolchain tar.bz2 for $MACHINE is already downloaded" | tee -a $LOGFILE + echo -n "Toolchain for $MACHINE is already existing" beautify message SKIP fi ;; diff --git a/src/initscripts/init.d/functions b/src/initscripts/init.d/functions index 04acda3cf..a9e13fd27 100644 --- a/src/initscripts/init.d/functions +++ b/src/initscripts/init.d/functions @@ -22,7 +22,7 @@ export PATH="/bin:/usr/bin:/sbin:/usr/sbin" RELOADSIG="HUP" # Number of seconds between STOPSIG and FALLBACK when stopping processes -KILLDELAY="10" +KILLDELAY="3" ## Screen Dimensions # Find current screen size @@ -40,12 +40,23 @@ fi COL=$((${COLUMNS} - 8)) WCOL=$((${COL} - 2)) -## Set Cursor Position Commands, used via echo -e +## Provide an echo that supports -e and -n +# If formatting is needed, $ECHO should be used +case "`echo -e -n test`" in + -[en]*) + ECHO=/bin/echo + ;; + *) + ECHO=echo + ;; +esac + +## Set Cursor Position Commands, used via $ECHO SET_COL="\\033[${COL}G" # at the $COL char SET_WCOL="\\033[${WCOL}G" # at the $WCOL char CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char -## Set color commands, used via echo -e +## Set color commands, used via $ECHO # Please consult `man console_codes for more information # under the "ECMA-48 Set Graphics Rendition" section # @@ -99,12 +110,11 @@ boot_mesg() done ## Figure out the length of what is to be printed to be used - ## for warning messges. - STRING_LENGTH="`echo "${1}" | sed \ - -e 's,.,.,g' -e 'l 1' | grep -c \$`" + ## for warning messages. + STRING_LENGTH=$((${#1} + 1)) # Print the message to the screen - echo ${ECHOPARM} -e "${2}${1}" + ${ECHO} ${ECHOPARM} -e "${2}${1}" } @@ -117,27 +127,27 @@ boot_mesg_flush() boot_log() { # Left in for backwards compatibility - echo -n "" + : } echo_ok() { - echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" - echo -e "${NORMAL}" + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" + ${ECHO} -e "${NORMAL}" boot_mesg_flush } echo_failure() { - echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" - echo -e "${NORMAL}" + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" + ${ECHO} -e "${NORMAL}" boot_mesg_flush } echo_warning() { - echo -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" - echo -e "${NORMAL}" + ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" + ${ECHO} -e "${NORMAL}" boot_mesg_flush } @@ -152,12 +162,12 @@ print_error_msg() boot_mesg_flush boot_mesg -n "If you're able to track this" boot_mesg -n " error down to a bug in one of the files provided by" - boot_mesg -n " ipfire, please be so kind to inform us at" - boot_mesg " info@ipfire.org.\n" + boot_mesg -n " the LFS book, please be so kind to inform us at" + boot_mesg " lfs-dev@linuxfromscratch.org.\n" boot_mesg_flush - boot_mesg -n "Press Enter to continue or wait 3 minutes..." ${INFO} + boot_mesg -n "Press Enter to continue..." ${INFO} boot_mesg "" ${NORMAL} - read -t 180 ENTER + read ENTER } check_script_status() @@ -209,20 +219,20 @@ print_status() # may call it this way. case "${2}" in running) - echo -e -n "${CURS_UP}" - echo -e -n "\\033[${STRING_LENGTH}G " + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " boot_mesg "Already running." ${WARNING} echo_warning ;; not_running) - echo -e -n "${CURS_UP}" - echo -e -n "\\033[${STRING_LENGTH}G " + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " boot_mesg "Not running." ${WARNING} echo_warning ;; not_available) - echo -e -n "${CURS_UP}" - echo -e -n "\\033[${STRING_LENGTH}G " + ${ECHO} -e -n "${CURS_UP}" + ${ECHO} -e -n "\\033[${STRING_LENGTH}G " boot_mesg "Not available." ${WARNING} echo_warning ;; @@ -244,15 +254,44 @@ print_status() reloadproc() { - if [ "${#}" = "0" ]; then - echo "Usage: reloadproc [{program}]" - exit 1 + local pidfile="" + local failure=0 + + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" -lt "1" ]; then + log_failure_msg "Usage: reloadproc [-p pidfile] pathname" + return 2 fi - getpids "${1}" + # This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + # Is the process running? + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi if [ -n "${pidlist}" ]; then - failure="0" for pid in ${pidlist} do kill -"${RELOADSIG}" "${pid}" || failure="1" @@ -269,30 +308,70 @@ reloadproc() statusproc() { - if [ "${#}" = "0" ] - then - echo "Usage: statusproc {program}" - exit 1 + local pidfile="" + local base="" + local ret="" + + while true + do + case "${1}" in + -p) + pidfile="${2}" + shift 2 + ;; + -*) + log_failure_msg "Unknown Option: ${1}" + return 2 + ;; + *) + break + ;; + esac + done + + if [ "${#}" != "1" ]; then + shift 1 + log_failure_msg "Usage: statusproc [-p pidfile] pathname" + return 2 fi - getpids "${1}" + # Get the process basename + base="${1##*/}" + + # This will ensure compatibility with previous LFS Bootscripts + if [ -n "${PIDFILE}" ]; then + pidfile="${PIDFILE}" + fi + + # Is the process running? + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi + + # Store the return status + ret=$? if [ -n "${pidlist}" ]; then - echo -e "${INFO}${base} is running with Process"\ + ${ECHO} -e "${INFO}${base} is running with Process"\ "ID(s) ${pidlist}.${NORMAL}" else if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then - echo -e "${WARNING}${1} is not running but"\ + ${ECHO} -e "${WARNING}${1} is not running but"\ "/var/run/${base}.pid exists.${NORMAL}" else - if [ -n "${PIDFILE}" -a -e "${PIDFILE}" ]; then - echo -e "${WARNING}${1} is not running"\ - "but ${PIDFILE} exists.${NORMAL}" + if [ -n "${pidfile}" -a -e "${pidfile}" ]; then + ${ECHO} -e "${WARNING}${1} is not running"\ + "but ${pidfile} exists.${NORMAL}" else - echo -e "${INFO}${1} is not running.${NORMAL}" + ${ECHO} -e "${INFO}${1} is not running.${NORMAL}" fi fi fi + + # Return the status from pidofproc + return $ret } # The below functions are documented in the LSB-generic 2.1.0 @@ -363,11 +442,11 @@ pidofproc() for pid in ${lpids} do if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then - kill -0 "${pid}" > /dev/null && + kill -0 "${pid}" 2>/dev/null && pidlist="${pidlist} ${pid}" fi - if [ "${silent}" -ne "1" ]; then + if [ "${silent}" != "1" ]; then echo "${pidlist}" fi @@ -380,7 +459,7 @@ pidofproc() else pidlist=`pidof -o $$ -o $PPID -x "$1"` - if [ "x${silent}" != "x1" ]; then + if [ "${silent}" != "1" ]; then echo "${pidlist}" fi @@ -529,10 +608,10 @@ loadproc() killproc() { local pidfile="" - local killsig="" + local killsig=TERM # default signal is SIGTERM pidlist="" -# This will ensure compatibility with previous LFS Bootscripts + # This will ensure compatibility with previous LFS Bootscripts if [ -n "${PIDFILE}" ]; then pidfile="${PIDFILE}" fi @@ -547,7 +626,7 @@ killproc() -*) log_failure_msg "Unknown Option: ${1}" return 2 - ;; + ;; *) break ;; @@ -562,37 +641,49 @@ killproc() return 2 fi + # Is the process running? if [ -z "${pidfile}" ]; then pidofproc -s "${1}" else pidofproc -s -p "${pidfile}" "${1}" fi - # Change.... + # If running, send the signal if [ -n "${pidlist}" ]; then for pid in ${pidlist} do - kill -${killsig:-TERM} ${pid} 2>/dev/null - if [ -z "${killsig}" ]; then - # Wait up to 3 seconds, for ${pid} to terminate - local dtime=${KILLDELAY} + kill -${killsig} ${pid} 2>/dev/null + + # Wait up to 3 seconds, for ${pid} to terminate + case "${killsig}" in + TERM|SIGTERM|KILL|SIGKILL) + # sleep in 1/10ths of seconds and + # multiply KILLDELAY by 10 + local dtime="${KILLDELAY}0" while [ "${dtime}" != "0" ] do kill -0 ${pid} 2>/dev/null || break - sleep 1 + sleep 0.1 dtime=$(( ${dtime} - 1)) done # If ${pid} is still running, kill it kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null - fi + ;; + esac done - if [ -z "${killsig}" ]; then - pidofproc -s "${1}" + # Check if the process is still running if we tried to stop it + case "${killsig}" in + TERM|SIGTERM|KILL|SIGKILL) + if [ -z "${pidfile}" ]; then + pidofproc -s "${1}" + else + pidofproc -s -p "${pidfile}" "${1}" + fi # Program was terminated if [ "$?" != "0" ]; then - # Pidfile Exists + # Remove the pidfile if necessary if [ -f "${pidfile}" ]; then rm -f "${pidfile}" fi @@ -602,17 +693,13 @@ killproc() echo_failure return 4 # Unknown Status fi - else - if [ -z "${pidfile}" ]; then - pidofproc -s "${1}" - else - pidofproc -s -p "${pidfile}" "${1}" - fi - fi - - evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts - - else + ;; + *) + # Just see if the kill returned successfully + evaluate_retval + ;; + esac + else # process not running print_status warning not_running fi } @@ -634,8 +721,8 @@ killproc() #******************************************************************************* log_success_msg() { - echo -n -e "${BOOTMESG_PREFIX}${@}" - echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" return 0 } @@ -654,8 +741,8 @@ log_success_msg() # #******************************************************************************* log_failure_msg() { - echo -n -e "${BOOTMESG_PREFIX}${@}" - echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" return 0 } @@ -674,26 +761,9 @@ log_failure_msg() { # #******************************************************************************* log_warning_msg() { - echo -n -e "${BOOTMESG_PREFIX}${@}" - echo -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" + ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" + ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" return 0 } -run_subdir() { - DIR=$1 - for i in $(ls -v ${DIR}* 2> /dev/null); do - check_script_status - OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }') - case "$OUT" in - S) ${i} start ;; - K) ${i} stop ;; - RS) ${i} restart ;; - RL) ${i} reload ;; - U) ${i} up ;; - D) ${i} down ;; - *) ${i} ;; - esac - done -} - # End $rc_base/init.d/functions