From 6d3f4fd5557f5efc83c42374417f4a05e99d3744 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 5 Jun 2012 15:18:31 +0200 Subject: [PATCH] Moving out live-helpers from initramfs-tools specifics. --- Makefile | 2 +- bin/live-snapshot | 34 +++++++++++++++++++++- initramfs-tools/hooks/live | 1 - initramfs-tools/scripts/live-bottom/10validateroot | 1 - scripts/boot.sh | 23 ++++++++++++++- .../live-helpers => scripts/boot/misc-helpers.sh | 25 +--------------- 6 files changed, 57 insertions(+), 29 deletions(-) rename initramfs-tools/scripts/live-helpers => scripts/boot/misc-helpers.sh (97%) mode change 100644 => 100755 diff --git a/Makefile b/Makefile index 655f41f..25b21ba 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SHELL := sh -e LANGUAGES = $(shell cd manpages/po && ls) -SCRIPTS = bin/* initramfs-tools/hooks/* initramfs-tools/scripts/live initramfs-tools/scripts/live-functions initramfs-tools/scripts/live-helpers initramfs-tools/scripts/*/* scripts/*.sh scripts/*/* +SCRIPTS = bin/* initramfs-tools/hooks/* initramfs-tools/scripts/live initramfs-tools/scripts/live-functions initramfs-tools/scripts/*/* scripts/*.sh scripts/*/* all: build diff --git a/bin/live-snapshot b/bin/live-snapshot index 6ba45f2..e684824 100755 --- a/bin/live-snapshot +++ b/bin/live-snapshot @@ -37,7 +37,39 @@ else set -e fi -. /usr/share/initramfs-tools/scripts/live-helpers +## Begin FIXME: this is an embedded copy of the old 'live-helpers' initramfs script +if [ ! -x "/bin/fstype" ] +then + # klibc not in path -> not in initramfs + export PATH="${PATH}:/usr/lib/klibc/bin" +fi + +# handle upgrade path from old udev (using udevinfo) to +# recent versions of udev (using udevadm info) +if [ -x /sbin/udevadm ] +then + udevinfo='/sbin/udevadm info' +else + udevinfo='udevinfo' +fi + +old_root_overlay_label="live-rw" +old_home_overlay_label="home-rw" +custom_overlay_label="custom-ov" +root_snapshot_label="live-sn" +old_root_snapshot_label="live-sn" +home_snapshot_label="home-sn" +persistence_list="live-persistence.conf" + +# include all scripts for the time being until snapshots are either dropped or cleaned up +for _SCRIPT in /lib/live/boot/* +do + if [ -e "${_SCRIPT}" ] + then + . ${_SCRIPT} + fi +done +## End FIXME: this is an embedded copy of the old 'live-helpers' initramfs script LIVE_CONF="/etc/live/boot.d/snapshot.conf" diff --git a/initramfs-tools/hooks/live b/initramfs-tools/hooks/live index 40f3de6..f0e945f 100755 --- a/initramfs-tools/hooks/live +++ b/initramfs-tools/hooks/live @@ -70,7 +70,6 @@ copy_exec /usr/share/live-boot/live-preseed /bin # Scripts cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts -cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts # klibc dependencies for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr* diff --git a/initramfs-tools/scripts/live-bottom/10validateroot b/initramfs-tools/scripts/live-bottom/10validateroot index d4d1620..32fcea3 100755 --- a/initramfs-tools/scripts/live-bottom/10validateroot +++ b/initramfs-tools/scripts/live-bottom/10validateroot @@ -21,7 +21,6 @@ case "${1}" in esac . /scripts/live-functions -. /scripts/live-helpers if ! [ -d "/root/usr/share/live-boot" ] then diff --git a/scripts/boot.sh b/scripts/boot.sh index 5d4a20d..0b18a9c 100755 --- a/scripts/boot.sh +++ b/scripts/boot.sh @@ -35,7 +35,28 @@ then touch /etc/mtab fi -. /scripts/live-helpers +if [ ! -x "/bin/fstype" ] +then + # klibc not in path -> not in initramfs + export PATH="${PATH}:/usr/lib/klibc/bin" +fi + +# handle upgrade path from old udev (using udevinfo) to +# recent versions of udev (using udevadm info) +if [ -x /sbin/udevadm ] +then + udevinfo='/sbin/udevadm info' +else + udevinfo='udevinfo' +fi + +old_root_overlay_label="live-rw" +old_home_overlay_label="home-rw" +custom_overlay_label="custom-ov" +root_snapshot_label="live-sn" +old_root_snapshot_label="live-sn" +home_snapshot_label="home-sn" +persistence_list="live-persistence.conf" if [ ! -f /live.vars ] then diff --git a/initramfs-tools/scripts/live-helpers b/scripts/boot/misc-helpers.sh old mode 100644 new mode 100755 similarity index 97% rename from initramfs-tools/scripts/live-helpers rename to scripts/boot/misc-helpers.sh index 73d15e7..202ebe6 --- a/initramfs-tools/scripts/live-helpers +++ b/scripts/boot/misc-helpers.sh @@ -1,27 +1,4 @@ -# live-boot helper functions, used by live-boot on boot and by live-snapshot - -if [ ! -x "/bin/fstype" ] -then - # klibc not in path -> not in initramfs - export PATH="${PATH}:/usr/lib/klibc/bin" -fi - -# handle upgrade path from old udev (using udevinfo) to -# recent versions of udev (using udevadm info) -if [ -x /sbin/udevadm ] -then - udevinfo='/sbin/udevadm info' -else - udevinfo='udevinfo' -fi - -old_root_overlay_label="live-rw" -old_home_overlay_label="home-rw" -custom_overlay_label="custom-ov" -root_snapshot_label="live-sn" -old_root_snapshot_label="live-sn" -home_snapshot_label="home-sn" -persistence_list="live-persistence.conf" +#!/bin/sh is_in_list_separator_helper () { local sep=${1} -- 2.1.4