Adding support for resolving DNS names from initramfs, thanks to Michal Suchanek...
[live-boot-grml.git] / hooks / live
index 8a1be02..34d6eab 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# initramfs hook for live-initramfs (Debian Live)
+# initramfs hook for live-boot (Debian Live)
 
 set -e
 
@@ -22,25 +22,37 @@ esac
 
 . /usr/share/initramfs-tools/hook-functions
 
-# live-initramfs hook
+# live-boot hook
 
-# Handling live-initramfs
+# Reading configuration file from filesystem
+if [ -e /etc/live/boot.conf ]
+then
+       . /etc/live/boot.conf
+fi
 
-# Configuration
-if [ -r /etc/live.conf ]
+if ls /etc/live/boot.conf.d/* > /dev/null 2>&1
 then
-       . /etc/live.conf
+       for _FILE in /etc/live/boot.conf.d/*
+       do
+               . ${_FILE}
+       done
+fi
 
-       mkdir -p "${DESTDIR}"/etc
-       cp /etc/live.conf "${DESTDIR}"/etc
+# Handling live-boot
+
+# Configuration
+if [ -e /usr/share/live-boot/languagelist ]
+then
+       mkdir -p "${DESTDIR}"/usr/share/live-boot
+       cp /usr/share/live-boot/languagelist "${DESTDIR}"/usr/share/live-boot
 fi
 
 # Directories
-mkdir -p "${DESTDIR}"/lib/live-initramfs
+mkdir -p "${DESTDIR}"/lib/live-boot
 
 # Executables
-copy_exec /usr/share/live-initramfs/live-reconfigure /bin
-copy_exec /usr/share/live-initramfs/live-preseed /bin
+copy_exec /usr/share/live-boot/live-reconfigure /bin
+copy_exec /usr/share/live-boot/live-preseed /bin
 
 # Scripts
 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
@@ -55,6 +67,22 @@ do
        fi
 done
 
+# udev dependencies (squeeze and newer)
+for FILE in /lib/udev/*_id
+do
+       if [ ! -e "${DESTDIR}/${FILE}" ]
+       then
+               mkdir -p "${DESTDIR}/lib/udev"
+               copy_exec "${FILE}" /lib/udev
+       fi
+done
+
+if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
+then
+       mkdir -p ${DESTDIR}/lib/udev/rules.d
+       cp -p /lib/udev/rules.d/60-cdrom_id.rules ${DESTDIR}/lib/udev/rules.d
+fi
+
 # Handling other stuff
 
 # Configuration: keymap (usefull when using encryption)
@@ -73,6 +101,9 @@ then
        uuidgen -r > "${DESTDIR}"/conf/uuid.conf
 fi
 
+# Filesystem: btrfs
+manual_add_modules btrfs
+
 # Filesystem: cifs
 if [ -x /sbin/mount.cifs ]
 then
@@ -80,12 +111,18 @@ then
         manual_add_modules cifs
 fi
 
-# Filesystem: ext3
+# Filesystem: ext3/ext4
 manual_add_modules ext3
+manual_add_modules ext4
 
 # Filesystem: jffs2
 manual_add_modules jffs2
 
+if [ -x /usr/bin/rsync ]
+then
+       copy_exec /usr/bin/rsync /bin
+fi
+
 # Filesystem: squashfs
 copy_exec /sbin/losetup /sbin
 manual_add_modules loop
@@ -97,6 +134,12 @@ manual_add_modules unlzma
 manual_add_modules aufs
 manual_add_modules unionfs
 
+# Filesystem: unionfs-fuse
+if [ -x /usr/bin/unionfs-fuse ]
+then
+       copy_exec /usr/bin/unionfs-fuse /bin
+fi
+
 # Filesystem: vfat
 manual_add_modules nls_cp437
 manual_add_modules nls_iso8859-1
@@ -128,6 +171,13 @@ fi
 # Program: md5sum
 copy_exec /usr/bin/md5sum /bin
 
+# Program: memdisk
+if [ -x /usr/bin/memdiskfind ]
+then
+       copy_exec /usr/bin/memdiskfind
+       manual_add_modules phram mtdblock
+fi
+
 # Program: cpio
 # busybox and klibc lacks --no-absolute-filenames and --sparse, needed for snapshots
 if [ -e "${DESTDIR}/bin/cpio" ]
@@ -147,10 +197,10 @@ else
        copy_exec /sbin/udevtrigger /sbin
        copy_exec /sbin/udevsettle /sbin
 fi
-copy_exec /usr/bin/udevinfo /bin
-
-# Program: wc
-copy_exec /usr/bin/wc /bin
+if [ -x /usr/bin/udevinfo ]
+then
+       copy_exec /usr/bin/udevinfo /bin
+fi
 
 # Program: wget
 if [ -x /usr/bin/wget ]
@@ -158,6 +208,12 @@ then
        copy_exec /usr/bin/wget /bin
 fi
 
+# Program: blockdev
+if [ -x /sbin/blockdev ]
+then
+       copy_exec /sbin/blockdev /sbin
+fi
+
 # FUSE kernel module
 manual_add_modules fuse
 
@@ -175,3 +231,23 @@ if [ -x /usr/bin/curlftpfs ]
 then
        copy_exec /usr/bin/curlftpfs /bin
 fi
+
+# iSCSI
+if [ -x /usr/sbin/iscsistart ]
+then
+    copy_exec /usr/sbin/iscsistart /bin
+    #manual_add_modules ib_iser
+    manual_add_modules iscsi_tcp
+    manual_add_modules crc32c
+fi
+
+if [ "${LIVE_DNS}" = "true" ]
+then
+       #copy_exec /lib/libnss_files.so.*      /lib  # /etc/hosts and /etc/passwd
+       copy_exec /lib/libnss_dns.so.*      /lib  # DNS server
+       #copy_exec /lib/libnss_compat.so.*      /lib  # /etc/passwd
+
+       # Configuration file - may be needed if /etc/hosts is used.
+       #mkdir -p $DESTDIR/etc
+       #cp -p /etc/nsswitch.conf $DESTDIR/etc
+fi