home: hub: mkinitfs

Download patch

ref: f8542102cc332ac9916ef3ef1c7a8123157cf4b1
parent: c744c6fb917259fc6f5e8564eee82f2019b4ce52
author: Natanael Copa <ncopa@alpinelinux.org>
date: Fri Oct 22 05:35:55 CDT 2010

init: add support for pkgs=... boot opt and UUID in alpine_dev

--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -220,9 +220,14 @@
 	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 @@
 	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 @@
 	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 @@
 	# 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 @@
 
 # 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