* [gentoo-commits] gentoo-x86 commit in sys-kernel/dracut/files: dracut-002-dir-symlinks.patch dracut-002-add-missing-functions.patch dracut-002-custom-paths.patch dracut-002-gencmdline-check-for-keyboard-i18n-files.patch dracut-002-unmount.patch
@ 2009-09-29 5:17 Lance Albertson (ramereth)
0 siblings, 0 replies; only message in thread
From: Lance Albertson (ramereth) @ 2009-09-29 5:17 UTC (permalink / raw
To: gentoo-commits
ramereth 09/09/29 05:17:59
Added: dracut-002-dir-symlinks.patch
dracut-002-add-missing-functions.patch
dracut-002-custom-paths.patch
dracut-002-gencmdline-check-for-keyboard-i18n-files.patch
dracut-002-unmount.patch
Log:
New package dracut, a generic initramfs building tool
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Revision Changes Path
1.1 sys-kernel/dracut/files/dracut-002-dir-symlinks.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-dir-symlinks.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-dir-symlinks.patch?rev=1.1&content-type=text/plain
Index: dracut-002-dir-symlinks.patch
===================================================================
From 044fbc9ed51e4df819ee5710ed519c566579ff59 Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Sat, 26 Sep 2009 21:33:41 -0700
Subject: [PATCH 3/3] dir symlinks
---
dracut | 2 +-
dracut-functions | 43 +++++++++++++++++++++++++++++++++++++------
2 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/dracut b/dracut
index b96ad5e..0518969 100755
--- a/dracut
+++ b/dracut
@@ -174,7 +174,7 @@ export initdir hookdirs dsrc dracutmodules drivers \
if [[ $kernel_only != yes ]]; then
# Create some directory structure first
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do
- mkdir -p "$initdir/$d";
+ inst_dir "/$d";
done
fi
diff --git a/dracut-functions b/dracut-functions
index 2abd6f2..1f2d1e6 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -131,6 +131,36 @@ check_vol_slaves() {
return 1
}
+# Install a directory, keeping symlinks as on the original system.
+# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file"
+# will create ${initdir}/lib64, ${initdir}/lib64/file,
+# and a symlink ${initdir}/lib -> lib64.
+inst_dir() {
+ local dir="$1"
+ [[ -e "${initdir}$dir" ]] && return 0
+
+ # iterate over parent directories
+ local file=""
+ local IFS="/"
+ for part in $dir; do
+ [ -z "$part" ] && continue
+ file="$file/$part"
+ [[ -e "${initdir}$file" ]] && continue
+
+ if [ -L "$file" ]; then
+ # create link as the original
+ local target=$(readlink "$file")
+ ln -sfn "$target" "${initdir}$file" || return 1
+ # resolve relative path and recursively install destionation
+ [[ "$target" = "${target##*/}" ]] && target="${file%/*}/$target"
+ inst_dir "$target"
+ else
+ # create directory
+ mkdir -p "${initdir}$file" || return 1
+ fi
+ done
+}
+
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $initdir
@@ -138,11 +168,11 @@ check_vol_slaves() {
inst_simple() {
local src target
[[ -f $1 ]] || return 1
- src=$1 target=${initdir}${2:-$1}
- [[ -f $target ]] && return 0
- mkdir -p "${target%/*}"
+ src=$1 target="${2:-$1}"
+ [[ -f ${initdir}$target ]] && return 0
+ inst_dir "${target%/*}"
dinfo "Installing $src"
- cp -pfL "$src" "$target"
+ cp -fL "$src" "${initdir}$target"
}
# Same as above, but specialzed to handle dynamic libraries.
@@ -155,7 +185,7 @@ inst_library() {
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
- mkdir -p "${initdir}${dest%/*}"
+ inst_dir "${dest%/*}"
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
else
inst_simple "$src" "$dest"
@@ -250,7 +280,8 @@ find_rule() {
# create a function to install them to make life simpler.
inst_rules() {
local target=/etc/udev/rules.d
- mkdir -p "$initdir/lib/udev/rules.d" "$initdir$target"
+ inst_dir "/lib/udev/rules.d"
+ inst_dir "$target"
for rule in "$@"; do
rule=$(find_rule "$rule") && \
inst_simple "$rule" "$target/${rule##*/}"
--
1.6.3.3
1.1 sys-kernel/dracut/files/dracut-002-add-missing-functions.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-add-missing-functions.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-add-missing-functions.patch?rev=1.1&content-type=text/plain
Index: dracut-002-add-missing-functions.patch
===================================================================
From 5e5ec023bedc14d709f1d5f8e2803ba171b05daa Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 18 Sep 2009 09:08:23 +0200
Subject: [PATCH] dracut-gencmdline: add missing functions
---
dracut-gencmdline | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/dracut-gencmdline b/dracut-gencmdline
index bab102f..f3cbee1 100755
--- a/dracut-gencmdline
+++ b/dracut-gencmdline
@@ -19,6 +19,39 @@
#
#. /usr/libexec/initrd-functions
+IF_verbose=""
+function set_verbose() {
+ case $1 in
+ 1|true|yes|on)
+ IF_verbose="-v"
+ ;;
+ 0|false|no|off)
+ IF_verbose=""
+ ;;
+ esac
+}
+
+function is_verbose() {
+ [ -n "$IF_verbose" ] && return 0
+ return 1
+}
+
+function get_verbose() {
+ echo "$IF_verbose"
+ is_verbose
+}
+
+
+function get_numeric_dev() {
+(
+ fmt="%d:%d"
+ if [ "$1" == "hex" ]; then
+ fmt="%x:%x"
+ fi
+ ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
+) 2>/dev/null
+}
+
function error() {
echo "$@" >&2
--
1.6.3.3
1.1 sys-kernel/dracut/files/dracut-002-custom-paths.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-custom-paths.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-custom-paths.patch?rev=1.1&content-type=text/plain
Index: dracut-002-custom-paths.patch
===================================================================
From 550fa5f9ae8c6b2fa284d78c090edc5a36991d3a Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Sat, 26 Sep 2009 21:26:43 -0700
Subject: [PATCH 2/3] custom paths
---
Makefile | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index d9ce0f8..f6d162f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
VERSION=002
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
-prefix = /usr
-datadir = ${prefix}/share
-pkglibdir = ${datadir}/dracut
-sysconfdir = ${prefix}/etc
-sbindir = ${prefix}/sbin
-mandir = ${prefix}/share/man
+prefix ?= /usr
+datadir ?= ${prefix}/share
+pkglibdir ?= ${datadir}/dracut
+sysconfdir ?= ${prefix}/etc
+sbindir ?= ${prefix}/sbin
+mandir ?= ${prefix}/share/man
modules.d/99base/switch_root: switch_root.c
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
--
1.6.3.3
1.1 sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-gencmdline-check-for-keyboard-i18n-files.patch?rev=1.1&content-type=text/plain
Index: dracut-002-gencmdline-check-for-keyboard-i18n-files.patch
===================================================================
From 6dc6649052d07a6ab0720bd4e866629cb385cb8a Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Mon, 28 Sep 2009 20:30:17 -0700
Subject: [PATCH] dracut-gencmdline: check for keyboard & i18n files
---
dracut-gencmdline | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-gencmdline b/dracut-gencmdline
index f3cbee1..0f2bca1 100755
--- a/dracut-gencmdline
+++ b/dracut-gencmdline
@@ -689,8 +689,8 @@ for cryptdev in ${!cryptolv@} ; do
done
# output local keyboard/18n settings
-. /etc/sysconfig/keyboard
-. /etc/sysconfig/i18n
+[ -e /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
+[ -e /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
val=$(eval echo \$$i)
--
1.6.3.3
1.1 sys-kernel/dracut/files/dracut-002-unmount.patch
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-unmount.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-kernel/dracut/files/dracut-002-unmount.patch?rev=1.1&content-type=text/plain
Index: dracut-002-unmount.patch
===================================================================
From 7aa5f85a748dcad3567c878b8623af446f0d8c4f Mon Sep 17 00:00:00 2001
From: Lance Albertson <lance@osuosl.org>
Date: Sat, 26 Sep 2009 21:26:06 -0700
Subject: [PATCH 1/3] fix umount
---
switch_root.c | 13 +++----------
1 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/switch_root.c b/switch_root.c
index 8ce4aaf..1643a71 100644
--- a/switch_root.c
+++ b/switch_root.c
@@ -160,22 +160,15 @@ done:
static int switchroot(const char *newroot)
{
/* Don't try to unmount the old "/", there's no way to do it. */
- const char *umounts[] = { "/dev", "/proc", "/sys", NULL };
+ const char *umounts[] = { "/dev/pts", "/dev", "/proc", "/sys", NULL };
char *newroot_mnt;
const char *chroot_path = NULL;
int i;
int r = -1;
for (i = 0; umounts[i] != NULL; i++) {
- char newmount[PATH_MAX];
-
- snprintf(newmount, sizeof(newmount), "%s%s", newroot, umounts[i]);
-
- if (mount(umounts[i], newmount, NULL, MS_MOVE, NULL) < 0) {
- warn("failed to mount moving %s to %s",
- umounts[i], newmount);
- warnx("forcing unmount of %s", umounts[i]);
- umount2(umounts[i], MNT_FORCE);
+ if (umount2(umounts[i], MNT_FORCE) < 0) {
+ warn("failed to unmount %s", umounts[i]);
}
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-29 5:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29 5:17 [gentoo-commits] gentoo-x86 commit in sys-kernel/dracut/files: dracut-002-dir-symlinks.patch dracut-002-add-missing-functions.patch dracut-002-custom-paths.patch dracut-002-gencmdline-check-for-keyboard-i18n-files.patch dracut-002-unmount.patch Lance Albertson (ramereth)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox