From c8d307dda6fb07a63dfe69381fc5176ad925862a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 8 Feb 2009 00:18:21 +0100 Subject: Prefixing debhelper files with package name. --- debian/bug/live-initramfs.script | 13 +++ debian/bug/script | 13 --- debian/init | 165 --------------------------------------- debian/live-initramfs.init | 165 +++++++++++++++++++++++++++++++++++++++ debian/live-initramfs.postinst | 25 ++++++ debian/live-initramfs.postrm | 25 ++++++ debian/live-initramfs.triggers | 1 + debian/postinst | 25 ------ debian/postrm | 25 ------ debian/rules | 2 +- debian/triggers | 1 - 11 files changed, 230 insertions(+), 230 deletions(-) create mode 100644 debian/bug/live-initramfs.script delete mode 100644 debian/bug/script delete mode 100644 debian/init create mode 100644 debian/live-initramfs.init create mode 100644 debian/live-initramfs.postinst create mode 100644 debian/live-initramfs.postrm create mode 100644 debian/live-initramfs.triggers delete mode 100644 debian/postinst delete mode 100644 debian/postrm delete mode 100644 debian/triggers diff --git a/debian/bug/live-initramfs.script b/debian/bug/live-initramfs.script new file mode 100644 index 0000000..7938bbe --- /dev/null +++ b/debian/bug/live-initramfs.script @@ -0,0 +1,13 @@ +#!/bin/sh + +# Checking depends +dpkg -l busybox file initramfs-tools sudo udev user-setup + +# Checking recommends +dpkg -l eject loop-aes-utils uuid-runtime wget + +# Checking suggests +dpkg -l curlftpfs genext2fs httpfs2 squashfs-tools mtd-tools + +# Checking other packages +dpkg -l cryptsetup splashy usplash diff --git a/debian/bug/script b/debian/bug/script deleted file mode 100644 index 7938bbe..0000000 --- a/debian/bug/script +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Checking depends -dpkg -l busybox file initramfs-tools sudo udev user-setup - -# Checking recommends -dpkg -l eject loop-aes-utils uuid-runtime wget - -# Checking suggests -dpkg -l curlftpfs genext2fs httpfs2 squashfs-tools mtd-tools - -# Checking other packages -dpkg -l cryptsetup splashy usplash diff --git a/debian/init b/debian/init deleted file mode 100644 index 1dd72cc..0000000 --- a/debian/init +++ /dev/null @@ -1,165 +0,0 @@ -#!/bin/sh - -### BEGIN INIT INFO -# Provides: live-initramfs -# Required-Start: $syslog -# Required-Stop: $syslog -# Should-Start: $local_fs -# Should-Stop: $local_fs -# Default-Start: 1 2 3 4 5 -# Default-Stop: 0 6 -# Short-Description: live-initramfs init script -# Description: Resyncs snapshots, evantually caches files in order to -# let remove the media. -### END INIT INFO - -# Authors: Tollef Fog Heen -# Marco Amadori - -PATH=/usr/sbin:/usr/bin:/sbin:/bin -NAME=live-initramfs -SCRIPTNAME=/etc/init.d/${NAME} -DO_SNAPSHOT=/sbin/live-snapshot - -# Exit if system was not booted by live-initramfs -grep -qs boot=live /proc/cmdline || exit 0 - -# Exit if the system was booted from an ISO image rather than a physical CD -grep -qs find_iso= /proc/cmdline && exit 0 - -# Read configuration variable file if it is present -[ -r /etc/live.conf ] && . /etc/live.conf - -# Load the VERBOSE setting and other rcS variables -[ -f /etc/default/rcS ] && . /etc/default/rcS - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# Try to cache everything we're likely to need after ejecting. This -# is fragile and simple-minded, but our options are limited. -cache_path() { - path="${1}" - - if [ -d "${path}" ]; then - find "${path}" -type f | xargs cat > /dev/null 2>&1 - elif [ -f "${path}" ]; then - if [ -x "${path}" ]; then - if file "${path}" | grep -q 'dynamically linked'; then - for lib in $(ldd "${path}" | awk '{ print $3 }'); do - cache_path "${lib}" - done - fi - fi - cat "${path}" >/dev/null 2>&1 - fi -} - -get_boot_device() { - # search in /proc/mounts for the device that is mounted at /live/image - while read DEVICE MOUNT REST; do - if [ "${MOUNT}" == "/live/image" ]; then - echo "${DEVICE}" - exit 0 - fi - done < /proc/mounts -} - -device_is_USB_flash_drive() -{ - # remove leading "/dev/" and all trailing numbers from input - DEVICE=$(expr substr ${1} 6 3) - # check that device starts with "sd" - [ "$(expr substr ${DEVICE} 1 2)" != "sd" ] && return 1 - # check that the device is an USB device - if readlink /sys/block/${DEVICE}/device | grep -q usb ; then - return 0 - fi - return 1 -} - -do_stop () -{ - if [ ! -z "${ROOTSNAP}" ]; then - ${DO_SNAPSHOT} --resync-string="${ROOTSNAP}" - fi - - if [ ! -z "${HOMESNAP}" ]; then - ${DO_SNAPSHOT} --resync-string="${HOMESNAP}" - fi - - # check for netboot - if [ ! -z "${NETBOOT}" ] || grep -qs netboot /proc/cmdline || grep -qsi root=/dev/nfs /proc/cmdline || grep -qsi root=/dev/cifs /proc/cmdline ; then - return 0 - fi - - prompt=1 - if grep -qs noprompt /proc/cmdline; then - prompt= - fi - - for path in $(which halt) $(which reboot) /etc/rc?.d /etc/default $(which stty); do - cache_path "${path}" - done - - for x in $(cat /proc/cmdline); do - case ${x} in - quickreboot) - QUICKREBOOT="Yes" - ;; - esac - done - - if [ -z ${QUICKREBOOT} ]; then - # TODO: i18n, dialog - if [ -x /usr/bin/eject ] - then - BOOT_DEVICE="$(get_boot_device)" - if device_is_USB_flash_drive ${BOOT_DEVICE}; then - # do NOT eject USB flash drives! - # otherwise rebooting with most USB flash drives failes because - # they actually remember the "ejected" state even after reboot - MESSAGE="Please remove the USB flash drive" - else - # ejecting is a very good idea here - eject -p -m /live/image >/dev/null 2>&1 - # TODO: detect CD - MEDIUM="DVD" - MESSAGE="Please remove the ${MEDIUM}, close the ${MEDIUM} tray (if any)" - fi - MESSAGE="${MESSAGE} and press ENTER:" - - [ "$prompt" ] || return 0 - fi - - stty sane < /dev/console - - echo -n -e "\n\n${MESSAGE}" > /dev/console - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "TIMEOUT 86400" - /sbin/usplash_write "TEXT-URGENT Please remove the disc, close the tray (if any)" - /sbin/usplash_write "TEXT-URGENT and press ENTER to continue" - fi - - read x < /dev/console - fi -} - -case "${1}" in - start|restart|reload|force-reload|status) - [ "${VERBOSE}" != no ] && log_end_msg 0 - ;; - stop) - log_begin_msg "${NAME} is resyncing snapshots and caching reboot files..." - do_stop - case "${?}" in - 0|1) [ "${VERBOSE}" != no ] && log_end_msg 0 ;; - 2) [ "${VERBOSE}" != no ] && log_end_msg 1 ;; - esac - ;; - *) - log_success_msg "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload}" >&2 - exit 3 - ;; -esac diff --git a/debian/live-initramfs.init b/debian/live-initramfs.init new file mode 100644 index 0000000..1dd72cc --- /dev/null +++ b/debian/live-initramfs.init @@ -0,0 +1,165 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: live-initramfs +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 1 2 3 4 5 +# Default-Stop: 0 6 +# Short-Description: live-initramfs init script +# Description: Resyncs snapshots, evantually caches files in order to +# let remove the media. +### END INIT INFO + +# Authors: Tollef Fog Heen +# Marco Amadori + +PATH=/usr/sbin:/usr/bin:/sbin:/bin +NAME=live-initramfs +SCRIPTNAME=/etc/init.d/${NAME} +DO_SNAPSHOT=/sbin/live-snapshot + +# Exit if system was not booted by live-initramfs +grep -qs boot=live /proc/cmdline || exit 0 + +# Exit if the system was booted from an ISO image rather than a physical CD +grep -qs find_iso= /proc/cmdline && exit 0 + +# Read configuration variable file if it is present +[ -r /etc/live.conf ] && . /etc/live.conf + +# Load the VERBOSE setting and other rcS variables +[ -f /etc/default/rcS ] && . /etc/default/rcS + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# Try to cache everything we're likely to need after ejecting. This +# is fragile and simple-minded, but our options are limited. +cache_path() { + path="${1}" + + if [ -d "${path}" ]; then + find "${path}" -type f | xargs cat > /dev/null 2>&1 + elif [ -f "${path}" ]; then + if [ -x "${path}" ]; then + if file "${path}" | grep -q 'dynamically linked'; then + for lib in $(ldd "${path}" | awk '{ print $3 }'); do + cache_path "${lib}" + done + fi + fi + cat "${path}" >/dev/null 2>&1 + fi +} + +get_boot_device() { + # search in /proc/mounts for the device that is mounted at /live/image + while read DEVICE MOUNT REST; do + if [ "${MOUNT}" == "/live/image" ]; then + echo "${DEVICE}" + exit 0 + fi + done < /proc/mounts +} + +device_is_USB_flash_drive() +{ + # remove leading "/dev/" and all trailing numbers from input + DEVICE=$(expr substr ${1} 6 3) + # check that device starts with "sd" + [ "$(expr substr ${DEVICE} 1 2)" != "sd" ] && return 1 + # check that the device is an USB device + if readlink /sys/block/${DEVICE}/device | grep -q usb ; then + return 0 + fi + return 1 +} + +do_stop () +{ + if [ ! -z "${ROOTSNAP}" ]; then + ${DO_SNAPSHOT} --resync-string="${ROOTSNAP}" + fi + + if [ ! -z "${HOMESNAP}" ]; then + ${DO_SNAPSHOT} --resync-string="${HOMESNAP}" + fi + + # check for netboot + if [ ! -z "${NETBOOT}" ] || grep -qs netboot /proc/cmdline || grep -qsi root=/dev/nfs /proc/cmdline || grep -qsi root=/dev/cifs /proc/cmdline ; then + return 0 + fi + + prompt=1 + if grep -qs noprompt /proc/cmdline; then + prompt= + fi + + for path in $(which halt) $(which reboot) /etc/rc?.d /etc/default $(which stty); do + cache_path "${path}" + done + + for x in $(cat /proc/cmdline); do + case ${x} in + quickreboot) + QUICKREBOOT="Yes" + ;; + esac + done + + if [ -z ${QUICKREBOOT} ]; then + # TODO: i18n, dialog + if [ -x /usr/bin/eject ] + then + BOOT_DEVICE="$(get_boot_device)" + if device_is_USB_flash_drive ${BOOT_DEVICE}; then + # do NOT eject USB flash drives! + # otherwise rebooting with most USB flash drives failes because + # they actually remember the "ejected" state even after reboot + MESSAGE="Please remove the USB flash drive" + else + # ejecting is a very good idea here + eject -p -m /live/image >/dev/null 2>&1 + # TODO: detect CD + MEDIUM="DVD" + MESSAGE="Please remove the ${MEDIUM}, close the ${MEDIUM} tray (if any)" + fi + MESSAGE="${MESSAGE} and press ENTER:" + + [ "$prompt" ] || return 0 + fi + + stty sane < /dev/console + + echo -n -e "\n\n${MESSAGE}" > /dev/console + if [ -x /sbin/usplash_write ]; then + /sbin/usplash_write "TIMEOUT 86400" + /sbin/usplash_write "TEXT-URGENT Please remove the disc, close the tray (if any)" + /sbin/usplash_write "TEXT-URGENT and press ENTER to continue" + fi + + read x < /dev/console + fi +} + +case "${1}" in + start|restart|reload|force-reload|status) + [ "${VERBOSE}" != no ] && log_end_msg 0 + ;; + stop) + log_begin_msg "${NAME} is resyncing snapshots and caching reboot files..." + do_stop + case "${?}" in + 0|1) [ "${VERBOSE}" != no ] && log_end_msg 0 ;; + 2) [ "${VERBOSE}" != no ] && log_end_msg 1 ;; + esac + ;; + *) + log_success_msg "Usage: ${SCRIPTNAME} {start|stop|restart|force-reload}" >&2 + exit 3 + ;; +esac diff --git a/debian/live-initramfs.postinst b/debian/live-initramfs.postinst new file mode 100644 index 0000000..b94b3bd --- /dev/null +++ b/debian/live-initramfs.postinst @@ -0,0 +1,25 @@ +#!/bin/sh + +case "$(ls -l /boot/vmlinu* | wc -l)" in + 1) + # We only have one kernel installed, so we can use "-u" + # which will use dpkg-trigger inside update-initramfs + INITRAMFS_ARGS="-u" + ;; + + *) + INITRAMFS_ARGS="-u -k all" + ;; +esac + +if [ -x /usr/sbin/update-initramfs ] && [ "${1}" != "triggered" ] && \ + dpkg --compare-versions "${DPKG_RUNNING_VERSION}" ge "1.14.18" +then + # this activates the trigger, if triggers are working + update-initramfs ${INITRAMFS_ARGS} +else + # force it to actually happen + DPKG_MAINTSCRIPT_PACKAGE="" update-initramfs ${INITRAMFS_ARGS} +fi + +#DEBHELPER# diff --git a/debian/live-initramfs.postrm b/debian/live-initramfs.postrm new file mode 100644 index 0000000..b94b3bd --- /dev/null +++ b/debian/live-initramfs.postrm @@ -0,0 +1,25 @@ +#!/bin/sh + +case "$(ls -l /boot/vmlinu* | wc -l)" in + 1) + # We only have one kernel installed, so we can use "-u" + # which will use dpkg-trigger inside update-initramfs + INITRAMFS_ARGS="-u" + ;; + + *) + INITRAMFS_ARGS="-u -k all" + ;; +esac + +if [ -x /usr/sbin/update-initramfs ] && [ "${1}" != "triggered" ] && \ + dpkg --compare-versions "${DPKG_RUNNING_VERSION}" ge "1.14.18" +then + # this activates the trigger, if triggers are working + update-initramfs ${INITRAMFS_ARGS} +else + # force it to actually happen + DPKG_MAINTSCRIPT_PACKAGE="" update-initramfs ${INITRAMFS_ARGS} +fi + +#DEBHELPER# diff --git a/debian/live-initramfs.triggers b/debian/live-initramfs.triggers new file mode 100644 index 0000000..6c9f454 --- /dev/null +++ b/debian/live-initramfs.triggers @@ -0,0 +1 @@ +activate update-initramfs diff --git a/debian/postinst b/debian/postinst deleted file mode 100644 index b94b3bd..0000000 --- a/debian/postinst +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -case "$(ls -l /boot/vmlinu* | wc -l)" in - 1) - # We only have one kernel installed, so we can use "-u" - # which will use dpkg-trigger inside update-initramfs - INITRAMFS_ARGS="-u" - ;; - - *) - INITRAMFS_ARGS="-u -k all" - ;; -esac - -if [ -x /usr/sbin/update-initramfs ] && [ "${1}" != "triggered" ] && \ - dpkg --compare-versions "${DPKG_RUNNING_VERSION}" ge "1.14.18" -then - # this activates the trigger, if triggers are working - update-initramfs ${INITRAMFS_ARGS} -else - # force it to actually happen - DPKG_MAINTSCRIPT_PACKAGE="" update-initramfs ${INITRAMFS_ARGS} -fi - -#DEBHELPER# diff --git a/debian/postrm b/debian/postrm deleted file mode 100644 index b94b3bd..0000000 --- a/debian/postrm +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -case "$(ls -l /boot/vmlinu* | wc -l)" in - 1) - # We only have one kernel installed, so we can use "-u" - # which will use dpkg-trigger inside update-initramfs - INITRAMFS_ARGS="-u" - ;; - - *) - INITRAMFS_ARGS="-u -k all" - ;; -esac - -if [ -x /usr/sbin/update-initramfs ] && [ "${1}" != "triggered" ] && \ - dpkg --compare-versions "${DPKG_RUNNING_VERSION}" ge "1.14.18" -then - # this activates the trigger, if triggers are working - update-initramfs ${INITRAMFS_ARGS} -else - # force it to actually happen - DPKG_MAINTSCRIPT_PACKAGE="" update-initramfs ${INITRAMFS_ARGS} -fi - -#DEBHELPER# diff --git a/debian/rules b/debian/rules index 09d9e17..da555d9 100755 --- a/debian/rules +++ b/debian/rules @@ -41,7 +41,7 @@ install: build mv debian/live-initramfs/usr/share/doc/live-initramfs/ChangeLog.casper debian/live-initramfs/usr/share/doc/live-initramfs/changelog.casper # Installing bug control - install -D -m 0755 debian/bug/script debian/live-initramfs/usr/share/bug/live-initramfs + install -D -m 0755 debian/bug/live-initramfs.script debian/live-initramfs/usr/share/bug/live-initramfs binary-arch: build install diff --git a/debian/triggers b/debian/triggers deleted file mode 100644 index 6c9f454..0000000 --- a/debian/triggers +++ /dev/null @@ -1 +0,0 @@ -activate update-initramfs -- cgit v1.2.3