From f8542102cc332ac9916ef3ef1c7a8123157cf4b1 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 22 Oct 2010 10:35:55 +0000 Subject: [PATCH] init: add support for pkgs=... boot opt and UUID in alpine_dev --- initramfs-init.in | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/initramfs-init.in b/initramfs-init.in index 9642ce6..1680543 100755 --- a/initramfs-init.in +++ b/initramfs-init.in @@ -220,9 +220,14 @@ if [ -n "$KOPT_ovl_dev" ] ; then fi fi +case "$ALPINE_DEV" in + UUID=*) ;; + *) ALPINE_DEV=/dev/$ALPINE_DEV ;; +esac + # look for standard mountpoint locations -ALPINE_MNT=$(find_mnt /dev/$ALPINE_DEV /etc/fstab) -[ -z "$ALPINE_MNT" ] && ALPINE_MNT=/media/$ALPINE_DEV +ALPINE_MNT=$(find_mnt $ALPINE_DEV /etc/fstab) +[ -z "$ALPINE_MNT" ] && ALPINE_MNT=/media/${ALPINE_DEV##*/} # hide kernel messages [ "$KOPT_quiet" = yes ] && dmesg -n 1 @@ -296,7 +301,7 @@ if [ -n "$ALPINE_DEV_FS" ]; then mount_opts="-t $ALPINE_DEV_FS" fi -retry_mount $mount_opts /dev/$ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1 +retry_mount $mount_opts $ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1 eend $? # early console? @@ -328,6 +333,11 @@ if ! [ -f "$ovl" ]; then ovl=$(find_ovl $ALPINE_MNT) fi +# parse pkgs=pkg1,pkg2 +if [ -n "$KOPT_pkgs" ]; then + pkgs=$(echo "$KOPT_pkgs" | tr ',' ' ' ) +fi + if [ -f "$ovl" ]; then ebegin "Loading user settings from $ovl" # create apk db and needed /dev/null and /tmp first @@ -338,7 +348,7 @@ if [ -f "$ovl" ]; then # hack, incase /root/.ssh was included in apkovl [ -d "$sysroot/root" ] && chmod 700 "$sysroot/root" umount /media/$i 2>/dev/null & - pkgs=$(sed 's/\#.*//' $sysroot/etc/lbu/packages.list 2>/dev/null) + pkgs="$pkgs $(sed 's/\#.*//' $sysroot/etc/lbu/packages.list 2>/dev/null)" rm -f "$sysroot"/etc/lbu/packages.list pkgs="$pkgs $(cat $sysroot/var/lib/apk/world 2>/dev/null)" else @@ -377,7 +387,7 @@ pkgs="$pkgs alpine-base" # move the ALPINE_MNT if ALPINE_DEV is specified in users fstab # this is so a generated /etc/apk/repositories will use correct mount dir -new_mnt=$(find_mnt /dev/$ALPINE_DEV $sysroot/etc/fstab) +new_mnt=$(find_mnt $ALPINE_DEV $sysroot/etc/fstab) if [ -n "$new_mnt" ] && [ "$new_mnt" != "$ALPINE_MNT" ]; then mkdir -p $new_mnt mount -o move $ALPINE_MNT $new_mnt -- 1.7.3.1