From 101c4ab7e441f83d8d4a4f5ec005e429b3f17d0d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 18 Apr 2010 20:41:52 +0200 Subject: [PATCH] Adding upstream version 1.130.1. --- Makefile | 2 +- bin/live-new-uuid | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ bin/live-snapshot | 2 +- docs/ChangeLog.casper | 19 +++++++++++++ hooks/live | 14 +++++----- scripts/live | 6 ++++ scripts/live-functions | 29 +++++++++++++++++++ 7 files changed, 138 insertions(+), 9 deletions(-) create mode 100755 bin/live-new-uuid diff --git a/Makefile b/Makefile index dd0a6b9..c377644 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ install: test build # Installing executables mkdir -p $(DESTDIR)/sbin - cp bin/live-getty bin/live-login bin/live-snapshot $(DESTDIR)/sbin + cp bin/live-getty bin/live-login bin/live-new-uuid bin/live-snapshot $(DESTDIR)/sbin mkdir -p $(DESTDIR)/usr/share/live-initramfs cp bin/live-preseed bin/live-reconfigure $(DESTDIR)/usr/share/live-initramfs diff --git a/bin/live-new-uuid b/bin/live-new-uuid new file mode 100755 index 0000000..4a6afa6 --- /dev/null +++ b/bin/live-new-uuid @@ -0,0 +1,75 @@ +#!/bin/sh +# -*- coding: utf-8 -*- +# +# «casper-new-uuid» - Creates and injects new UUIDs for casper disks +# +# Create new UUIDs for disks to prevent conflicts and booting the wrong casper +# directory. Particularly useful in creating recovery disks that need to be +# able to also work with recovery partitioning schemes. +# +# Copyright (C) 2008, Dell Inc. +# +# Author: +# - Mario Limonciello +# +# This script is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this application; if not, write to the Free Software Foundation, Inc., 51 +# Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +################################################################################## + +set -e + +help() { + echo + echo "USAGE: $0 initrd.gz " + echo + echo "initrd.gz is the absolute path to the original gzipped initramfs" + echo " is the destination directory for the new gzipped initramfs" + echo " is the destination directory for the new casper-uuid-TYPE " + echo + echo "if either path is absent, they will end up in the current directory " + echo "TYPE is determined by an already existing casper-uuid-* or by 'uname -s'" +} + +if [ "$#" = "0" ] || [ "x$1" = x-h ] || [ "x$1" = x--help ]; then + help + exit 3 +fi + +CWD=`pwd` +TEMPDIR=`mktemp -d /tmp/uuid-XXXXXX` +TYPE=`uname -r | cut -d '-' -f 3` + +if [ -z "$2" ] || [ ! -d "$2" ] || [ "$2" = "." ]; then + GZIPDIR="$CWD" +else + GZIPDIR="$2" +fi + +if [ -z "$3" ] || [ ! -d "$3" ] || [ "$3" = "." ]; then + CASPERDIR="$CWD" +else + CASPERDIR="$3" +fi + +cd "$TEMPDIR" +zcat "$1" | cpio -id +uuidgen -r > conf/uuid.conf +find . | cpio --quiet --dereference -o -H newc | gzip > "$GZIPDIR/initrd.gz" +if [ "$(ls "$CASPERDIR/casper-uuid"-* >/dev/null 2>&1 | wc -l)" = 1 ]; then + cp conf/uuid.conf "$CASPERDIR/casper-uuid"-* +else + cp conf/uuid.conf "$CASPERDIR/casper-uuid-$TYPE" +fi +cd "$CWD" +rm -rf "$TEMPDIR" diff --git a/bin/live-snapshot b/bin/live-snapshot index 141d266..12c79b8 100755 --- a/bin/live-snapshot +++ b/bin/live-snapshot @@ -302,7 +302,7 @@ Do_snapshot () ext2|ext3) DU_DIM="$(du -ks ${SNAP_COW} | cut -f1)" REAL_DIM="$(expr ${DU_DIM} + ${DU_DIM} / 20)" # Just 5% more to be sure, need something more sophistcated here... - genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${SNAP_COW}" "${DEST}" + genext2fs --size-in-blocks=${REAL_DIM} --reserved-percentage=0 --root="${SNAP_COW}" "${DEST}" ;; jffs2) diff --git a/docs/ChangeLog.casper b/docs/ChangeLog.casper index 6e990b5..6bc93d9 100644 --- a/docs/ChangeLog.casper +++ b/docs/ChangeLog.casper @@ -1,3 +1,22 @@ +casper (1.130) hardy; urgency=low + + * Handle use of debian-installer/language for locale selection + (LP: #213930). + + -- Colin Watson Sat, 12 Apr 2008 00:30:10 +0100 + +casper (1.129) hardy; urgency=low + + * Add COPYING file with GPL text (LP: #211923). + * Add casper-new-uuid script to simplify UUID regeneration process, + contributed by Mario Limonciello of Dell (LP: #209847). + * Update casper-snapshot for genext2fs --reserved-blocks => + --reserved-percentage option change (LP: #202048). Add a Breaks as the + most lightweight available method of documenting that we need genext2fs + >= 1.4.1 for this. + + -- Colin Watson Thu, 10 Apr 2008 01:45:47 +0100 + casper (1.128) hardy; urgency=low [ Luke Yelavich ] diff --git a/hooks/live b/hooks/live index 5c00534..3552f3a 100755 --- a/hooks/live +++ b/hooks/live @@ -46,6 +46,12 @@ copy_exec /usr/share/live-initramfs/live-preseed /bin cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts cp /usr/share/initramfs-tools/scripts/live-helpers "${DESTDIR}"/scripts +# klibc dependencies +for hidden_klibc_dep_library in libacl libblkid libuuid libdevmapper libattr +do + cp -a /lib/${hidden_klibc_dep_library}.so.* "${DESTDIR}"/lib +done + # Handling other stuff # Configuration: keymap (usefull when using encryption) @@ -81,8 +87,8 @@ manual_add_modules jffs2 copy_exec /sbin/losetup /sbin manual_add_modules loop manual_add_modules squashfs -manual_add_modules unlzma manual_add_modules sqlzma +manual_add_modules unlzma # Filesystem: unionfs/aufs manual_add_modules unionfs @@ -126,9 +132,3 @@ if [ -x /usr/bin/wget ] then copy_exec /usr/bin/wget /bin fi - -# Fix missing klibc deps -for hidden_klibc_dep_library in libacl libblkid libuuid libdevmapper libattr -do - cp -a /lib/${hidden_klibc_dep_library}.so.* ${DESTDIR}/lib -done diff --git a/scripts/live b/scripts/live index 46dcb74..240691a 100755 --- a/scripts/live +++ b/scripts/live @@ -154,6 +154,12 @@ Arguments () export LIVE_MEDIA_TIMEOUT ;; + language=*|debian-installer/language=*) + language=${x#debian-installer/language=} + locale="$(lang2locale "$language")" + set_locale="true" + ;; + locale=*|debian-installer/locale=*) LOCALE="${ARGUMENT#*=}" export LOCALE diff --git a/scripts/live-functions b/scripts/live-functions index 964fdf0..b6d04fb 100644 --- a/scripts/live-functions +++ b/scripts/live-functions @@ -29,3 +29,32 @@ really_export () eval export "${STRING}"="${VALUE}" } + +lang2locale() { + langpart="${1%%_*}" + if [ "$1" != "C" ]; then + # Match the language code with 3rd field in languagelist + line=$(grep -v "^#" /root/usr/share/localechooser/languagelist | cut -f3,4,5 -d\; | grep -v ';C$' | grep "^$langpart;") + if [ -n "$line" ]; then + if [ "$(echo "$line" | grep -c '')" -gt 1 ]; then + # More than one match; try matching the + # country as well. + countrypart="${1#*_}" + if [ "$countrypart" = "$1" ]; then + countryline="$(echo "$line" | head -n1)" + echo "${countryline##*;}" + return + fi + countrypart="${countrypart%%[@.]*}" + countryline="$(echo "$line" | grep ";$countrypart;" | head -n1 || true)" + if [ "$countryline" ]; then + echo "${countryline##*;}" + return + fi + fi + echo "${line##*;}" + fi + else + echo "C" + fi +} -- 2.1.4