From: <ch...@us...> - 2007-11-26 04:57:03
|
Revision: 765 http://ipcop.svn.sourceforge.net/ipcop/?rev=765&view=rev Author: chepati Date: 2007-11-25 20:57:08 -0800 (Sun, 25 Nov 2007) Log Message: ----------- A list of changes: 1) I wasn't happy with /etc being a link to /proc/mounts so now rc.sysinit generates a new one every time 2) Tied to 1), I wasn't very happy with the order in fstab -- I like / to be listed first. Also made sure /dev was not mounted twice, once by rc.sysinit and then by mount -a. Also, at the cost of some extra ifs made sure fstab columns are properly aligned, yet within 80 char wide terminals. Oh, fstab is completely generated by the installer now 3) Rearranged rc.sysinit to resemble a combination of LFS-6.3 boot scripts, yet remain ipcop-specific. Made the fs_check_result error reporting a bit more precise (taken from fsck's manpage and LFS-6.3 bootscripts). I'm considering moving fsck to the initramfs. Any comments about this? I haven't decided anything though. Maybe I'll just put a line in the fs_check_result fatal error reporting to tell the user to start in rescue mode and fix from there? 4) I felt that the first-time boot screen was overwhelming with too much information. It was all due to new certificates and keys beeing generated. Well, they are automated so there'e no point to flood the screen, so I suppressed their output. Now the boot screen is plesantly terse. Also, due to the switch from mingetty to agetty, by default the screen in not cleared before reading /etc/issue. I like it this way so errors are not hidden. If you don't like it, I can put a clear escape character in /etc/issue to do that, but let's keep it like it is now while still developing. IvanK. Modified Paths: -------------- ipcop/trunk/config/rc.d/rc.sysinit ipcop/trunk/config/rootfiles/common/stage2 ipcop/trunk/config/rootfiles/common/sysvinit ipcop/trunk/lfs/stage2 ipcop/trunk/src/installer/partition.c Removed Paths: ------------- ipcop/trunk/config/etc/fstab Deleted: ipcop/trunk/config/etc/fstab =================================================================== --- ipcop/trunk/config/etc/fstab 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/config/etc/fstab 2007-11-26 04:57:08 UTC (rev 765) @@ -1,8 +0,0 @@ -# -# $Id$ -# -tmpfs /tmp tmpfs defaults 0 0 -proc /proc proc defaults 0 0 -sysfs /sys sysfs defaults 0 0 -tmpfs /dev tmpfs defaults 0 0 -devpts /dev/pts devpts gid=5,mode=620 0 0 Modified: ipcop/trunk/config/rc.d/rc.sysinit =================================================================== --- ipcop/trunk/config/rc.d/rc.sysinit 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/config/rc.d/rc.sysinit 2007-11-26 04:57:08 UTC (rev 765) @@ -8,18 +8,39 @@ # $1 is return value of fsck function fs_check_result() { - if [ "$1" = "0" ]; then + if [ $1 -eq 0 ]; then echo "$STRING: Success" - elif [ "$1" = "1" ]; then + fi + + if [ $1 -eq 1 ]; then echo "$STRING: Passed" + echo -n "WARNING:\n\nFile system errors" + echo -n " were found and have been corrected." + echo -n " You may want to double-check that" + echo " everything was fixed properly." fi - # A return of 2 or higher means there were serious problems. - if [ $1 -gt 1 ]; then + if [ $1 -eq 2 -o $1 -eq 3 ]; then + echo "$STRING: Passed, but reboot is required" + echo -n "WARNING:\n\nFile system errors" + echo -n " were found and have been" + echo -n " corrected, but the nature of the" + echo -n " errors require this system to be" + echo -n " rebooted.\n\nAfter you press enter," + echo -n " this system will be rebooted" + echo "\n\nPress Enter to continue..." + read ENTER + /sbin/reboot -f + + fi + + if [ $1 -gt 3 -a $1 -lt 16 ]; then echo "$STRING: Failed" - echo "*** An error occurred during the file system check." - echo "*** Dropping you to a shell; the system will reboot" - echo "*** when you leave the shell." + echo -n "FAILURE:\n\nFile system errors" + echo -n " were encountered that could not be" + echo -n " fixed automatically.\n\n" + echo -n "Dropping you to a shell; the system will reboot" + echo " when you leave the shell." export PS1="(Repair filesystem) \# # " /sbin/sulogin echo "Unmounting filesystems" @@ -28,6 +49,13 @@ echo "Automatic reboot in progress." /sbin/reboot -f fi + + if [ $1 -ge 16 ]; then + echo "$STRING: Failed" + echo -n "FAILURE:\n\nUnexpected Failure" + echo -n " running fsck. Exited with error" + echo " code: $1." + fi } @@ -40,77 +68,95 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH -echo "Mounting /proc filesystem" -/bin/mount -n -t proc /proc /proc -# Unmount the initrd, if necessary -if [ ! -e /FLASH ]; then - if /bin/grep -q /initrd /proc/mounts && ! /bin/grep -q /initrd/loopfs /proc/mounts ; then - /bin/umount /initrd/hd - /bin/umount /initrd - /sbin/blockdev --flushbufs /dev/ram0 - fi + +if ! mountpoint /proc &> /dev/null; then + echo "Mounting /proc filesystem" + /bin/mount -n /proc fi -echo "Setting hostname" -/bin/hostname -F /etc/hostname - -if [ "$KEYMAP" != "" ]; then - /bin/loadkeys $KEYMAP +if ! mountpoint /sys &> /dev/null; then + echo "Mounting sysfs" + /bin/mount -n /sys fi -echo "Mounting sysfs" -/bin/mount -n -t sysfs sysfs /sys + + echo "Mounting dev" /bin/mount -n -t tmpfs tmpfs /dev -o mode=755 # Start udev -echo "Starting UDEV" +echo "Starting udev" + +# Udev handles uevents itself, so we don't need to have +# the kernel call out to any binary in response to them echo > /proc/sys/kernel/hotplug + +# Copy static device nodes to /dev cp -a /lib/udev/devices/* /dev + +# Start the udev daemon to continually watch for, and act on, +# uevents /sbin/udevd --daemon + +# Now traverse /sys in order to "coldplug" devices that have +# already been discovered /sbin/udevtrigger + +# Now wait for udevd to process the uevents we triggered /sbin/udevsettle -# Initializing Power Management ACPI first, then APM. -# APM won't load if ACPI is initialized anyway. -echo "Initializing Power Management" -/sbin/modprobe ac > /dev/null 2>&1 -/sbin/modprobe battery > /dev/null 2>&1 -/sbin/modprobe button > /dev/null 2>&1 -/sbin/modprobe fan > /dev/null 2>&1 -/sbin/modprobe processor > /dev/null 2>&1 -/sbin/modprobe thermal > /dev/null 2>&1 -/sbin/modprobe apm > /dev/null 2>&1 -# Coldplug all devices -for RC in /etc/hotplug/*.rc; -do - NAME=`basename $RC .rc` - echo "Coldplugging $NAME devices." - $RC start > /dev/null 2>&1; -done +if [ "$KEYMAP" != "" ]; then + /bin/loadkeys $KEYMAP +fi + echo "Initializing USB storage devices" /sbin/modprobe usb-storage echo "Initializing USB keyboard" /sbin/modprobe usbhid -STRING="Checking root filesystem" -/sbin/fsck -R -T -a -C / +STRING="Checking filesystems integrity" +/sbin/fsck -a -A -C -T 2>/dev/null fs_check_result $? echo "Mounting root read/write" /bin/mount -n -o remount,rw / -STRING="Checking other filesystems" -/sbin/fsck -R -T -a -C -A -fs_check_result $? +echo "Recording existing mounts in /etc/mtab" +> /etc/mtab +mount -f / +mount -f /proc +mount -f /sys echo "Mounting other filesystems" -mount -a -n +mount -a +# Unmount the initrd, if necessary +if [ ! -e /FLASH ]; then + if /bin/grep -q /initrd /proc/mounts && ! /bin/grep -q /initrd/loopfs /proc/mounts ; then + /bin/umount /initrd/hd + /bin/umount /initrd + /sbin/blockdev --flushbufs /dev/ram0 + fi +fi + +echo "Setting hostname" +/bin/hostname -F /etc/hostname + +# Initializing Power Management ACPI first, then APM. +# APM won't load if ACPI is initialized anyway. +echo "Initializing Power Management" +/sbin/modprobe ac > /dev/null 2>&1 +/sbin/modprobe battery > /dev/null 2>&1 +/sbin/modprobe button > /dev/null 2>&1 +/sbin/modprobe fan > /dev/null 2>&1 +/sbin/modprobe processor > /dev/null 2>&1 +/sbin/modprobe thermal > /dev/null 2>&1 +/sbin/modprobe apm > /dev/null 2>&1 + if [ -e /swapfile ]; then echo "Turning on swap" /bin/chmod 600 /swapfile @@ -183,27 +229,34 @@ fi if [ ! -e /etc/ssh/ssh_host_key ]; then - echo "Generating SSH RSA1 key. This may take several minutes." - /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N "" + echo -n "Generating SSH RSA1 key. This may take several minutes... " + /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N "" + echo "Done" fi if [ ! -e /etc/ssh/ssh_host_rsa_key ]; then - echo "Generating SSH RSA key. This may take several minutes." - /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" + echo -n "Generating SSH RSA key. This may take several minutes... " + /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" + echo "Done" fi if [ ! -e /etc/ssh/ssh_host_dsa_key ]; then - echo "Generating SSH DSA key. This may take several minutes." - /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N "" + echo -n "Generating SSH DSA key. This may take several minutes... " + /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N "" + echo "Done" fi + if [ ! -e CONFIG_ROOT/backup/backup.key ]; then - echo "Generating backup key. This may take several minutes." + echo -n "Generating backup key. This may take several minutes... " /usr/sbin/ipsec ranbits --quick 256 > CONFIG_ROOT/backup/backup.key /bin/chmod 400 CONFIG_ROOT/backup/backup.key + echo "Done" fi # https certificate if [ -f /etc/httpd/server.key -a -f /etc/httpd/server.crt -a -f /etc/httpd/server.csr ]; then /usr/local/bin/httpscert read else - /usr/local/bin/httpscert new + echo -n "Generating new http server SSL certificate keys... " + /usr/local/bin/httpscert new > /dev/null 2>&1 + echo "Done" fi echo "Rotating logs" Modified: ipcop/trunk/config/rootfiles/common/stage2 =================================================================== --- ipcop/trunk/config/rootfiles/common/stage2 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/config/rootfiles/common/stage2 2007-11-26 04:57:08 UTC (rev 765) @@ -7,7 +7,6 @@ #boot etc/certparams etc/domainname -etc/fstab etc/group etc/host.conf etc/hostname Modified: ipcop/trunk/config/rootfiles/common/sysvinit =================================================================== --- ipcop/trunk/config/rootfiles/common/sysvinit 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/config/rootfiles/common/sysvinit 2007-11-26 04:57:08 UTC (rev 765) @@ -1,6 +1,6 @@ ## sysvinit-2.86 ## -#bin/mountpoint +bin/mountpoint #bin/pidof #sbin/bootlogd sbin/halt Modified: ipcop/trunk/lfs/stage2 =================================================================== --- ipcop/trunk/lfs/stage2 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/lfs/stage2 2007-11-26 04:57:08 UTC (rev 765) @@ -105,11 +105,6 @@ [ -f $$i ] && cp $$i /etc; \ done -ifeq "$(MACHINE)" "sparc" - echo -ne "openpromfs\t/proc/openprom\topenpromfs\tdefaults\t0 0\n" >> /etc/fstab -endif - - ln -sf /proc/mounts /etc/mtab echo "$(NAME) v$(VERSION) for $(MACHINE) - $(SLOGAN) (\l)" > /etc/issue # Scripts Modified: ipcop/trunk/src/installer/partition.c =================================================================== --- ipcop/trunk/src/installer/partition.c 2007-11-26 03:16:19 UTC (rev 764) +++ ipcop/trunk/src/installer/partition.c 2007-11-26 04:57:08 UTC (rev 765) @@ -555,8 +555,11 @@ delete_tarballs(); /* complete fstab */ - if ( (handle = fopen("/harddisk/etc/fstab", "a")) ) + if ( (handle = fopen("/harddisk/etc/fstab", "w")) ) { + fprintf(handle, "# device\tmount-point\ttype\t\toptions\t\tdump\tfsck\n"); + fprintf(handle, "#\t\t\t\t\t\t\t\t\torder\n"); + for (i = 0; i < numpartitions; i++) { if ( !strcmp(partition_label[i], "skip") ) @@ -564,13 +567,31 @@ } else if (!strcmp(partition_label[i], "swap")) { - fprintf(handle, "/dev/%s\t\t%s\t\tswap\tdefaults\t0 0\n", partitions[i], partition_label[i]); + fprintf(handle, "/dev/%s\t%s\t\tswap\t\tdefaults\t\t0\t0\n", partitions[i], partition_label[i]); } else { - fprintf(handle, "/dev/%s\t\t%s\t\text3\tnoatime\t1 1\n", partitions[i], partition_label[i]); + if ( !strcmp(partition_label[i], "/var/log") ) + { + fprintf(handle, "/dev/%s\t%s\text3\t\tnoatime\t\t0\t1\n", partitions[i], partition_label[i]); + } + else + { + fprintf(handle, "/dev/%s\t%s\t\text3\t\tnoatime\t\t0\t1\n", partitions[i], partition_label[i]); + } } } + + fprintf(handle, "tmpfs\t\t/tmp\t\ttmpfs\t\tdefaults\t0\t0\n"); + fprintf(handle, "proc\t\t/proc\t\tproc\t\tdefaults\t0\t0\n"); + fprintf(handle, "sysfs\t\t/sys\t\tsysfs\t\tdefaults\t0\t0\n"); + fprintf(handle, "devpts\t\t/dev/pts\tdevpts\t\tgid=5,mode=620\t0\t0\n"); + fprintf(handle, "shm\t\t/dev/shm\ttmpfs\t\tdefaults\t0\t0\n"); + +#if defined(__sparc__) || defined(__sparc64__) + fprintf(handle, "openpromfs\t/proc/openprom\topenpromfs\tdefaults\t0 0\n"); +#endif + fclose(handle); } newtPopWindow(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |