aboutsummaryrefslogtreecommitdiffstats
path: root/main/mkinitfs
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-01-04 14:58:41 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-01-04 14:58:41 +0000
commit1b581690423ac11ecd853d8be9abe8a15a0ff146 (patch)
treef9de68824a8232923cc3e994a01a14b0af36dabd /main/mkinitfs
parent5e783118a06cc420c899d3187ab36b38509a2c38 (diff)
downloadaports-1b581690423ac11ecd853d8be9abe8a15a0ff146.tar.bz2
aports-1b581690423ac11ecd853d8be9abe8a15a0ff146.tar.xz
main/mkinitfs: fix for init
we need generate the /etc/apk/repositories after we have relocated /media/$UUID to /media/usb ref #891
Diffstat (limited to 'main/mkinitfs')
-rw-r--r--main/mkinitfs/0001-init-generate-the-repositories-after-relocation.patch71
-rw-r--r--main/mkinitfs/0001-init-try-detect-alpine_dev-filesystem-if-not-specifi.patch60
-rw-r--r--main/mkinitfs/0002-init-new-boot-option-debug_init.patch27
-rw-r--r--main/mkinitfs/APKBUILD4
4 files changed, 161 insertions, 1 deletions
diff --git a/main/mkinitfs/0001-init-generate-the-repositories-after-relocation.patch b/main/mkinitfs/0001-init-generate-the-repositories-after-relocation.patch
new file mode 100644
index 0000000000..b5c14d8dd6
--- /dev/null
+++ b/main/mkinitfs/0001-init-generate-the-repositories-after-relocation.patch
@@ -0,0 +1,71 @@
+From eb96e64b989ae7cf39cd0cdf849104ac1d5ee655 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 4 Jan 2012 14:53:52 +0000
+Subject: [PATCH] init: generate the repositories after relocation
+
+This solves problem when UUID is used in syslinux.cfg when booting
+USB devices. The generated repositories had /media/$UUID/apks but
+the /media/$UUID got relocated to /media/usb
+---
+ initramfs-init.in | 24 +++++++++++++++---------
+ 1 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 98916d7..226872b 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -269,6 +269,12 @@ find_fs_type() {
+ done
+ }
+
++# find the dirs under ALPINE_MNT that are boot repositories
++find_boot_repositories() {
++ find $ALPINE_MNT -name .boot_repository -type f -maxdepth 3 \
++ | sed 's:/.boot_repository$::'
++}
++
+ # gotta start from somewhere :)
+ echo "Alpine Init $VERSION"
+
+@@ -429,8 +435,7 @@ retry_mount -o ro $mount_opts $ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1
+ eend $?
+
+ # generate apk repositories file
+-echo "$(find $ALPINE_MNT -name .boot_repository -type f -maxdepth 3 \
+- | sed 's:/.boot_repository$::')" > /tmp/repositories
++find_boot_repositories > /tmp/repositories
+
+ # early console?
+ if [ "$SINGLEMODE" = "yes" ]; then
+@@ -526,13 +531,9 @@ mkdir -p $sysroot/etc/apk/keys/
+ cp -a /etc/apk/keys $sysroot/etc/apk
+
+ # generate repo opts for apk
+-if [ ! -f $sysroot/etc/apk/repositories ]; then
+- mv /tmp/repositories $sysroot/etc/apk/
+-else
+- for i in $(cat /tmp/repositories); do
+- repo_opt="$repo_opt --repository $i"
+- done
+-fi
++for i in $(cat /tmp/repositories); do
++ repo_opt="$repo_opt --repository $i"
++done
+
+ # install new root
+ ebegin "Installing packages to root filesystem"
+@@ -565,6 +566,11 @@ if [ -z "$has_fstab" ] && [ -f "$sysroot"/etc/fstab ]; then
+ relocate_alpine_mnt "$sysroot"/etc/fstab
+ fi
+
++# generate repositories if none exists. this needs to be done after relocation
++if ! [ -f "$sysroot"/etc/apk/repositories ]; then
++ find_boot_repositories > "$sysroot"/etc/apk/repositories
++fi
++
+ # respect mount options in fstab for ALPINE_MNT (e.g if user wants rw)
+ opts=$(awk "\$2 == \"$ALPINE_MNT\" {print \$4}" $sysroot/etc/fstab)
+ if [ -n "$opts" ]; then
+--
+1.7.8.2
+
diff --git a/main/mkinitfs/0001-init-try-detect-alpine_dev-filesystem-if-not-specifi.patch b/main/mkinitfs/0001-init-try-detect-alpine_dev-filesystem-if-not-specifi.patch
new file mode 100644
index 0000000000..01cb2c2e3b
--- /dev/null
+++ b/main/mkinitfs/0001-init-try-detect-alpine_dev-filesystem-if-not-specifi.patch
@@ -0,0 +1,60 @@
+From 60821c8ba0118d231cd3b4fd008cd42868337439 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 27 Oct 2011 09:54:59 +0000
+Subject: [PATCH 1/2] init: try detect alpine_dev filesystem if not specified
+
+Note that ext4 will be detected as ext3
+---
+ initramfs-init.in | 22 +++++++++++++++++++++-
+ 1 files changed, 21 insertions(+), 1 deletions(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 0e30137..7c477c7 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -255,6 +255,20 @@ relocate_alpine_mnt() {
+ fi
+ }
+
++# detect filesystem type on given device/UUID
++find_fs_type() {
++ local dev=$(findfs $1)
++ local i=
++ for i in $(blkid $dev); do
++ case $i in
++ TYPE=*) eval "$i"
++ echo $TYPE
++ return
++ ;;
++ esac
++ done
++}
++
+ # gotta start from somewhere :)
+ echo "Alpine Init $VERSION"
+
+@@ -314,7 +328,7 @@ case "$ALPINE_DEV" in
+ UUID=*|LABEL=*) ;;
+ *) ALPINE_DEV=/dev/$ALPINE_DEV ;;
+ esac
+-
++
+ # look for standard mountpoint locations
+ ALPINE_MNT=$(find_mnt $ALPINE_DEV /etc/fstab)
+ [ -z "$ALPINE_MNT" ] && ALPINE_MNT=/media/${ALPINE_DEV##*/}
+@@ -398,6 +412,12 @@ start_lvm
+ # locate boot media and mount it
+ ebegin "Mounting boot media"
+ mkdir -p $ALPINE_MNT
++
++# try detect the filesystem
++if [ -z "$ALPINE_DEV_FS" ]; then
++ ALPINE_DEV_FS=$(find_fs_type $ALPINE_DEV)
++fi
++
+ if [ -n "$ALPINE_DEV_FS" ]; then
+ mount_opts="-t $ALPINE_DEV_FS"
+ fi
+--
+1.7.7.1
+
diff --git a/main/mkinitfs/0002-init-new-boot-option-debug_init.patch b/main/mkinitfs/0002-init-new-boot-option-debug_init.patch
new file mode 100644
index 0000000000..361c1da239
--- /dev/null
+++ b/main/mkinitfs/0002-init-new-boot-option-debug_init.patch
@@ -0,0 +1,27 @@
+From 8ff0a825348f5a0c628540d3a859a73624c7f066 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 27 Oct 2011 12:05:27 +0000
+Subject: [PATCH 2/2] init: new boot option: debug_init
+
+will enable lots of verbose debugging
+---
+ initramfs-init.in | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 7c477c7..69e8d27 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -289,6 +289,9 @@ while [ $# -gt 0 ]; do
+ shift
+ done
+
++# enable debugging if requested
++[ -n "$KOPT_debug_init" ] && set -x
++
+ # pick first keymap if found
+ for map in /etc/keymap/*; do
+ if [ -f "$map" ]; then
+--
+1.7.7.1
+
diff --git a/main/mkinitfs/APKBUILD b/main/mkinitfs/APKBUILD
index f5727b61a0..b06ff573a9 100644
--- a/main/mkinitfs/APKBUILD
+++ b/main/mkinitfs/APKBUILD
@@ -1,12 +1,13 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mkinitfs
pkgver=2.4.2
-pkgrel=0
+pkgrel=1
pkgdesc="Tool to generate initramfs images for Alpine"
url=http://git.alpinelinux.org/cgit/mkinitfs
depends="busybox apk-tools>=2.0"
triggers="$pkgname.trigger=/usr/share/kernel/*"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
+ 0001-init-generate-the-repositories-after-relocation.patch
eglibc.patch
"
arch="noarch"
@@ -43,4 +44,5 @@ package() {
make install DESTDIR="$pkgdir" || return 1
}
md5sums="0a2306eefdeb8a92121eae6546d0d873 mkinitfs-2.4.2.tar.bz2
+f2719523ec4c5e877ae46e70e6f85edb 0001-init-generate-the-repositories-after-relocation.patch
e59c2f7de496fe430b07e32fd812ebe0 eglibc.patch"