#!/static/sh # # Metadistros boot up script - main program # # Based on: # # - KNOPPIX General Startup Script by Klaus Knopper <[email protected]> # - Gentoo boot up script by Daniel Robbins <[email protected]> # # Copyright 2003 Metadistros [ http://metadistros.hispalinux.es/ ] # Distributed under the GPL # ================================================================ # # Start script # # # Don't allow interrupt signals trap "" 1 2 3 15 # Set PATH PATH=/static export PATH # Clean input/output exec >/dev/console </dev/console 2>&1 umask 022 # Mount /, proc and devpts mount -o remount,rw / mount -t proc none /proc mount -t devpts none /dev/pts # Enable low latency echo "1" > /proc/sys/kernel/lowlatency # Tell kernel where modprobe lives echo "/static/modprobe" > /proc/sys/kernel/modprobe # ================================================================ # # Load configurations files # # . /etc/metadistros/var.conf . /etc/metadistros/i18n.conf . /etc/metadistros/functions # Add user defined in var.conf ($USERNAME) createuser # ================================================================ # # Welcome message # # progressbar 51 "${WELCOME}" if [ "${VERBOSE}" = "yes" ]; then echo -e "${WHITE}${WELCOME}${NORMAL}\n\n"; fi # ================================================================ # # First hardware detection # # # Check for devices, use modules on bootfloppy first if [ "${INTERACTIVE}" = "yes" ]; then # Load keymap setkeymap # Let the user select interactively if [ "${SCSI}" = yes ] then askmodules scsi `cd /modules/scsi; echo *.o` SCSI_MODULES="${MODULES}" fi if [ "${FIREWIRE}" = yes ] then askmodules firewire `cd /modules/firewire; echo *.o` FIREWIRE_MODULES="${MODULES}" fi if [ "${ATARAID}" = yes ] then askmodules ataraid `cd /modules/ataraid; echo *.o` ATARAID_MODULES="${MODULES}" fi if [ "${PCMCIA}" = yes ] then askmodules pcmcia `cd /modules/pcmcia; echo *.o` PCMCIA_MODULES="${MODULES}" fi if [ "${USB}" = yes ] then askmodules usb `cd /modules/usb; echo *.o` USB_MODULES="${MODULES}" fi fi # Load selected/default modules if [ "${FIREWIRE}" = "yes" ] && [ -n "${FIREWIRE_MODULES}" ] then progressbar 52 "${PBMESSAGE1}" loadmodules firewire ${FIREWIRE_MODULES} fi if [ "${ATARAID}" = "yes" ] && [ -n "${ATARAID_MODULES}" ] then progressbar 53 "${PBMESSAGE2}" loadmodules ataraid ${ATARAID_MODULES} fi if [ "${PCMCIA}" = "yes" ] && [ -n "${PCMCIA_MODULES}" ] then progressbar 54 "${PBMESSAGE3}" loadmodules pcmcia ${PCMCIA_MODULES} fi if [ "${USB}" = "yes" ] && [ -n "${USB_MODULES}" ] then progressbar 55 "${PBMESSAGE4}" loadmodules usb ${USB_MODULES} fi if [ "${SCSI}" = "yes" ] && [ -n "${SCSI_MODULES}" ] then progressbar 56 "${PBMESSAGE5}" loadmodules scsi ${SCSI_MODULES} FOUND_SCSI=$? fi # End of hardware check # ================================================================ # # Check for misc modules in expert mode # # if [ "${INTERACTIVE}" = "yes" ]; then answer="" while test "${answer}" != "n" -a "${answer}" != "N"; do echo -n "${MESSAGE1}" read answer case "${answer}" in n*|N*) break; ;; esac if mountmodules new; then askmodules new `cd /modules/others; echo *.o` test -n "${MODULES}" && loadmodules new ${MODULES} umountmodules fi done fi # All interactively requested modules should be loaded now. # ================================================================ # # Find META directory # # progressbar 57 "${PBMESSAGE6}" checkformetadirectory ${FOUND_SCSI} case $? in 0) FOUND_META="yes" ;; 1) FOUND_META="no" ;; esac # ================================================================ # # load (c)loop image # # # Show DEBUG info [ "${DEBUG}" = "yes" ] && echo "6" > /proc/sys/kernel/printk # Check for sufficient memory to mount extra ramdisk for /home + /var progressbar 58 "${PBMESSAGE7}" checkformemory # Mount (c)loop image progressbar 59 "${PBMESSAGE8}" mountimage # Disable kernel messages to console again [ "${DEBUG}" = "no" ] && echo "0" > /proc/sys/kernel/printk # ================================================================ # # Final test if everything succeeded # # if [ "${FOUND_META}" != "no" ]; then progressbar 60 "${PBMESSAGE9}" # Set final PATH PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin" export PATH # copy library cache cat /META/etc/ld.so.cache > /etc/ld.so.cache # Verbose mode? -> Enable kernel messages if [ "${VERBOSE}" = "yes" ]; then echo "6" > /proc/sys/kernel/printk; fi # Debian weirdness /bin/cp -a /META/etc/alternatives /etc/ 2>/dev/null # From here, we should have all essential commands available. hash -r # Clean up / rm -rf /modules # Create common WRITABLE (empty) dirs createdirs # Now tell kernel where the real modprobe lives echo "/sbin/modprobe" > /proc/sys/kernel/modprobe # Change root device from /dev/fd0 to /dev/ram0 echo "0x100" > /proc/sys/kernel/real-root-dev # Give control to the init process. if [ "${VERBOSE}" = "yes" ]; then echo "${MESSAGE2}"; fi rm -f /linuxrc # INIT take the control exec chroot . /sbin/init </dev/console >/dev/console 2>&1 else ( [ "${VERBOSE}" != "yes" ] && [ "${DEBUG}" != "yes" ] ) && echo -e "${CLEAR}" echo -e "${MESSAGE3}" setkeymap echo "6" > /proc/sys/kernel/printk PS1="\[^[[36m\]${DISTRO}:\[^[[32;01m\]\w\[^[[0m\]\[^[[36m\]\# " export PS1 # Allow signals trap 1 2 3 15 echo "" exec chroot / /static/ash fi |