Skip to content

Commit

Permalink
Cleaning up initramfs-tools hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-baumann committed Jul 18, 2012
1 parent de533f0 commit 7167a10
Showing 1 changed file with 43 additions and 57 deletions.
100 changes: 43 additions & 57 deletions backends/initramfs-tools/live.hook
@@ -1,32 +1,12 @@
#!/bin/sh

# initramfs hook for live-boot (Debian Live)

set -e

# initramfs-tools header

PREREQ=""

prereqs()
{
echo "${PREREQ}"
}

case "${1}" in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

[ "${QUIET}" ] || echo -n live-boot:

# live-boot hook
[ "${QUIET}" ] || echo -n "live-boot:"

# Reading configuration file from filesystem
# Reading configuration files
if [ -e /etc/live/boot.conf ]
then
. /etc/live/boot.conf
Expand All @@ -40,16 +20,16 @@ then
done
fi

# Handling live-boot

# Checking live-boot
if [ ! -e /lib/live/boot ]
then
echo
echo "W: live-boot-initramfs-tools (backend) installed without live-boot,"
echo "W: this initramfs will *NOT* have live support."
exit 0
fi

[ "${QUIET}" ] || echo -n " "core
[ "${QUIET}" ] || echo -n " core"

mkdir -p "${DESTDIR}/lib/live"
cp -a /lib/live/boot.sh /lib/live/boot "${DESTDIR}/lib/live"
Expand All @@ -63,7 +43,7 @@ do
fi
done

# udev dependencies (squeeze and newer)
# udev dependencies
for FILE in /lib/udev/*_id
do
if [ ! -e "${DESTDIR}/${FILE}" ]
Expand All @@ -73,15 +53,15 @@ do
fi
done

# wheezy/sid
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
[ "${QUIET}" ] || echo -n " filesystems"

[ "${QUIET}" ] || echo -n " "filesystems
# Configuration: keymap (usefull when using encryption)
if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
then
Expand Down Expand Up @@ -147,7 +127,7 @@ manual_add_modules vfat
# Filesystem: ntfs
manual_add_modules ntfs

[ "${QUIET}" ] || echo -n " "devices
[ "${QUIET}" ] || echo -n " devices"
# Hardware: cdrom
manual_add_modules ide-cd
manual_add_modules ide-generic
Expand All @@ -167,7 +147,7 @@ then
copy_exec /usr/bin/eject /bin
fi

[ "${QUIET}" ] || echo -n " "utils
[ "${QUIET}" ] || echo -n " utils"

# Feature: Verify Checksums
copy_exec /usr/bin/sha256sum /bin
Expand All @@ -176,7 +156,7 @@ copy_exec /usr/bin/md5sum /bin
# Program: memdisk
if [ -x /usr/bin/memdiskfind ]
then
[ "${QUIET}" ] || echo -n :memdisk
[ "${QUIET}" ] || echo -n " memdisk"
copy_exec /usr/bin/memdiskfind
manual_add_modules phram
manual_add_modules mtdblock
Expand All @@ -185,26 +165,26 @@ fi
# Program: udev
if [ -x /sbin/udevadm ]
then
[ "${QUIET}" ] || echo -n " "udev
[ "${QUIET}" ] || echo -n " udev"
copy_exec /sbin/udevadm /sbin
fi
if [ -x /usr/bin/udevinfo ]
then
[ "${QUIET}" ] || echo -n " "udev
[ "${QUIET}" ] || echo -n " udev"
copy_exec /usr/bin/udevinfo /bin
fi

# Program: wget
if [ -x /usr/bin/wget ]
then
[ "${QUIET}" ] || echo -n " "wget
[ "${QUIET}" ] || echo -n " wget"
copy_exec /usr/bin/wget /bin
fi

# Program: blockdev
if [ -x /sbin/blockdev ]
then
[ "${QUIET}" ] || echo -n " "blockdev
[ "${QUIET}" ] || echo -n " blockdev"
copy_exec /sbin/blockdev /sbin
fi

Expand All @@ -214,49 +194,55 @@ manual_add_modules fuse
# FUSE filesystem: httpfs2
if [ -x /usr/bin/httpfs2_ssl ]
then
[ "${QUIET}" ] || echo -n " "httpfs:ssl
[ "${QUIET}" ] || echo -n " httpfs:ssl"
copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
elif [ -x /usr/bin/httpfs2 ]
then
[ "${QUIET}" ] || echo -n " "httpfs
[ "${QUIET}" ] || echo -n " httpfs"
copy_exec /usr/bin/httpfs2 /bin/httpfs
fi

# FUSE filesystem: curlftpfs
if [ -x /usr/bin/curlftpfs ]
then
[ "${QUIET}" ] || echo -n " "ftpfs
[ "${QUIET}" ] || echo -n " ftpfs"
copy_exec /usr/bin/curlftpfs /bin
fi

# iSCSI
if [ -x /usr/sbin/iscsistart ]
then
[ "${QUIET}" ] || echo -n " "iscsi
[ "${QUIET}" ] || echo -n " iscsi"
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
[ "${QUIET}" ] || echo -n " "dns
#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
# Some experimental stuff

if [ "${LIVE_UNIONMOUNT}" = "true" ]
then
[ "${QUIET}" ] || echo -n " "unionmount
# UnionMount
# only mount from patched util-linux can do this currently
copy_exec /bin/mount /bin/mount_full
fi
case "${LIVE_DNS}" in
true)
[ "${QUIET}" ] || echo -n " dns"

#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
;;
esac

case "${LIVE_UNIONMOUNT}" in
true)
[ "${QUIET}" ] || echo -n " unionmount"

# UnionMount
# only mount from patched util-linux can do this currently
copy_exec /bin/mount /bin/mount_full
;;
esac

[ "${QUIET}" ] || echo .

0 comments on commit 7167a10

Please sign in to comment.