r2762 - people/daniel/installer-initramfs/scripts
daniel at alioth.debian.org
daniel at alioth.debian.org
Tue Aug 14 09:04:05 UTC 2007
Author: daniel
Date: 2007-08-14 09:04:05 +0000 (Tue, 14 Aug 2007)
New Revision: 2762
Modified:
people/daniel/installer-initramfs/scripts/installer
Log:
Modified: people/daniel/installer-initramfs/scripts/installer
===================================================================
--- people/daniel/installer-initramfs/scripts/installer 2007-08-14 08:52:52 UTC (rev 2761)
+++ people/daniel/installer-initramfs/scripts/installer 2007-08-14 09:04:05 UTC (rev 2762)
@@ -7,205 +7,78 @@
export PATH="/root/usr/bin:/root/usr/sbin:/root/bin:/root/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
-mountpoint="/target"
-mkdir -p "${mountpoint}"
-
Arguments ()
{
- PRESEEDS=""
-
for ARGUMENT in `cat /proc/cmdline`
do
case "${ARGUMENT}" in
installer-config=*)
CONFIG="${ARGUMENT#installer-config=}"
-
- wget -P /tmp "${CONFIG}"
- . /tmp/"${CONFIG}"
+ export CONFIG
;;
esac
done
}
-get_backing_device() {
- case "$1" in
- *.squashfs|*.ext2|*.ext3)
- echo $(setup_loop "$1" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}")
- ;;
- *.dir)
- echo "directory"
- ;;
- *)
- panic "Unrecognized live filesystem: $1"
- ;;
- esac
-}
+do_network ()
+{
+ modprobe -q af_packet # For DHCP
-is_nice_device() {
- sysfs_path="${1#/sys}"
- if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-[ide|scsi|usb])"; then
- return 0
- fi
- return 1
-}
+ udevtrigger
+ udevsettle
-is_supported_fs () {
- # FIXME: do something better like the scan of supported filesystems
- fstype="${1}"
- case ${fstype} in
- vfat|iso9660|udf|ext2|ext3|ntfs)
- return 0
- ;;
- esac
- return 1
-}
+ ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /network.config
-do_netmount() {
- rc=1
+ # source relevant ipconfig output
+ . /tmp/net-${DEVICE}.conf
+ export HOSTNAME
- modprobe "${MP_QUIET}" af_packet # For DHCP
-
- udevtrigger
- udevsettle
-
- ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
-
- if [ "${NFSROOT}" = "auto" ]; then
- NFSROOT=${ROOTSERVER}:${ROOTPATH}
- fi
-
- # source relevant ipconfig output
- . /tmp/net-${DEVICE}.conf
- export HOSTNAME
-
- if [ -n "${FETCH}" ] && do_httpmount; then
- rc=0
- return ${rc}
- fi
-
- if [ "${NFSROOT#*:}" = "$NFSROOT" ] && [ "$NETBOOT" != "cifs" ]; then
- NFSROOT=${ROOTSERVER}:${NFSROOT}
- fi
-
- [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
-
- if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then
- rc=0
- elif do_nfsmount ; then
- NETBOOT="nfs"
- export NETBOOT
- rc=0
- fi
-
- [ "$quiet" != "y" ] && log_end_msg
- return ${rc}
+ if [ -z "${CONFIG}" ]
+ then
+ wget -P /tmp "${CONFIG}"
+ . /tmp/"${CONFIG}"
+ fi
}
-check_dev ()
+pulsate ()
{
- sysdev="${1}"
- devname="${2}"
- if [ -z "${devname}" ]; then
- devname=$(sys2dev "${sysdev}")
- fi
-
- if [ -n "${LIVE_MEDIA_OFFSET}" ]; then
- loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
- devname="${loopdevname}"
- fi
-
- fstype=$(get_fstype "${devname}")
- if is_supported_fs ${fstype}; then
- mount -t ${fstype} -o ro "${devname}" $mountpoint || continue
- if is_live_path $mountpoint; then
- echo $mountpoint
- return 0
- else
- umount $mountpoint
- fi
- fi
-
- if [ -n "${LIVE_MEDIA_OFFSET}" ]; then
- losetup -d "${loopdevname}"
- fi
- return 1
+ if [ -x /sbin/usplash_write ]
+ then
+ /sbin/usplash_write "PULSATE"
+ fi
}
-pulsate() {
- if [ -x /sbin/usplash_write ]; then
- /sbin/usplash_write "PULSATE"
- fi
+set_usplash_timeout()
+{
+ if [ -x /sbin/usplash_write ]
+ then
+ /sbin/usplash_write "TIMEOUT 120"
+ fi
}
-set_usplash_timeout() {
- if [ -x /sbin/usplash_write ]; then
- /sbin/usplash_write "TIMEOUT 120"
- fi
-}
+mountroot ()
+{
+ exec 6>&1
+ exec 7>&2
+ exec > installer.log
+ exec 2>&1
-mountroot() {
- exec 6>&1
- exec 7>&2
- exec > live.log
- exec 2>&1
+ Arguments
- Arguments
+ # Needed here too because some things (*cough* udev *cough*)
+ # changes the timeout
- set_usplash_timeout
- [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-premount"
- pulsate
- run_scripts /scripts/live-premount
- [ "$quiet" != "y" ] && log_end_msg
+ set_usplash_timeout
- # Needed here too because some things (*cough* udev *cough*)
- # changes the timeout
+ maybe_break installer-bottom
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/installer-bottom"
- set_usplash_timeout
+ pulsate
+ run_scripts /scripts/installer-bottom
+ [ "$quiet" != "y" ] && log_end_msg
- if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ]; then
- if do_netmount ; then
- livefs_root="${mountpoint}"
- else
- panic "Unable to find a live file system on the network"
- fi
- else
- # Scan local devices for the image
- for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do
- livefs_root=$(find_livefs $i)
- if [ -n "${livefs_root}" ]; then
- break
- fi
- sleep 1
- done
- fi
+ exec 1>&6 6>&-
+ exec 2>&7 7>&-
- if [ -z "${livefs_root}" ]; then
- panic "Unable to find a medium containing a live file system"
- fi
-
- if [ "${TORAM}" ]; then
- live_dest="ram"
- elif [ "${TODISK}" ]; then
- live_dest="${TODISK}"
- fi
- if [ "${live_dest}" ]; then
- log_begin_msg "Copying live media to ${live_dest}"
- copy_live_to "${livefs_root}" "${live_dest}"
- log_end_msg
- fi
-
- mount_images_in_directory "${livefs_root}" "${rootmnt}"
-
- log_end_msg
-
- maybe_break live-bottom
- [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
-
- pulsate
- run_scripts /scripts/live-bottom
- [ "$quiet" != "y" ] && log_end_msg
-
- exec 1>&6 6>&-
- exec 2>&7 7>&-
- cp live.log "${rootmnt}/var/log/"
+ cp installer.log /target/root
}
More information about the debian-live-changes
mailing list