From dbcae19129fb310cef3330d9e8342602e2845589 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 11 Nov 2009 17:25:50 +0100 Subject: Renaming example hooks and prefixing them with distribution name. --- .../hooks/all_binary_debian-installer-banner.sh | 34 ++ examples/hooks/all_binary_live-helper.sh | 24 ++ examples/hooks/all_chroot_hal-automount.sh | 16 + examples/hooks/all_chroot_kernel-purge.sh | 10 + examples/hooks/all_chroot_linux-modules.sh | 15 + examples/hooks/all_chroot_localepurge.sh | 22 + examples/hooks/all_chroot_losetup-lukshome.sh | 460 +++++++++++++++++++++ examples/hooks/all_chroot_rt2570-modules.sh | 19 + examples/hooks/all_chroot_sun-java6.sh | 28 ++ examples/hooks/all_chroot_update-initramfs.sh | 15 + examples/hooks/all_chroot_virtualbox-ose.sh | 8 + examples/hooks/aufs.sh | 23 -- examples/hooks/beryl.sh | 80 ---- examples/hooks/etch_chroot_beryl.sh | 80 ++++ examples/hooks/etch_chroot_ipw2100-modules.sh | 32 ++ examples/hooks/etch_chroot_ipw2200-modules.sh | 32 ++ examples/hooks/etch_chroot_ipw3945-modules.sh | 29 ++ examples/hooks/etch_chroot_unionfs-modules.sh | 23 ++ examples/hooks/hal-automount.sh | 16 - examples/hooks/ipw2100.sh | 32 -- examples/hooks/ipw2200.sh | 32 -- examples/hooks/ipw3945.sh | 29 -- examples/hooks/kde-no-pdf-drm.sh | 27 -- examples/hooks/kernelpurge.sh | 10 - .../hooks/lenny_binary_live-installer-usbfix.sh | 96 +++++ examples/hooks/lenny_chroot_aufs-modules.sh | 23 ++ examples/hooks/lenny_chroot_kpdf-nodrm.sh | 18 + examples/hooks/lenny_chroot_madwifi-modules.sh | 26 ++ .../hooks/lenny_chroot_nvidia-legacy-modules.sh | 56 +++ examples/hooks/lenny_chroot_squashfs-modules.sh | 23 ++ examples/hooks/lenny_chroot_sun-java5.sh | 28 ++ examples/hooks/live-helper.sh | 24 -- examples/hooks/live-installer_lenny-usbfix.sh | 96 ----- examples/hooks/localepurge.sh | 22 - examples/hooks/losetup-lukshome.sh | 460 --------------------- examples/hooks/madwifi.sh | 26 -- examples/hooks/modules.sh | 15 - examples/hooks/nvidia-legacy.sh | 56 --- examples/hooks/replace-di-banner.sh | 34 -- examples/hooks/rt2570.sh | 19 - examples/hooks/rt2x00.sh | 31 -- examples/hooks/squashfs.sh | 23 -- examples/hooks/squeeze_chroot_okular-nodrm.sh | 18 + examples/hooks/sun-java5.sh | 28 -- examples/hooks/sun-java6.sh | 28 -- examples/hooks/unionfs.sh | 23 -- examples/hooks/update-initramfs.sh | 15 - examples/hooks/virtualbox-ose.sh | 8 - 48 files changed, 1135 insertions(+), 1157 deletions(-) create mode 100755 examples/hooks/all_binary_debian-installer-banner.sh create mode 100755 examples/hooks/all_binary_live-helper.sh create mode 100755 examples/hooks/all_chroot_hal-automount.sh create mode 100755 examples/hooks/all_chroot_kernel-purge.sh create mode 100755 examples/hooks/all_chroot_linux-modules.sh create mode 100755 examples/hooks/all_chroot_localepurge.sh create mode 100755 examples/hooks/all_chroot_losetup-lukshome.sh create mode 100755 examples/hooks/all_chroot_rt2570-modules.sh create mode 100755 examples/hooks/all_chroot_sun-java6.sh create mode 100755 examples/hooks/all_chroot_update-initramfs.sh create mode 100755 examples/hooks/all_chroot_virtualbox-ose.sh delete mode 100755 examples/hooks/aufs.sh delete mode 100755 examples/hooks/beryl.sh create mode 100755 examples/hooks/etch_chroot_beryl.sh create mode 100755 examples/hooks/etch_chroot_ipw2100-modules.sh create mode 100755 examples/hooks/etch_chroot_ipw2200-modules.sh create mode 100755 examples/hooks/etch_chroot_ipw3945-modules.sh create mode 100755 examples/hooks/etch_chroot_unionfs-modules.sh delete mode 100755 examples/hooks/hal-automount.sh delete mode 100755 examples/hooks/ipw2100.sh delete mode 100755 examples/hooks/ipw2200.sh delete mode 100755 examples/hooks/ipw3945.sh delete mode 100755 examples/hooks/kde-no-pdf-drm.sh delete mode 100755 examples/hooks/kernelpurge.sh create mode 100755 examples/hooks/lenny_binary_live-installer-usbfix.sh create mode 100755 examples/hooks/lenny_chroot_aufs-modules.sh create mode 100755 examples/hooks/lenny_chroot_kpdf-nodrm.sh create mode 100755 examples/hooks/lenny_chroot_madwifi-modules.sh create mode 100755 examples/hooks/lenny_chroot_nvidia-legacy-modules.sh create mode 100755 examples/hooks/lenny_chroot_squashfs-modules.sh create mode 100755 examples/hooks/lenny_chroot_sun-java5.sh delete mode 100755 examples/hooks/live-helper.sh delete mode 100755 examples/hooks/live-installer_lenny-usbfix.sh delete mode 100755 examples/hooks/localepurge.sh delete mode 100755 examples/hooks/losetup-lukshome.sh delete mode 100755 examples/hooks/madwifi.sh delete mode 100755 examples/hooks/modules.sh delete mode 100755 examples/hooks/nvidia-legacy.sh delete mode 100755 examples/hooks/replace-di-banner.sh delete mode 100755 examples/hooks/rt2570.sh delete mode 100755 examples/hooks/rt2x00.sh delete mode 100755 examples/hooks/squashfs.sh create mode 100755 examples/hooks/squeeze_chroot_okular-nodrm.sh delete mode 100755 examples/hooks/sun-java5.sh delete mode 100755 examples/hooks/sun-java6.sh delete mode 100755 examples/hooks/unionfs.sh delete mode 100755 examples/hooks/update-initramfs.sh delete mode 100755 examples/hooks/virtualbox-ose.sh diff --git a/examples/hooks/all_binary_debian-installer-banner.sh b/examples/hooks/all_binary_debian-installer-banner.sh new file mode 100755 index 0000000..7be8682 --- /dev/null +++ b/examples/hooks/all_binary_debian-installer-banner.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# This is an binary hook for live-helper(7) to overwrite the banner +# in the graphical Debian Installer. +# To enable it, copy or symlink this hook into your config/binary_local-hooks +# directory and add a replacement banner.png at: +# +# config/binary_local-includes/binary/install/banner.png +# +# The file should be a PNG image of dimensions 800 x 75. + +set -e + +if [ -e config/binary_debian-installer/banner.png ] +then + TARGET_INITRD="binary/install/gtk/initrd.gz" + REPACK_TMPDIR="binary.initrd" + + if [ -e "${TARGET_INITRD}" ] + then + # cpio does not have a "extract to directory", so we must change + # directory + mkdir -p ${REPACK_TMPDIR} + cd ${REPACK_TMPDIR} + gzip -d < ../${TARGET_INITRD} | cpio -i --make-directories --no-absolute-filenames + + # Overwrite banner + cp ../config/binary_debian-installer/banner.png ./usr/share/graphics/logo_debian.png + + find | cpio -H newc -o | gzip -9 > ../${TARGET_INITRD} + cd .. + rm -rf ${REPACK_TMPDIR} + fi +fi diff --git a/examples/hooks/all_binary_live-helper.sh b/examples/hooks/all_binary_live-helper.sh new file mode 100755 index 0000000..c1823b3 --- /dev/null +++ b/examples/hooks/all_binary_live-helper.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install live-helper and its config into +# the binary image. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +DIRECTORY="binary/tools/live" + +mkdir -p "${DIRECTORY}" + +cp -a config "${DIRECTORY}" + +if [ -e live-helper ] +then + cp -a live-helper "${DIRECTORY}" +else + mkdir -p "${DIRECTORY}"/live-helper/bin + cp -a /usr/bin/lh* "${DIRECTORY}"/live-helper/bin + + cp -a /usr/share/live-helper "${DIRECTORY}"/live-helper/share + + cp -a /usr/share/doc/live-helper "${DIRECTORY}"/live-helper/doc +fi diff --git a/examples/hooks/all_chroot_hal-automount.sh b/examples/hooks/all_chroot_hal-automount.sh new file mode 100755 index 0000000..0fec6f9 --- /dev/null +++ b/examples/hooks/all_chroot_hal-automount.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to enable automaunting with hal for block devices. +# +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +# Remove automount disabling +rm -f /usr/share/hal/fdi/policy/10osvendor/debian-storage-policy-fixed-drives.fdi + +# Use ntfs-3g by default to mount ntfs partitions +if [ -x /usr/bin/ntfs-3g ] +then + rm -f /sbin/mount.ntfs + ln -s /usr/bin/ntfs-3g /sbin/mount.ntfs +fi diff --git a/examples/hooks/all_chroot_kernel-purge.sh b/examples/hooks/all_chroot_kernel-purge.sh new file mode 100755 index 0000000..188f6a4 --- /dev/null +++ b/examples/hooks/all_chroot_kernel-purge.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to remove any kernel except the newest one. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +for VERSION in $(basename $(ls /boot/vmlinuz-* | head -n-1) | sed -e 's|^vmlinuz-||g') +do + echo apt-get remove --purge linux-image-${VERSION} +done diff --git a/examples/hooks/all_chroot_linux-modules.sh b/examples/hooks/all_chroot_linux-modules.sh new file mode 100755 index 0000000..159e9bc --- /dev/null +++ b/examples/hooks/all_chroot_linux-modules.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to add entries to /etc/modules. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +MODULES="" + +for MODULE in ${MODULES} +do + if ! grep -qs /etc/modules ${MODULE} + then + echo ${MODULE} >> /etc/modules + fi +done diff --git a/examples/hooks/all_chroot_localepurge.sh b/examples/hooks/all_chroot_localepurge.sh new file mode 100755 index 0000000..3fbb4c4 --- /dev/null +++ b/examples/hooks/all_chroot_localepurge.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install localepurge. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# + +cat > /tmp/localepurge.preseed << EOF +localepurge localepurge/nopurge multiselect en +#localepurge localepurge/mandelete boolean true +#localepurge localepurge/dontbothernew boolean false +localepurge localepurge/showfreedspace boolean false +#localepurge localepurge/quickndirtycalc boolean true +#localepurge localepurge/verbose boolean false +EOF +debconf-set-selections < /tmp/localepurge.preseed +rm -f /tmp/localepurge.preseed + +apt-get install --yes localepurge +dpkg-reconfigure localepurge + +localepurge diff --git a/examples/hooks/all_chroot_losetup-lukshome.sh b/examples/hooks/all_chroot_losetup-lukshome.sh new file mode 100755 index 0000000..5542438 --- /dev/null +++ b/examples/hooks/all_chroot_losetup-lukshome.sh @@ -0,0 +1,460 @@ +#!/bin/sh + +# This hook was based and adapted from: +# http://lists.debian.org/debian-live/2009/04/msg00186.html +# --------------------------------------------------------- +# +# +# NOTE 1: this was not tested with persistent boot option, +# but it seems logic that persistent and lukshome can't +# coexist as boot options (because of snapshots and others), so lukshome +# won't be executed if any persistent option is given on boot. +# +# NOTE 2: if using an USB key, it will eventualy end up failing someday. +# You should backup the encrypted disk image file itself (luks-home.img) to +# prevent loosing your data. +# +# This hook will create 3 files: +# +# /usr/local/sbin/create-lukshome-file.sh +# script to create an disk file image (luks-home.img) with a +# LUKS encrypted ext2 filesystem inside to be placed in a +# partition labeled lukshome. +# +# /usr/local/sbin/lukshome.sh +# detects a partition with lukshome label, updates fstab and crypttab so +# the encrypted file is mounted later in a loopback device (/dev/loopX). +# It also changes /etc/init.d/umountfs so the encrypted home is correctly +# umounted. +# +# /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home +# a live-initramfs hook to execute lukshome.sh script +# in initrd. +# +# +# HOWTO lukshome +# -------------- +# +# First build your live system with this hook inside config/chroot_local-hooks/. +# If you have an existing live-helper build directory with a previous live +# build, you might have to run +# +# lh_clean +# lh_clean --stage +# +# to make sure this hook is included in the live system. Then (re)build your +# live system. +# +# lh_build +# +# After booting your (re)built live system, setup the encrypted losetup +# filesystem to be used as /home using the instructions present in the +# create-lukshome-file.sh script. +# +# Reboot and now use the "lukshome" boot option to mount the encrypted /home, +# like in using "persistent" boot option with a home-rw file in some partition. +# + + +echo "I: to see how use lukshome hook run create-lukshome-file.sh as root." +echo "I: creating script /usr/local/sbin/create-lukshome-file.sh" +cat > /usr/local/sbin/create-lukshome-file.sh << 'EOF' +#!/bin/sh + +# This script is to create an encrypted filesystem in a file to +# be used as /home in a live system built with Debian Live Helper with +# the lukshome hook in config/chroot_local-hooks/. +# +# The lukshome boot option will do the following: +# - search for a partition with label 'lukshome' +# (btw, you can't use the live system partition itself) +# - mount the partition as /luks-home in the live system +# - open /luks-home/luks-home.img file as a loopback device (/dev/loop) +# - open the loopback device with cryptsetup +# - mount the encrypted filesystem as /home +# +# This script will only create the luks-home.img file. Next are details of how +# to use this script. +# +# CAUTION! THIS CAN WIPE YOUR DATA, backup first! +# Be sure to understand what you will do, or you can end up +# wiping disks or partitions you don't want to! +# +# Login as root: +# $ sudo -i +# +# Create a mountpoint (don't use /mnt, it will be used by this script): +# # mkdir /media/target +# +# !!! *** Skip the next line if you don't want to wipe a partition *** !!! +# !!! * Just change the partition label to 'lukshome' (without quotes) * !!! +# Create an ext2 filesystem in a partition with 'lukshome' label: +# # mkfs.ext2 -L lukshome /dev/the_partition_to_be_used +# +# Mount the partition and cd into it: +# # mount /dev/the_partition_to_be_used /media/target +# # cd /media/target +# +# Create the encrypted file: +# # create-lukshome-file.sh +# +# The script is located in /usr/local/sbin/, so it's in root $PATH. +# It will copy the directories in /home/* into the file. +# Now return to $HOME to be able to umount the target partition: +# # cd +# +# Umount the target partition: +# # umount /media/target +# +# Reboot and use the "lukshome" boot option to mount the encrypted /home, +# like in using "persistent" boot option with a home-rw file in some partition. +# +# Press Shift-PgUp/Shift-PgDn to scrool the instructions on the screen. + + +# check if root/sudo +if [ "${USER}" != "root" ] +then + echo " ** Please run this script as root or with sudo." + exit 1 +fi + +# check if /mnt is available and empty +mount | grep "/mnt" > /dev/null +MNT_IS_MOUNTED=${?} +if [ "${MNT_IS_MOUNTED}" == 0 ] +then + echo "** ERROR: /mnt is mounted at the moment. Please umount it to use this script." + exit 1 +fi +if [ "$(ls -A /mnt)" ] +then + echo "** ERROR: /mnt is not empty. An empty /mnt is needed to use this script." + exit 1 +fi + +# check if /dev/mapper/luks-home is available +if [ -f /dev/mapper/luks-home ] +then + echo "** ERROR: /dev/mapper/luks-home is being used at the moment. Please run «cryptsetup remove luks-home» to use this script." + exit 1 +fi + + +# show instructions +echo "" +echo "** Instructions to use create-lukshome-file.sh (this script):" +sed -n '2,51p' /usr/local/sbin/create-lukshome-file.sh | sed 's/^.//' +echo "" + + +# proceed? +echo "** Do you want to proceed with this script? (y/N)" +read CONFIRM + +case "${CONFIRM}" in + y*|Y*) + echo "" + ;; + *) + exit 0 + ;; +esac + + +# create file +echo "" +echo "** Please type the size of the file disk image." +echo "Size of the file in MB: " +read FILE_SIZE + +echo "" +echo "** Creating file luks-home.img." +echo "** Filling file image with /dev/urandom output. It will take some time." +echo "(Edit this script to use /dev/random. It's know to more secure but " +echo "it will take a *very* long time to complete." +dd if=/dev/urandom of=luks-home.img bs=1M count=${FILE_SIZE} +# To use /dev/random comment the line above and uncomment the next line +#dd if=/dev/random of=luks-home.img ibs=128 obs=128 count=$((8192*${FILE_SIZE})) +# You might have to increase kernel entropy by moving the mouse, typing keyboard, +# make the computer read disk or use network connections. +echo "** Done." +echo "" + +# losetup +FREE_LOSETUP=$(losetup -f) +echo "** Using ${FREE_LOSETUP} to open luks-home.img" +losetup ${FREE_LOSETUP} ./luks-home.img +echo "** Done." +echo "" + +# cryptsetup +echo "** Running cryptsetup." +echo "" +echo "** luksFormat" +cryptsetup luksFormat ${FREE_LOSETUP} +EXIT_CODE=${?} +if [ "${EXIT_CODE}" != 0 ] +then + echo "** ERROR: Error while trying to format disk file image." + losetup -d ${FREE_LOSETUP} + exit 1 +fi +echo "" + +echo "** luksOpen" +cryptsetup luksOpen ${FREE_LOSETUP} luks-home +EXIT_CODE=${?} +if [ "${EXIT_CODE}" != 0 ] +then + echo "** ERROR: Error while trying to open LUKS file image." + losetup -d ${FREE_LOSETUP} + exit 1 +fi +echo "" + +# format encrypted filesystem +echo "** Now formating /dev/mapper/luks-home" +mkfs.ext2 /dev/mapper/luks-home +EXIT_CODE=${?} +if [ "${EXIT_CODE}" != 0 ] +then + echo "** ERROR: Error while trying to format LUKS file." + cryptsetup remove luks-home + losetup -d ${FREE_LOSETUP} + exit 1 +fi +echo "" + +# mount in /mnt +echo "** Now mounting luks-home.img in /mnt" +mount /dev/mapper/luks-home /mnt +EXIT_CODE=${?} +if [ "${EXIT_CODE}" != 0 ] +then + echo "** ERROR: Error while trying to mount LUKS file in /mnt." + umount /mnt + cryptsetup remove luks-home + losetup -d ${FREE_LOSETUP} + exit 1 +fi +echo "" + +# copy files +HOME_DIR="/home/*" + +echo "** Copying ${HOME_DIR}." +cp -rav ${HOME_DIR} /mnt +EXIT_CODE=${?} +if [ "${EXIT_CODE}" != 0 ] +then + echo "** ERROR: Error while trying to copy files to /mnt." + umount /mnt + cryptsetup remove luks-home + losetup -d ${FREE_LOSETUP} + exit 1 +fi +echo "** Done." +echo "" + +echo "** All done." +echo "** Closing losetup, cryptsetup and mounted /mnt." +# umount and close +umount /mnt +cryptsetup remove luks-home +losetup -d ${FREE_LOSETUP} +echo "** The disk file image luks-home.img is done and ready. Move it into a partition" +echo "** with 'lukshome' as label and reboot with lukshome boot option to use it." +echo "" + +EOF + +chmod 0755 /usr/local/sbin/create-lukshome-file.sh + + + +echo "I: creating script /usr/local/sbin/lukshome.sh" +cat > /usr/local/sbin/lukshome.sh << 'EOF' +#!/bin/sh + +# this script is to be executed by a hook in live-initramfs. It searches +# for a partition with 'lukshome' label, mounts it as /luks-home, then opens an +# encrypted disk image file called luks-home.img as a loopback device, opens it +# with cryptsetup and finally mounts the present filesystem as /home. +# It also changes /etc/init.d/umountfs to umount the lukshome partition +# (/luks-home) and clear the loopback device on shutdown. + +# functions taken from live-helpers +. /usr/share/initramfs-tools/scripts/live-helpers + +# search for a partition labeled "lukshome" +for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd) +do + for dev in $(subdevices "${sysblock}") + do + devname=$(sys2dev "${dev}") + # find partition name and filesystem type + if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "lukshome" ] + then + # found one partition named "lukshome" + CRYPTHOME="${devname}" + # don't search further + break + fi + done + # if already found, don't search further + if [ -n "${CRYPTHOME}" ] + then + break + fi +done + +# if no partition found, exit +if [ -z "${CRYPTHOME}" ] +then + echo "Could not find any partition with lukshome label. " + echo "Proceeding with no encrypted /home." + exit 0 +fi + +# mount partition where file container is +echo "Mounting /luks-home with ${CRYPTHOME}." +mkdir -p /luks-home +mount -t $(get_fstype "${CRYPTHOME}") "${CRYPTHOME}" /luks-home + +# mount losetup encrypted file +FREE_LOOP="$(/sbin/losetup -f)" +echo "Opening /luks-home/luks-home.img in ${FREE_LOOP}." + +if [ -f /luks-home/luks-home.img ] +then + /sbin/losetup ${FREE_LOOP} /luks-home/luks-home.img + + echo "Adding ${FREE_LOOP} home to /etc/crypttab and setting it as /home in /etc/fstab." + + # update crypttab + echo "home ${FREE_LOOP} none luks,check,timeout" >> /etc/crypttab + + # update fstab + echo "/dev/mapper/home /home ext2 defaults,noatime 0 0" >> /etc/fstab +else + echo "Did not found any luks-home.img file in ${CRYPTHOME}!" + echo "Proceeding with no encrypted /home." + umount -r /luks-home + exit 0 +fi + +# changes to /etc/init.d/umountfs to make /luks-home being umounted on shutdown +sed -i 's/[\t]do_stop/CHANGE_HERE/' /etc/init.d/umountfs +sed -i 's|CHANGE_HERE| \ + # added by lukshome hook - umount \/luks-home to prevent busy device on shutdown \ + LOOP_LUKSHOME=$(losetup -a \| grep luks-home \|cut -c 1-10) \ + if [ -n ${LOOP_LUKSHOME} ] \ + then \ + umount -r -d \/home \ + cryptsetup remove home \ + losetup -d ${LOOP_LUKSHOME} \ + umount -r \/luks-home \ + fi \ +\ + do_stop \ +|' /etc/init.d/umountfs + +EOF + +chmod 0755 /usr/local/sbin/lukshome.sh + + + +# scripts/live-bottom/13live_luks_home, right after 12fstab +echo "I: creating /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home" + +cat > /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home << 'EOF' +#!/bin/sh + +#set -e + +# initramfs-tools header + +PREREQ="" + +prereqs() +{ + echo "${PREREQ}" +} + +case "${1}" in + prereqs) + prereqs + exit 0 + ;; +esac + +. /scripts/live-functions + +# live-initramfs hook to use an disk image file with encrypted filesystem as /home. + +log_begin_msg "Executing losetup-lukshome" + +# get boot option lukshome - adapted from live-helpers +for ARGUMENT in $(cat /proc/cmdline) +do + case "${ARGUMENT}" in + lukshome) + LUKSHOME=1 + ;; + esac +done + +# don't use persistent* and lukshome +if [ -n "${PERSISTENT}" ] && [ -n "${LUKSHOME}" ] +then + echo "You should not use persistent and lukshome at the same time." + echo "Skipping lukshome. Persistent medium, if any, will be used instead." + log_end_msg + exit 0 +fi + +# if no lukshome boot option, exit +if [ -z "${LUKSHOME}" ] +then + log_end_msg + exit 0 +fi + +log_begin_msg "Executing lukshome.sh script." + +mount -o bind /sys /root/sys +mount -o bind /proc /root/proc +mount -o bind /dev /root/dev + +# lukshome.sh detects lukshome partition and file location, mounts it +# and opens the file and then updates fstab and crypttab to use it as /home. +chroot /root /usr/local/sbin/lukshome.sh + +umount /root/sys +umount /root/proc +umount /root/dev + +# delete the lukshome scripts, not needed anymore +# rm -f /root/usr/local/sbin/lukshome.sh +# rm -f /root/usr/local/sbin/create-lukshome-file.sh + +log_end_msg + +EOF + +chmod 0755 /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home + + + +echo "I: update-initramfs to include 13live_luks_home." +# if you already have installed the update-initramfs.sh hook, you can remove +# this. + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + update-initramfs -k ${VERSION} -t -u +done diff --git a/examples/hooks/all_chroot_rt2570-modules.sh b/examples/hooks/all_chroot_rt2570-modules.sh new file mode 100755 index 0000000..408b138 --- /dev/null +++ b/examples/hooks/all_chroot_rt2570-modules.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install ralink rt2570 drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +apt-get install --yes build-essential + +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install rt2570-source -l ${VERSION} +done + +module-assistant clean rt2570-source diff --git a/examples/hooks/all_chroot_sun-java6.sh b/examples/hooks/all_chroot_sun-java6.sh new file mode 100755 index 0000000..c86066f --- /dev/null +++ b/examples/hooks/all_chroot_sun-java6.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install sun-java. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the non-free category. Make sure you +# enabled it in your configuration. + +# live-helper sets DEBIAN_FRONTEND to 'noninteractive' to advise debconf to not +# ask any questions while installing packages. Suns redistribution terms for +# Java do not allow this, therefore we need to overwrite DEBIAN_FRONTEND for +# this apt-get call only. + +# In case you do accept the license terms, you can also preseed the values +# for a complete non-interactive build, by uncommenting the following three lines: + +#echo "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true" > /root/preseed +#debconf-set-selections < /root/preseed +#rm -f /root/preseed + +DEBIAN_FRONTEND="dialog" apt-get install --yes sun-java6-bin sun-java6-demo \ + sun-java6-doc sun-java6-fonts sun-java6-jdk sun-java6-jre \ + sun-java6-plugin sun-java6-source + +# Ensure that /tmp has the right permissions; apparently sun-java5-doc tampers +# with it +chmod 1777 /tmp diff --git a/examples/hooks/all_chroot_update-initramfs.sh b/examples/hooks/all_chroot_update-initramfs.sh new file mode 100755 index 0000000..5179f77 --- /dev/null +++ b/examples/hooks/all_chroot_update-initramfs.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to rebuild the initramfs image. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: You only want to use this hook if you have modified any initramfs-script +# during the build and need to refresh the initrd.img for that purpose. + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + update-initramfs -k ${VERSION} -t -u +done diff --git a/examples/hooks/all_chroot_virtualbox-ose.sh b/examples/hooks/all_chroot_virtualbox-ose.sh new file mode 100755 index 0000000..bcf7289 --- /dev/null +++ b/examples/hooks/all_chroot_virtualbox-ose.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to enable virtualbox-ose module. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +# Enabling loading of vboxdrv +sed -i -e 's|^LOAD_VBOXDRV_MODULE=.*$|LOAD_VBOXDRV_MODULE=1|' /etc/default/virtualbox-ose diff --git a/examples/hooks/aufs.sh b/examples/hooks/aufs.sh deleted file mode 100755 index e70dcc7..0000000 --- a/examples/hooks/aufs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install aufs drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: You only want to use this hook if there is no prebuild aufs-modules-* -# package available for your kernel flavour. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install aufs -l ${VERSION} -done - -module-assistant clean aufs diff --git a/examples/hooks/beryl.sh b/examples/hooks/beryl.sh deleted file mode 100755 index ad4cb81..0000000 --- a/examples/hooks/beryl.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install beryl and enable aiglx. -# It was originally written by Inigo Tejedor Arrondo . -# -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# For forcing aiglx activation type at boot prompt "live forceaiglx". -# For forcing aiglx deactivation type "live noaiglx". - -# Importing archive signing key -wget -O - http://debian.beryl-project.org/root@lupine.me.uk.gpg | apt-key add - - -# Updating indices -apt-get update - -# Installing packages -PACKAGES="beryl beryl-core beryl-manager beryl-plugins beryl-settings beryl-settings-bindings beryl-settings-simple mesa-utils" - -dpkg -s gnome-core > /dev/null 2>&1 && PACKAGES="${PACKAGES} emerald emerald-themes heliodor" -dpkg -s kde-core > /dev/null 2>&1 && PACKAGES="${PACKAGES} aquamarine" - -apt-get install --yes ${PACKAGES} - -# Adding init script -cat > /etc/init.d/aiglx << EOF -#!/bin/sh -activate_3d() -{ - activate_aiglx - activate_beryl -} - -activate_aiglx() -{ - echo "" >> /etc/X11/xorg.conf - echo "# Added by beryl-hook.sh" >> /etc/X11/xorg.conf - echo "Section \"Extensions\"" >> /etc/X11/xorg.conf - echo " Option \"Composite\" \"Enable\"" >> /etc/X11/xorg.conf - echo "EndSection" >> /etc/X11/xorg.conf - - sed -i -e "s/Section \"Device\""/"Section \"Device\"\n\t Option \"XAANoOffscreenPixmaps\" \"true\"\n\t Option \"AddARGBGLXVisuals\" \"on\"\n\t Option \"AllowGLXWithComposite\" \"true\"/" -e "s/Section \"Module\""/"Section \"Module\"\n\t Load \"i2c\"\n\t Load \"int10\"\n\t Load \"xtrap\"\n\t Load \"vbe\"/" /etc/X11/xorg.conf -} - -activate_beryl() -{ - # http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html - ! [ -d /etc/xdg/autostart ] && mkdir -p /etc/xdg/autostart - -cat > /etc/xdg/autostart/beryl-manager.desktop << EOS -[Desktop Entry] -Encoding=UTF-8 -Name=Beryl Manager -GenericName=3D Window Manager -Comment=Beryl Manager daemon -Icon= -Exec=beryl-starter -Terminal=false -Type=Application -Categories= -EOS - -cat > /usr/local/bin/beryl-starter << EOS -#!/bin/sh -glxinfo > /dev/null 2>&1 && beryl-manager -EOS - -chmod 0755 /usr/local/bin/beryl-starter -} - -if ! cat /proc/cmdline | grep noaiglx > /dev/null -then - echo "Configuring xorg for aiglx..." - activate_3d -fi -EOF - -chmod 0755 /etc/init.d/aiglx -update-rc.d aiglx defaults diff --git a/examples/hooks/etch_chroot_beryl.sh b/examples/hooks/etch_chroot_beryl.sh new file mode 100755 index 0000000..ad4cb81 --- /dev/null +++ b/examples/hooks/etch_chroot_beryl.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install beryl and enable aiglx. +# It was originally written by Inigo Tejedor Arrondo . +# +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# For forcing aiglx activation type at boot prompt "live forceaiglx". +# For forcing aiglx deactivation type "live noaiglx". + +# Importing archive signing key +wget -O - http://debian.beryl-project.org/root@lupine.me.uk.gpg | apt-key add - + +# Updating indices +apt-get update + +# Installing packages +PACKAGES="beryl beryl-core beryl-manager beryl-plugins beryl-settings beryl-settings-bindings beryl-settings-simple mesa-utils" + +dpkg -s gnome-core > /dev/null 2>&1 && PACKAGES="${PACKAGES} emerald emerald-themes heliodor" +dpkg -s kde-core > /dev/null 2>&1 && PACKAGES="${PACKAGES} aquamarine" + +apt-get install --yes ${PACKAGES} + +# Adding init script +cat > /etc/init.d/aiglx << EOF +#!/bin/sh +activate_3d() +{ + activate_aiglx + activate_beryl +} + +activate_aiglx() +{ + echo "" >> /etc/X11/xorg.conf + echo "# Added by beryl-hook.sh" >> /etc/X11/xorg.conf + echo "Section \"Extensions\"" >> /etc/X11/xorg.conf + echo " Option \"Composite\" \"Enable\"" >> /etc/X11/xorg.conf + echo "EndSection" >> /etc/X11/xorg.conf + + sed -i -e "s/Section \"Device\""/"Section \"Device\"\n\t Option \"XAANoOffscreenPixmaps\" \"true\"\n\t Option \"AddARGBGLXVisuals\" \"on\"\n\t Option \"AllowGLXWithComposite\" \"true\"/" -e "s/Section \"Module\""/"Section \"Module\"\n\t Load \"i2c\"\n\t Load \"int10\"\n\t Load \"xtrap\"\n\t Load \"vbe\"/" /etc/X11/xorg.conf +} + +activate_beryl() +{ + # http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html + ! [ -d /etc/xdg/autostart ] && mkdir -p /etc/xdg/autostart + +cat > /etc/xdg/autostart/beryl-manager.desktop << EOS +[Desktop Entry] +Encoding=UTF-8 +Name=Beryl Manager +GenericName=3D Window Manager +Comment=Beryl Manager daemon +Icon= +Exec=beryl-starter +Terminal=false +Type=Application +Categories= +EOS + +cat > /usr/local/bin/beryl-starter << EOS +#!/bin/sh +glxinfo > /dev/null 2>&1 && beryl-manager +EOS + +chmod 0755 /usr/local/bin/beryl-starter +} + +if ! cat /proc/cmdline | grep noaiglx > /dev/null +then + echo "Configuring xorg for aiglx..." + activate_3d +fi +EOF + +chmod 0755 /etc/init.d/aiglx +update-rc.d aiglx defaults diff --git a/examples/hooks/etch_chroot_ipw2100-modules.sh b/examples/hooks/etch_chroot_ipw2100-modules.sh new file mode 100755 index 0000000..e246eb2 --- /dev/null +++ b/examples/hooks/etch_chroot_ipw2100-modules.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install ipw2100 drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the contrib category. Make sure you enabled +# it in your configuration. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install ipw2100 -l ${VERSION} +done + +module-assistant clean ipw2100 + +# Installing firmware (http://ipw2100.sourceforge.net/firmware.php) +wget --referer "http://ipw2100.sourceforge.net/firmware.php" "http://ipw2100.sourceforge.net/firmware.php?i_agree_to_the_license=yes&f=ipw2100-fw-1.3.tgz" -O /tmp/ipw2100-fw-1.3.tgz + +cd /tmp +tar xfvz ipw2100-fw-1.3.tgz +mv ipw2100-1.3* /lib/firmware +rm -f ipw2100-fw-1.3.tgz +cd ${OLDPWD} diff --git a/examples/hooks/etch_chroot_ipw2200-modules.sh b/examples/hooks/etch_chroot_ipw2200-modules.sh new file mode 100755 index 0000000..145ca8b --- /dev/null +++ b/examples/hooks/etch_chroot_ipw2200-modules.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install ipw2200 drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the contrib category. Make sure you enabled +# it in your configuration. + +apt-get install --yes build-essential + +# Building kernel mdoule +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install ipw2200 -l ${VERSION} +done + +module-assistant clean ipw2200 + +# Installing firmware (http://ipw2200.sourceforge.net/firmware.php) +wget --referer "http://ipw2200.sourceforge.net/firmware.php" "http://ipw2200.sourceforge.net/firmware.php?i_agree_to_the_license=yes&f=ipw2200-fw-3.0.tgz" -O /tmp/ipw2200-fw-3.0.tgz + +cd /tmp +tar xfvz ipw2200-fw-3.0.tgz +cp ipw2200-fw-3.0/*.fw /lib/firmware/ +rm -rf ipw2200-fw-3.0* +cd ${OLDPWD} diff --git a/examples/hooks/etch_chroot_ipw3945-modules.sh b/examples/hooks/etch_chroot_ipw3945-modules.sh new file mode 100755 index 0000000..f805cf9 --- /dev/null +++ b/examples/hooks/etch_chroot_ipw3945-modules.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install ipw3945 drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the contrib and non-free category. Make +# sure you enabled it in your configuration. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install ipw3945 -l ${VERSION} +done + +module-assistant clean ipw3945 + +# Installing additional stuff +apt-get install firmware-ipw3945 ipw3945d + +# hackish, autorun regulatory daemon, update-rc.d will reject that +ln -s /etc/init.d/ipw3945d /etc/rc2.d/S19ipw3945d diff --git a/examples/hooks/etch_chroot_unionfs-modules.sh b/examples/hooks/etch_chroot_unionfs-modules.sh new file mode 100755 index 0000000..20f0886 --- /dev/null +++ b/examples/hooks/etch_chroot_unionfs-modules.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install unionfs drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: You only want to use this hook if there is no prebuild unionfs-modules-* +# package available for your kernel flavour. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install unionfs -l ${VERSION} +done + +module-assistant clean unionfs diff --git a/examples/hooks/hal-automount.sh b/examples/hooks/hal-automount.sh deleted file mode 100755 index 0fec6f9..0000000 --- a/examples/hooks/hal-automount.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to enable automaunting with hal for block devices. -# -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -# Remove automount disabling -rm -f /usr/share/hal/fdi/policy/10osvendor/debian-storage-policy-fixed-drives.fdi - -# Use ntfs-3g by default to mount ntfs partitions -if [ -x /usr/bin/ntfs-3g ] -then - rm -f /sbin/mount.ntfs - ln -s /usr/bin/ntfs-3g /sbin/mount.ntfs -fi diff --git a/examples/hooks/ipw2100.sh b/examples/hooks/ipw2100.sh deleted file mode 100755 index e246eb2..0000000 --- a/examples/hooks/ipw2100.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install ipw2100 drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the contrib category. Make sure you enabled -# it in your configuration. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install ipw2100 -l ${VERSION} -done - -module-assistant clean ipw2100 - -# Installing firmware (http://ipw2100.sourceforge.net/firmware.php) -wget --referer "http://ipw2100.sourceforge.net/firmware.php" "http://ipw2100.sourceforge.net/firmware.php?i_agree_to_the_license=yes&f=ipw2100-fw-1.3.tgz" -O /tmp/ipw2100-fw-1.3.tgz - -cd /tmp -tar xfvz ipw2100-fw-1.3.tgz -mv ipw2100-1.3* /lib/firmware -rm -f ipw2100-fw-1.3.tgz -cd ${OLDPWD} diff --git a/examples/hooks/ipw2200.sh b/examples/hooks/ipw2200.sh deleted file mode 100755 index 145ca8b..0000000 --- a/examples/hooks/ipw2200.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install ipw2200 drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the contrib category. Make sure you enabled -# it in your configuration. - -apt-get install --yes build-essential - -# Building kernel mdoule -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install ipw2200 -l ${VERSION} -done - -module-assistant clean ipw2200 - -# Installing firmware (http://ipw2200.sourceforge.net/firmware.php) -wget --referer "http://ipw2200.sourceforge.net/firmware.php" "http://ipw2200.sourceforge.net/firmware.php?i_agree_to_the_license=yes&f=ipw2200-fw-3.0.tgz" -O /tmp/ipw2200-fw-3.0.tgz - -cd /tmp -tar xfvz ipw2200-fw-3.0.tgz -cp ipw2200-fw-3.0/*.fw /lib/firmware/ -rm -rf ipw2200-fw-3.0* -cd ${OLDPWD} diff --git a/examples/hooks/ipw3945.sh b/examples/hooks/ipw3945.sh deleted file mode 100755 index f805cf9..0000000 --- a/examples/hooks/ipw3945.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install ipw3945 drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the contrib and non-free category. Make -# sure you enabled it in your configuration. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install ipw3945 -l ${VERSION} -done - -module-assistant clean ipw3945 - -# Installing additional stuff -apt-get install firmware-ipw3945 ipw3945d - -# hackish, autorun regulatory daemon, update-rc.d will reject that -ln -s /etc/init.d/ipw3945d /etc/rc2.d/S19ipw3945d diff --git a/examples/hooks/kde-no-pdf-drm.sh b/examples/hooks/kde-no-pdf-drm.sh deleted file mode 100755 index 6df0490..0000000 --- a/examples/hooks/kde-no-pdf-drm.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to configure KDE's PDF viewer to ignore -# manipulation restriction on "DRM protect" PDF documents. -# -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -if [ -d /usr/share/kde4/config ] -then - # KDE4 (squeeze/sid) - -cat > /usr/share/kde4/config/okularpartrc << EOF -[General] -ObeyDRM=false -EOF - -elif [ -d /usr/share/config ] -then - # KDE3 (etch/lenny) - -cat > /usr/share/config/kpdfpartrc << EOF -[General] -ObeyDRM=false -EOF - -fi diff --git a/examples/hooks/kernelpurge.sh b/examples/hooks/kernelpurge.sh deleted file mode 100755 index 188f6a4..0000000 --- a/examples/hooks/kernelpurge.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to remove any kernel except the newest one. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -for VERSION in $(basename $(ls /boot/vmlinuz-* | head -n-1) | sed -e 's|^vmlinuz-||g') -do - echo apt-get remove --purge linux-image-${VERSION} -done diff --git a/examples/hooks/lenny_binary_live-installer-usbfix.sh b/examples/hooks/lenny_binary_live-installer-usbfix.sh new file mode 100755 index 0000000..ded8b80 --- /dev/null +++ b/examples/hooks/lenny_binary_live-installer-usbfix.sh @@ -0,0 +1,96 @@ +#!/bin/sh + +echo "BINARY-HOOK: fix install from USB in Lenny." + +# This is a *binary-hook* to allow disk installations from USB for +# Debian 5.0.x Lenny. Place this file in config/binary_local-hooks/, +# make it executable and rebuild your live image (binary only). + +# This workaround for debian-installer was adapted from Chris Lamb +original patch: +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498143#5 + +# It works by fooling apt-setup. With an existing /hd-media directory +# apt-setup will not try to umount /cdrom. Enable live installer with +# lh_config: +# +# lh_config --debian-installer "live" +# +# Rebuild your binary image. No options needed on boot. + +cat > cdrom-detect.postinst.patch << 'EOF' +@@ -44,6 +44,30 @@ do + fi + done + ++ # Try disk partitions masquerading as Debian CDs for Debian Live ++ # "usb-hdd" images. Only vfat and ext are supported. ++ modprobe vfat >/dev/null 2>&1 || true ++ for device in $(list-devices partition); do ++ if mount -t vfat -o ro,exec $device /cdrom || ++ mount -t ext2 -o ro,exec $device /cdrom; then ++ log "Pseudo CD-ROM mount succeeded: device=$device" ++ ++ # Test whether it's a Debian CD ++ if [ -e /cdrom/.disk/info ]; then ++ mounted=1 ++ db_set cdrom-detect/cdrom_device $device ++ # fake hd-media install so that apt-setup doesn't break. ++ mkdir /hd-media ++ break ++ else ++ log "Ignoring pseudo CD-ROM device $device - it is not a Debian CD" ++ umount /cdrom 2>/dev/null || true ++ fi ++ else ++ log "Psuedo CD-ROM mount failed: device=$device" ++ fi ++ done ++ + if [ "$mounted" = "1" ]; then + break + fi + +EOF + +# for the syslinux installer +mkdir usb-install-syslinux +cd usb-install-syslinux +zcat ../binary/install/initrd.gz | cpio -iv +patch ./var/lib/dpkg/info/cdrom-detect.postinst < ../cdrom-detect.postinst.patch +PATCH_ERROR=${?} +if [ "${PATCH_ERROR}" != 0 ] +then + # if there was an error, say it and undo everything. + echo "ERROR: error while patching cdrom-detect.postinst." + cd .. + rmdir -rf usb-install-syslinux + exit 0 +fi +# rebuild the initrd +find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd-new.gz +cd .. +mv initrd-new.gz binary/install/initrd.gz +rm -rf usb-install-syslinux + +# for the gtk installer +mkdir usb-install-gtk +cd usb-install-gtk +zcat ../binary/install/gtk/initrd.gz | cpio -iv +patch ./var/lib/dpkg/info/cdrom-detect.postinst < ../cdrom-detect.postinst.patch +PATCH_ERROR=${?} +if [ "${PATCH_ERROR}" != 0 ] +then + # if there was an error, say it and undo everything + echo "ERROR: error while patching cdrom-detect.postinst." + cd .. + rmdir -rf usb-install-gtk + exit 0 +fi +# rebuild the initrd +find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd-new.gz +cd .. +mv initrd-new.gz binary/install/gtk/initrd.gz +rm -rf usb-install-gtk + +rm cdrom-detect.postinst.patch diff --git a/examples/hooks/lenny_chroot_aufs-modules.sh b/examples/hooks/lenny_chroot_aufs-modules.sh new file mode 100755 index 0000000..e70dcc7 --- /dev/null +++ b/examples/hooks/lenny_chroot_aufs-modules.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install aufs drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: You only want to use this hook if there is no prebuild aufs-modules-* +# package available for your kernel flavour. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install aufs -l ${VERSION} +done + +module-assistant clean aufs diff --git a/examples/hooks/lenny_chroot_kpdf-nodrm.sh b/examples/hooks/lenny_chroot_kpdf-nodrm.sh new file mode 100755 index 0000000..99fa3e9 --- /dev/null +++ b/examples/hooks/lenny_chroot_kpdf-nodrm.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to configure KDE's PDF viewer to ignore +# manipulation restriction on "DRM protect" PDF documents. +# +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +if [ -d /usr/share/config ] +then + # KDE3 (etch/lenny) + +cat > /usr/share/config/kpdfpartrc << EOF +[General] +ObeyDRM=false +EOF + +fi diff --git a/examples/hooks/lenny_chroot_madwifi-modules.sh b/examples/hooks/lenny_chroot_madwifi-modules.sh new file mode 100755 index 0000000..0686c12 --- /dev/null +++ b/examples/hooks/lenny_chroot_madwifi-modules.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install madwifi drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the contrib category. Make sure you enabled +# it in your configuration. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install madwifi -l ${VERSION} +done + +module-assistant clean madwifi + +# Installing additional stuff +apt-get install --yes madwifi-tools diff --git a/examples/hooks/lenny_chroot_nvidia-legacy-modules.sh b/examples/hooks/lenny_chroot_nvidia-legacy-modules.sh new file mode 100755 index 0000000..66d67bc --- /dev/null +++ b/examples/hooks/lenny_chroot_nvidia-legacy-modules.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install nvidia-kernel-legacy drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the non-free category. Make sure you +# enabled it in your configuration. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant nvidia-kernel-common +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install nvidia-kernel-legacy -l ${VERSION} +done + +module-assistant clean nvidia-kernel-legacy + +# Installing additional stuff +apt-get install --yes nvidia-glx-legacy nvidia-xconfig discover + +# Fix #421028 +if [ -f /usr/lib/xorg/modules/drivers/nvidia_drv.o ] +then + cd /usr/lib/xorg/modules/drivers + gcc -shared -o nvidia_drv.so nvidia_drv.o + cd ${OLDPWD} +fi + +# Adding init script +cat > /etc/init.d/nvidia-debian-live << EOF +#!/bin/sh +# script that modify xorg configuration enabling +# the nvidia proprietary module if the card is detected +# as an NVidia + +if discover --type-summary display | grep -i nvidia +then + # forcing depth to 24, bad detection on some card (e.g my GeForce4 440 Go) + echo "Configuring Xorg for nvidia ..." + nvidia-xconfig -d 24 +else + # not with nvidia h/w ? remove those GLX diversions + # (FIXME) + apt-get --quiet --yes remove nvidia-glx-legacy +fi +EOF + +chmod 0755 /etc/init.d/nvidia-debian-live +update-rc.d nvidia-debian-live defaults diff --git a/examples/hooks/lenny_chroot_squashfs-modules.sh b/examples/hooks/lenny_chroot_squashfs-modules.sh new file mode 100755 index 0000000..20667e2 --- /dev/null +++ b/examples/hooks/lenny_chroot_squashfs-modules.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install squashfs drivers +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: You only want to use this hook if there is no prebuild +# squashfs-modules-* package available for your kernel flavour. + +apt-get install --yes build-essential + +# Building kernel module +which module-assistant || apt-get install --yes module-assistant +module-assistant update + +for KERNEL in /boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + module-assistant --non-inter --quiet auto-install squashfs -l ${VERSION} +done + +module-assistant clean squashfs diff --git a/examples/hooks/lenny_chroot_sun-java5.sh b/examples/hooks/lenny_chroot_sun-java5.sh new file mode 100755 index 0000000..139efd5 --- /dev/null +++ b/examples/hooks/lenny_chroot_sun-java5.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to install sun-java. +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. +# +# Note: This hook requires packages from the non-free category. Make sure you +# enabled it in your configuration. + +# live-helper sets DEBIAN_FRONTEND to 'noninteractive' to advise debconf to not +# ask any questions while installing packages. Suns redistribution terms for +# Java do not allow this, therefore we need to overwrite DEBIAN_FRONTEND for +# this apt-get call only. + +# In case you do accept the license terms, you can also preseed the values +# for a complete non-interactive build, by uncommenting the following three lines: + +#echo "sun-java5-bin shared/accepted-sun-dlj-v1-1 boolean true" > /root/preseed +#debconf-set-selections < /root/preseed +#rm -f /root/preseed + +DEBIAN_FRONTEND="dialog" apt-get install --yes sun-java5-bin sun-java5-demo \ + sun-java5-doc sun-java5-fonts sun-java5-jdk sun-java5-jre \ + sun-java5-plugin sun-java5-source + +# Ensure that /tmp has the right permissions; apparently sun-java5-doc tampers +# with it +chmod 1777 /tmp diff --git a/examples/hooks/live-helper.sh b/examples/hooks/live-helper.sh deleted file mode 100755 index c1823b3..0000000 --- a/examples/hooks/live-helper.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install live-helper and its config into -# the binary image. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -DIRECTORY="binary/tools/live" - -mkdir -p "${DIRECTORY}" - -cp -a config "${DIRECTORY}" - -if [ -e live-helper ] -then - cp -a live-helper "${DIRECTORY}" -else - mkdir -p "${DIRECTORY}"/live-helper/bin - cp -a /usr/bin/lh* "${DIRECTORY}"/live-helper/bin - - cp -a /usr/share/live-helper "${DIRECTORY}"/live-helper/share - - cp -a /usr/share/doc/live-helper "${DIRECTORY}"/live-helper/doc -fi diff --git a/examples/hooks/live-installer_lenny-usbfix.sh b/examples/hooks/live-installer_lenny-usbfix.sh deleted file mode 100755 index ded8b80..0000000 --- a/examples/hooks/live-installer_lenny-usbfix.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -echo "BINARY-HOOK: fix install from USB in Lenny." - -# This is a *binary-hook* to allow disk installations from USB for -# Debian 5.0.x Lenny. Place this file in config/binary_local-hooks/, -# make it executable and rebuild your live image (binary only). - -# This workaround for debian-installer was adapted from Chris Lamb -original patch: -# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498143#5 - -# It works by fooling apt-setup. With an existing /hd-media directory -# apt-setup will not try to umount /cdrom. Enable live installer with -# lh_config: -# -# lh_config --debian-installer "live" -# -# Rebuild your binary image. No options needed on boot. - -cat > cdrom-detect.postinst.patch << 'EOF' -@@ -44,6 +44,30 @@ do - fi - done - -+ # Try disk partitions masquerading as Debian CDs for Debian Live -+ # "usb-hdd" images. Only vfat and ext are supported. -+ modprobe vfat >/dev/null 2>&1 || true -+ for device in $(list-devices partition); do -+ if mount -t vfat -o ro,exec $device /cdrom || -+ mount -t ext2 -o ro,exec $device /cdrom; then -+ log "Pseudo CD-ROM mount succeeded: device=$device" -+ -+ # Test whether it's a Debian CD -+ if [ -e /cdrom/.disk/info ]; then -+ mounted=1 -+ db_set cdrom-detect/cdrom_device $device -+ # fake hd-media install so that apt-setup doesn't break. -+ mkdir /hd-media -+ break -+ else -+ log "Ignoring pseudo CD-ROM device $device - it is not a Debian CD" -+ umount /cdrom 2>/dev/null || true -+ fi -+ else -+ log "Psuedo CD-ROM mount failed: device=$device" -+ fi -+ done -+ - if [ "$mounted" = "1" ]; then - break - fi - -EOF - -# for the syslinux installer -mkdir usb-install-syslinux -cd usb-install-syslinux -zcat ../binary/install/initrd.gz | cpio -iv -patch ./var/lib/dpkg/info/cdrom-detect.postinst < ../cdrom-detect.postinst.patch -PATCH_ERROR=${?} -if [ "${PATCH_ERROR}" != 0 ] -then - # if there was an error, say it and undo everything. - echo "ERROR: error while patching cdrom-detect.postinst." - cd .. - rmdir -rf usb-install-syslinux - exit 0 -fi -# rebuild the initrd -find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd-new.gz -cd .. -mv initrd-new.gz binary/install/initrd.gz -rm -rf usb-install-syslinux - -# for the gtk installer -mkdir usb-install-gtk -cd usb-install-gtk -zcat ../binary/install/gtk/initrd.gz | cpio -iv -patch ./var/lib/dpkg/info/cdrom-detect.postinst < ../cdrom-detect.postinst.patch -PATCH_ERROR=${?} -if [ "${PATCH_ERROR}" != 0 ] -then - # if there was an error, say it and undo everything - echo "ERROR: error while patching cdrom-detect.postinst." - cd .. - rmdir -rf usb-install-gtk - exit 0 -fi -# rebuild the initrd -find . -print0 | cpio -0 -H newc -ov | gzip -c > ../initrd-new.gz -cd .. -mv initrd-new.gz binary/install/gtk/initrd.gz -rm -rf usb-install-gtk - -rm cdrom-detect.postinst.patch diff --git a/examples/hooks/localepurge.sh b/examples/hooks/localepurge.sh deleted file mode 100755 index 3fbb4c4..0000000 --- a/examples/hooks/localepurge.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install localepurge. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# - -cat > /tmp/localepurge.preseed << EOF -localepurge localepurge/nopurge multiselect en -#localepurge localepurge/mandelete boolean true -#localepurge localepurge/dontbothernew boolean false -localepurge localepurge/showfreedspace boolean false -#localepurge localepurge/quickndirtycalc boolean true -#localepurge localepurge/verbose boolean false -EOF -debconf-set-selections < /tmp/localepurge.preseed -rm -f /tmp/localepurge.preseed - -apt-get install --yes localepurge -dpkg-reconfigure localepurge - -localepurge diff --git a/examples/hooks/losetup-lukshome.sh b/examples/hooks/losetup-lukshome.sh deleted file mode 100755 index 5542438..0000000 --- a/examples/hooks/losetup-lukshome.sh +++ /dev/null @@ -1,460 +0,0 @@ -#!/bin/sh - -# This hook was based and adapted from: -# http://lists.debian.org/debian-live/2009/04/msg00186.html -# --------------------------------------------------------- -# -# -# NOTE 1: this was not tested with persistent boot option, -# but it seems logic that persistent and lukshome can't -# coexist as boot options (because of snapshots and others), so lukshome -# won't be executed if any persistent option is given on boot. -# -# NOTE 2: if using an USB key, it will eventualy end up failing someday. -# You should backup the encrypted disk image file itself (luks-home.img) to -# prevent loosing your data. -# -# This hook will create 3 files: -# -# /usr/local/sbin/create-lukshome-file.sh -# script to create an disk file image (luks-home.img) with a -# LUKS encrypted ext2 filesystem inside to be placed in a -# partition labeled lukshome. -# -# /usr/local/sbin/lukshome.sh -# detects a partition with lukshome label, updates fstab and crypttab so -# the encrypted file is mounted later in a loopback device (/dev/loopX). -# It also changes /etc/init.d/umountfs so the encrypted home is correctly -# umounted. -# -# /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home -# a live-initramfs hook to execute lukshome.sh script -# in initrd. -# -# -# HOWTO lukshome -# -------------- -# -# First build your live system with this hook inside config/chroot_local-hooks/. -# If you have an existing live-helper build directory with a previous live -# build, you might have to run -# -# lh_clean -# lh_clean --stage -# -# to make sure this hook is included in the live system. Then (re)build your -# live system. -# -# lh_build -# -# After booting your (re)built live system, setup the encrypted losetup -# filesystem to be used as /home using the instructions present in the -# create-lukshome-file.sh script. -# -# Reboot and now use the "lukshome" boot option to mount the encrypted /home, -# like in using "persistent" boot option with a home-rw file in some partition. -# - - -echo "I: to see how use lukshome hook run create-lukshome-file.sh as root." -echo "I: creating script /usr/local/sbin/create-lukshome-file.sh" -cat > /usr/local/sbin/create-lukshome-file.sh << 'EOF' -#!/bin/sh - -# This script is to create an encrypted filesystem in a file to -# be used as /home in a live system built with Debian Live Helper with -# the lukshome hook in config/chroot_local-hooks/. -# -# The lukshome boot option will do the following: -# - search for a partition with label 'lukshome' -# (btw, you can't use the live system partition itself) -# - mount the partition as /luks-home in the live system -# - open /luks-home/luks-home.img file as a loopback device (/dev/loop) -# - open the loopback device with cryptsetup -# - mount the encrypted filesystem as /home -# -# This script will only create the luks-home.img file. Next are details of how -# to use this script. -# -# CAUTION! THIS CAN WIPE YOUR DATA, backup first! -# Be sure to understand what you will do, or you can end up -# wiping disks or partitions you don't want to! -# -# Login as root: -# $ sudo -i -# -# Create a mountpoint (don't use /mnt, it will be used by this script): -# # mkdir /media/target -# -# !!! *** Skip the next line if you don't want to wipe a partition *** !!! -# !!! * Just change the partition label to 'lukshome' (without quotes) * !!! -# Create an ext2 filesystem in a partition with 'lukshome' label: -# # mkfs.ext2 -L lukshome /dev/the_partition_to_be_used -# -# Mount the partition and cd into it: -# # mount /dev/the_partition_to_be_used /media/target -# # cd /media/target -# -# Create the encrypted file: -# # create-lukshome-file.sh -# -# The script is located in /usr/local/sbin/, so it's in root $PATH. -# It will copy the directories in /home/* into the file. -# Now return to $HOME to be able to umount the target partition: -# # cd -# -# Umount the target partition: -# # umount /media/target -# -# Reboot and use the "lukshome" boot option to mount the encrypted /home, -# like in using "persistent" boot option with a home-rw file in some partition. -# -# Press Shift-PgUp/Shift-PgDn to scrool the instructions on the screen. - - -# check if root/sudo -if [ "${USER}" != "root" ] -then - echo " ** Please run this script as root or with sudo." - exit 1 -fi - -# check if /mnt is available and empty -mount | grep "/mnt" > /dev/null -MNT_IS_MOUNTED=${?} -if [ "${MNT_IS_MOUNTED}" == 0 ] -then - echo "** ERROR: /mnt is mounted at the moment. Please umount it to use this script." - exit 1 -fi -if [ "$(ls -A /mnt)" ] -then - echo "** ERROR: /mnt is not empty. An empty /mnt is needed to use this script." - exit 1 -fi - -# check if /dev/mapper/luks-home is available -if [ -f /dev/mapper/luks-home ] -then - echo "** ERROR: /dev/mapper/luks-home is being used at the moment. Please run «cryptsetup remove luks-home» to use this script." - exit 1 -fi - - -# show instructions -echo "" -echo "** Instructions to use create-lukshome-file.sh (this script):" -sed -n '2,51p' /usr/local/sbin/create-lukshome-file.sh | sed 's/^.//' -echo "" - - -# proceed? -echo "** Do you want to proceed with this script? (y/N)" -read CONFIRM - -case "${CONFIRM}" in - y*|Y*) - echo "" - ;; - *) - exit 0 - ;; -esac - - -# create file -echo "" -echo "** Please type the size of the file disk image." -echo "Size of the file in MB: " -read FILE_SIZE - -echo "" -echo "** Creating file luks-home.img." -echo "** Filling file image with /dev/urandom output. It will take some time." -echo "(Edit this script to use /dev/random. It's know to more secure but " -echo "it will take a *very* long time to complete." -dd if=/dev/urandom of=luks-home.img bs=1M count=${FILE_SIZE} -# To use /dev/random comment the line above and uncomment the next line -#dd if=/dev/random of=luks-home.img ibs=128 obs=128 count=$((8192*${FILE_SIZE})) -# You might have to increase kernel entropy by moving the mouse, typing keyboard, -# make the computer read disk or use network connections. -echo "** Done." -echo "" - -# losetup -FREE_LOSETUP=$(losetup -f) -echo "** Using ${FREE_LOSETUP} to open luks-home.img" -losetup ${FREE_LOSETUP} ./luks-home.img -echo "** Done." -echo "" - -# cryptsetup -echo "** Running cryptsetup." -echo "" -echo "** luksFormat" -cryptsetup luksFormat ${FREE_LOSETUP} -EXIT_CODE=${?} -if [ "${EXIT_CODE}" != 0 ] -then - echo "** ERROR: Error while trying to format disk file image." - losetup -d ${FREE_LOSETUP} - exit 1 -fi -echo "" - -echo "** luksOpen" -cryptsetup luksOpen ${FREE_LOSETUP} luks-home -EXIT_CODE=${?} -if [ "${EXIT_CODE}" != 0 ] -then - echo "** ERROR: Error while trying to open LUKS file image." - losetup -d ${FREE_LOSETUP} - exit 1 -fi -echo "" - -# format encrypted filesystem -echo "** Now formating /dev/mapper/luks-home" -mkfs.ext2 /dev/mapper/luks-home -EXIT_CODE=${?} -if [ "${EXIT_CODE}" != 0 ] -then - echo "** ERROR: Error while trying to format LUKS file." - cryptsetup remove luks-home - losetup -d ${FREE_LOSETUP} - exit 1 -fi -echo "" - -# mount in /mnt -echo "** Now mounting luks-home.img in /mnt" -mount /dev/mapper/luks-home /mnt -EXIT_CODE=${?} -if [ "${EXIT_CODE}" != 0 ] -then - echo "** ERROR: Error while trying to mount LUKS file in /mnt." - umount /mnt - cryptsetup remove luks-home - losetup -d ${FREE_LOSETUP} - exit 1 -fi -echo "" - -# copy files -HOME_DIR="/home/*" - -echo "** Copying ${HOME_DIR}." -cp -rav ${HOME_DIR} /mnt -EXIT_CODE=${?} -if [ "${EXIT_CODE}" != 0 ] -then - echo "** ERROR: Error while trying to copy files to /mnt." - umount /mnt - cryptsetup remove luks-home - losetup -d ${FREE_LOSETUP} - exit 1 -fi -echo "** Done." -echo "" - -echo "** All done." -echo "** Closing losetup, cryptsetup and mounted /mnt." -# umount and close -umount /mnt -cryptsetup remove luks-home -losetup -d ${FREE_LOSETUP} -echo "** The disk file image luks-home.img is done and ready. Move it into a partition" -echo "** with 'lukshome' as label and reboot with lukshome boot option to use it." -echo "" - -EOF - -chmod 0755 /usr/local/sbin/create-lukshome-file.sh - - - -echo "I: creating script /usr/local/sbin/lukshome.sh" -cat > /usr/local/sbin/lukshome.sh << 'EOF' -#!/bin/sh - -# this script is to be executed by a hook in live-initramfs. It searches -# for a partition with 'lukshome' label, mounts it as /luks-home, then opens an -# encrypted disk image file called luks-home.img as a loopback device, opens it -# with cryptsetup and finally mounts the present filesystem as /home. -# It also changes /etc/init.d/umountfs to umount the lukshome partition -# (/luks-home) and clear the loopback device on shutdown. - -# functions taken from live-helpers -. /usr/share/initramfs-tools/scripts/live-helpers - -# search for a partition labeled "lukshome" -for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd) -do - for dev in $(subdevices "${sysblock}") - do - devname=$(sys2dev "${dev}") - # find partition name and filesystem type - if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "lukshome" ] - then - # found one partition named "lukshome" - CRYPTHOME="${devname}" - # don't search further - break - fi - done - # if already found, don't search further - if [ -n "${CRYPTHOME}" ] - then - break - fi -done - -# if no partition found, exit -if [ -z "${CRYPTHOME}" ] -then - echo "Could not find any partition with lukshome label. " - echo "Proceeding with no encrypted /home." - exit 0 -fi - -# mount partition where file container is -echo "Mounting /luks-home with ${CRYPTHOME}." -mkdir -p /luks-home -mount -t $(get_fstype "${CRYPTHOME}") "${CRYPTHOME}" /luks-home - -# mount losetup encrypted file -FREE_LOOP="$(/sbin/losetup -f)" -echo "Opening /luks-home/luks-home.img in ${FREE_LOOP}." - -if [ -f /luks-home/luks-home.img ] -then - /sbin/losetup ${FREE_LOOP} /luks-home/luks-home.img - - echo "Adding ${FREE_LOOP} home to /etc/crypttab and setting it as /home in /etc/fstab." - - # update crypttab - echo "home ${FREE_LOOP} none luks,check,timeout" >> /etc/crypttab - - # update fstab - echo "/dev/mapper/home /home ext2 defaults,noatime 0 0" >> /etc/fstab -else - echo "Did not found any luks-home.img file in ${CRYPTHOME}!" - echo "Proceeding with no encrypted /home." - umount -r /luks-home - exit 0 -fi - -# changes to /etc/init.d/umountfs to make /luks-home being umounted on shutdown -sed -i 's/[\t]do_stop/CHANGE_HERE/' /etc/init.d/umountfs -sed -i 's|CHANGE_HERE| \ - # added by lukshome hook - umount \/luks-home to prevent busy device on shutdown \ - LOOP_LUKSHOME=$(losetup -a \| grep luks-home \|cut -c 1-10) \ - if [ -n ${LOOP_LUKSHOME} ] \ - then \ - umount -r -d \/home \ - cryptsetup remove home \ - losetup -d ${LOOP_LUKSHOME} \ - umount -r \/luks-home \ - fi \ -\ - do_stop \ -|' /etc/init.d/umountfs - -EOF - -chmod 0755 /usr/local/sbin/lukshome.sh - - - -# scripts/live-bottom/13live_luks_home, right after 12fstab -echo "I: creating /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home" - -cat > /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home << 'EOF' -#!/bin/sh - -#set -e - -# initramfs-tools header - -PREREQ="" - -prereqs() -{ - echo "${PREREQ}" -} - -case "${1}" in - prereqs) - prereqs - exit 0 - ;; -esac - -. /scripts/live-functions - -# live-initramfs hook to use an disk image file with encrypted filesystem as /home. - -log_begin_msg "Executing losetup-lukshome" - -# get boot option lukshome - adapted from live-helpers -for ARGUMENT in $(cat /proc/cmdline) -do - case "${ARGUMENT}" in - lukshome) - LUKSHOME=1 - ;; - esac -done - -# don't use persistent* and lukshome -if [ -n "${PERSISTENT}" ] && [ -n "${LUKSHOME}" ] -then - echo "You should not use persistent and lukshome at the same time." - echo "Skipping lukshome. Persistent medium, if any, will be used instead." - log_end_msg - exit 0 -fi - -# if no lukshome boot option, exit -if [ -z "${LUKSHOME}" ] -then - log_end_msg - exit 0 -fi - -log_begin_msg "Executing lukshome.sh script." - -mount -o bind /sys /root/sys -mount -o bind /proc /root/proc -mount -o bind /dev /root/dev - -# lukshome.sh detects lukshome partition and file location, mounts it -# and opens the file and then updates fstab and crypttab to use it as /home. -chroot /root /usr/local/sbin/lukshome.sh - -umount /root/sys -umount /root/proc -umount /root/dev - -# delete the lukshome scripts, not needed anymore -# rm -f /root/usr/local/sbin/lukshome.sh -# rm -f /root/usr/local/sbin/create-lukshome-file.sh - -log_end_msg - -EOF - -chmod 0755 /usr/share/initramfs-tools/scripts/live-bottom/13live_luks_home - - - -echo "I: update-initramfs to include 13live_luks_home." -# if you already have installed the update-initramfs.sh hook, you can remove -# this. - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - update-initramfs -k ${VERSION} -t -u -done diff --git a/examples/hooks/madwifi.sh b/examples/hooks/madwifi.sh deleted file mode 100755 index 0686c12..0000000 --- a/examples/hooks/madwifi.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install madwifi drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the contrib category. Make sure you enabled -# it in your configuration. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install madwifi -l ${VERSION} -done - -module-assistant clean madwifi - -# Installing additional stuff -apt-get install --yes madwifi-tools diff --git a/examples/hooks/modules.sh b/examples/hooks/modules.sh deleted file mode 100755 index 159e9bc..0000000 --- a/examples/hooks/modules.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to add entries to /etc/modules. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -MODULES="" - -for MODULE in ${MODULES} -do - if ! grep -qs /etc/modules ${MODULE} - then - echo ${MODULE} >> /etc/modules - fi -done diff --git a/examples/hooks/nvidia-legacy.sh b/examples/hooks/nvidia-legacy.sh deleted file mode 100755 index 66d67bc..0000000 --- a/examples/hooks/nvidia-legacy.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install nvidia-kernel-legacy drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the non-free category. Make sure you -# enabled it in your configuration. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant nvidia-kernel-common -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install nvidia-kernel-legacy -l ${VERSION} -done - -module-assistant clean nvidia-kernel-legacy - -# Installing additional stuff -apt-get install --yes nvidia-glx-legacy nvidia-xconfig discover - -# Fix #421028 -if [ -f /usr/lib/xorg/modules/drivers/nvidia_drv.o ] -then - cd /usr/lib/xorg/modules/drivers - gcc -shared -o nvidia_drv.so nvidia_drv.o - cd ${OLDPWD} -fi - -# Adding init script -cat > /etc/init.d/nvidia-debian-live << EOF -#!/bin/sh -# script that modify xorg configuration enabling -# the nvidia proprietary module if the card is detected -# as an NVidia - -if discover --type-summary display | grep -i nvidia -then - # forcing depth to 24, bad detection on some card (e.g my GeForce4 440 Go) - echo "Configuring Xorg for nvidia ..." - nvidia-xconfig -d 24 -else - # not with nvidia h/w ? remove those GLX diversions - # (FIXME) - apt-get --quiet --yes remove nvidia-glx-legacy -fi -EOF - -chmod 0755 /etc/init.d/nvidia-debian-live -update-rc.d nvidia-debian-live defaults diff --git a/examples/hooks/replace-di-banner.sh b/examples/hooks/replace-di-banner.sh deleted file mode 100755 index 7be8682..0000000 --- a/examples/hooks/replace-di-banner.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# This is an binary hook for live-helper(7) to overwrite the banner -# in the graphical Debian Installer. -# To enable it, copy or symlink this hook into your config/binary_local-hooks -# directory and add a replacement banner.png at: -# -# config/binary_local-includes/binary/install/banner.png -# -# The file should be a PNG image of dimensions 800 x 75. - -set -e - -if [ -e config/binary_debian-installer/banner.png ] -then - TARGET_INITRD="binary/install/gtk/initrd.gz" - REPACK_TMPDIR="binary.initrd" - - if [ -e "${TARGET_INITRD}" ] - then - # cpio does not have a "extract to directory", so we must change - # directory - mkdir -p ${REPACK_TMPDIR} - cd ${REPACK_TMPDIR} - gzip -d < ../${TARGET_INITRD} | cpio -i --make-directories --no-absolute-filenames - - # Overwrite banner - cp ../config/binary_debian-installer/banner.png ./usr/share/graphics/logo_debian.png - - find | cpio -H newc -o | gzip -9 > ../${TARGET_INITRD} - cd .. - rm -rf ${REPACK_TMPDIR} - fi -fi diff --git a/examples/hooks/rt2570.sh b/examples/hooks/rt2570.sh deleted file mode 100755 index 408b138..0000000 --- a/examples/hooks/rt2570.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install ralink rt2570 drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -apt-get install --yes build-essential - -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install rt2570-source -l ${VERSION} -done - -module-assistant clean rt2570-source diff --git a/examples/hooks/rt2x00.sh b/examples/hooks/rt2x00.sh deleted file mode 100755 index 9da6f72..0000000 --- a/examples/hooks/rt2x00.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install ralink rt2x00 drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# FIXME: it runs in interactive mode - -apt-get install --yes build-essential - -# Building kernel modules -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install rt2x00-source -l ${VERSION} -done - -module-assistant clean rt2x00-source - -# Installing firmware for rt73usb -wget "http://www.ralinktech.com.tw/data/RT73_Linux_STA_Drv1.0.4.0.tar.gz" -O /tmp/RT73_Linux_STA_Drv1.0.4.0.tar.gz - -cd /tmp -tar xfvz RT73_Linux_STA_Drv1.0.4.0.tar.gz -cp RT73_Linux_STA_Drv1.0.4.0/Module/rt73.bin /lib/firmware -rm -rf RT73_Linux_STA_Drv* -cd ${OLDPWD} diff --git a/examples/hooks/squashfs.sh b/examples/hooks/squashfs.sh deleted file mode 100755 index 20667e2..0000000 --- a/examples/hooks/squashfs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install squashfs drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: You only want to use this hook if there is no prebuild -# squashfs-modules-* package available for your kernel flavour. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install squashfs -l ${VERSION} -done - -module-assistant clean squashfs diff --git a/examples/hooks/squeeze_chroot_okular-nodrm.sh b/examples/hooks/squeeze_chroot_okular-nodrm.sh new file mode 100755 index 0000000..782133c --- /dev/null +++ b/examples/hooks/squeeze_chroot_okular-nodrm.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# This is a hook for live-helper(7) to configure KDE's PDF viewer to ignore +# manipulation restriction on "DRM protect" PDF documents. +# +# To enable it, copy or symlink this hook into your config/chroot_local-hooks +# directory. + +if [ -d /usr/share/kde4/config ] +then + # KDE4 (squeeze/sid) + +cat > /usr/share/kde4/config/okularpartrc << EOF +[General] +ObeyDRM=false +EOF + +fi diff --git a/examples/hooks/sun-java5.sh b/examples/hooks/sun-java5.sh deleted file mode 100755 index 139efd5..0000000 --- a/examples/hooks/sun-java5.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install sun-java. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the non-free category. Make sure you -# enabled it in your configuration. - -# live-helper sets DEBIAN_FRONTEND to 'noninteractive' to advise debconf to not -# ask any questions while installing packages. Suns redistribution terms for -# Java do not allow this, therefore we need to overwrite DEBIAN_FRONTEND for -# this apt-get call only. - -# In case you do accept the license terms, you can also preseed the values -# for a complete non-interactive build, by uncommenting the following three lines: - -#echo "sun-java5-bin shared/accepted-sun-dlj-v1-1 boolean true" > /root/preseed -#debconf-set-selections < /root/preseed -#rm -f /root/preseed - -DEBIAN_FRONTEND="dialog" apt-get install --yes sun-java5-bin sun-java5-demo \ - sun-java5-doc sun-java5-fonts sun-java5-jdk sun-java5-jre \ - sun-java5-plugin sun-java5-source - -# Ensure that /tmp has the right permissions; apparently sun-java5-doc tampers -# with it -chmod 1777 /tmp diff --git a/examples/hooks/sun-java6.sh b/examples/hooks/sun-java6.sh deleted file mode 100755 index c86066f..0000000 --- a/examples/hooks/sun-java6.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install sun-java. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: This hook requires packages from the non-free category. Make sure you -# enabled it in your configuration. - -# live-helper sets DEBIAN_FRONTEND to 'noninteractive' to advise debconf to not -# ask any questions while installing packages. Suns redistribution terms for -# Java do not allow this, therefore we need to overwrite DEBIAN_FRONTEND for -# this apt-get call only. - -# In case you do accept the license terms, you can also preseed the values -# for a complete non-interactive build, by uncommenting the following three lines: - -#echo "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true" > /root/preseed -#debconf-set-selections < /root/preseed -#rm -f /root/preseed - -DEBIAN_FRONTEND="dialog" apt-get install --yes sun-java6-bin sun-java6-demo \ - sun-java6-doc sun-java6-fonts sun-java6-jdk sun-java6-jre \ - sun-java6-plugin sun-java6-source - -# Ensure that /tmp has the right permissions; apparently sun-java5-doc tampers -# with it -chmod 1777 /tmp diff --git a/examples/hooks/unionfs.sh b/examples/hooks/unionfs.sh deleted file mode 100755 index 20f0886..0000000 --- a/examples/hooks/unionfs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to install unionfs drivers -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: You only want to use this hook if there is no prebuild unionfs-modules-* -# package available for your kernel flavour. - -apt-get install --yes build-essential - -# Building kernel module -which module-assistant || apt-get install --yes module-assistant -module-assistant update - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - module-assistant --non-inter --quiet auto-install unionfs -l ${VERSION} -done - -module-assistant clean unionfs diff --git a/examples/hooks/update-initramfs.sh b/examples/hooks/update-initramfs.sh deleted file mode 100755 index 5179f77..0000000 --- a/examples/hooks/update-initramfs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to rebuild the initramfs image. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. -# -# Note: You only want to use this hook if you have modified any initramfs-script -# during the build and need to refresh the initrd.img for that purpose. - -for KERNEL in /boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - update-initramfs -k ${VERSION} -t -u -done diff --git a/examples/hooks/virtualbox-ose.sh b/examples/hooks/virtualbox-ose.sh deleted file mode 100755 index bcf7289..0000000 --- a/examples/hooks/virtualbox-ose.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# This is a hook for live-helper(7) to enable virtualbox-ose module. -# To enable it, copy or symlink this hook into your config/chroot_local-hooks -# directory. - -# Enabling loading of vboxdrv -sed -i -e 's|^LOAD_VBOXDRV_MODULE=.*$|LOAD_VBOXDRV_MODULE=1|' /etc/default/virtualbox-ose -- cgit v1.0