aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-01-04 14:58:41 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-01-05 14:23:54 +0000
commitfda7e3a8891679e7c6bc732f9db82f3fec61661a (patch)
tree809e217418091faa5abcbaeef875101a2fb83e7a
parent444f6067d59a88b5e8d6346099e864efb231606c (diff)
downloadalpine_aports-fda7e3a8891679e7c6bc732f9db82f3fec61661a.tar.bz2
alpine_aports-fda7e3a8891679e7c6bc732f9db82f3fec61661a.tar.xz
alpine_aports-fda7e3a8891679e7c6bc732f9db82f3fec61661a.zip
main/mkinitfs: fix for init
we need generate the /etc/apk/repositories after we have relocated /media/$UUID to /media/usb fixes #891 (cherry picked from commit 1b581690423ac11ecd853d8be9abe8a15a0ff146)
-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 @@
1From eb96e64b989ae7cf39cd0cdf849104ac1d5ee655 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 4 Jan 2012 14:53:52 +0000
4Subject: [PATCH] init: generate the repositories after relocation
5
6This solves problem when UUID is used in syslinux.cfg when booting
7USB devices. The generated repositories had /media/$UUID/apks but
8the /media/$UUID got relocated to /media/usb
9---
10 initramfs-init.in | 24 +++++++++++++++---------
11 1 files changed, 15 insertions(+), 9 deletions(-)
12
13diff --git a/initramfs-init.in b/initramfs-init.in
14index 98916d7..226872b 100755
15--- a/initramfs-init.in
16+++ b/initramfs-init.in
17@@ -269,6 +269,12 @@ find_fs_type() {
18 done
19 }
20
21+# find the dirs under ALPINE_MNT that are boot repositories
22+find_boot_repositories() {
23+ find $ALPINE_MNT -name .boot_repository -type f -maxdepth 3 \
24+ | sed 's:/.boot_repository$::'
25+}
26+
27 # gotta start from somewhere :)
28 echo "Alpine Init $VERSION"
29
30@@ -429,8 +435,7 @@ retry_mount -o ro $mount_opts $ALPINE_DEV $ALPINE_MNT >/dev/null 2>&1
31 eend $?
32
33 # generate apk repositories file
34-echo "$(find $ALPINE_MNT -name .boot_repository -type f -maxdepth 3 \
35- | sed 's:/.boot_repository$::')" > /tmp/repositories
36+find_boot_repositories > /tmp/repositories
37
38 # early console?
39 if [ "$SINGLEMODE" = "yes" ]; then
40@@ -526,13 +531,9 @@ mkdir -p $sysroot/etc/apk/keys/
41 cp -a /etc/apk/keys $sysroot/etc/apk
42
43 # generate repo opts for apk
44-if [ ! -f $sysroot/etc/apk/repositories ]; then
45- mv /tmp/repositories $sysroot/etc/apk/
46-else
47- for i in $(cat /tmp/repositories); do
48- repo_opt="$repo_opt --repository $i"
49- done
50-fi
51+for i in $(cat /tmp/repositories); do
52+ repo_opt="$repo_opt --repository $i"
53+done
54
55 # install new root
56 ebegin "Installing packages to root filesystem"
57@@ -565,6 +566,11 @@ if [ -z "$has_fstab" ] && [ -f "$sysroot"/etc/fstab ]; then
58 relocate_alpine_mnt "$sysroot"/etc/fstab
59 fi
60
61+# generate repositories if none exists. this needs to be done after relocation
62+if ! [ -f "$sysroot"/etc/apk/repositories ]; then
63+ find_boot_repositories > "$sysroot"/etc/apk/repositories
64+fi
65+
66 # respect mount options in fstab for ALPINE_MNT (e.g if user wants rw)
67 opts=$(awk "\$2 == \"$ALPINE_MNT\" {print \$4}" $sysroot/etc/fstab)
68 if [ -n "$opts" ]; then
69--
701.7.8.2
71
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 @@
1From 60821c8ba0118d231cd3b4fd008cd42868337439 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 27 Oct 2011 09:54:59 +0000
4Subject: [PATCH 1/2] init: try detect alpine_dev filesystem if not specified
5
6Note that ext4 will be detected as ext3
7---
8 initramfs-init.in | 22 +++++++++++++++++++++-
9 1 files changed, 21 insertions(+), 1 deletions(-)
10
11diff --git a/initramfs-init.in b/initramfs-init.in
12index 0e30137..7c477c7 100755
13--- a/initramfs-init.in
14+++ b/initramfs-init.in
15@@ -255,6 +255,20 @@ relocate_alpine_mnt() {
16 fi
17 }
18
19+# detect filesystem type on given device/UUID
20+find_fs_type() {
21+ local dev=$(findfs $1)
22+ local i=
23+ for i in $(blkid $dev); do
24+ case $i in
25+ TYPE=*) eval "$i"
26+ echo $TYPE
27+ return
28+ ;;
29+ esac
30+ done
31+}
32+
33 # gotta start from somewhere :)
34 echo "Alpine Init $VERSION"
35
36@@ -314,7 +328,7 @@ case "$ALPINE_DEV" in
37 UUID=*|LABEL=*) ;;
38 *) ALPINE_DEV=/dev/$ALPINE_DEV ;;
39 esac
40-
41+
42 # look for standard mountpoint locations
43 ALPINE_MNT=$(find_mnt $ALPINE_DEV /etc/fstab)
44 [ -z "$ALPINE_MNT" ] && ALPINE_MNT=/media/${ALPINE_DEV##*/}
45@@ -398,6 +412,12 @@ start_lvm
46 # locate boot media and mount it
47 ebegin "Mounting boot media"
48 mkdir -p $ALPINE_MNT
49+
50+# try detect the filesystem
51+if [ -z "$ALPINE_DEV_FS" ]; then
52+ ALPINE_DEV_FS=$(find_fs_type $ALPINE_DEV)
53+fi
54+
55 if [ -n "$ALPINE_DEV_FS" ]; then
56 mount_opts="-t $ALPINE_DEV_FS"
57 fi
58--
591.7.7.1
60
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 @@
1From 8ff0a825348f5a0c628540d3a859a73624c7f066 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 27 Oct 2011 12:05:27 +0000
4Subject: [PATCH 2/2] init: new boot option: debug_init
5
6will enable lots of verbose debugging
7---
8 initramfs-init.in | 3 +++
9 1 files changed, 3 insertions(+), 0 deletions(-)
10
11diff --git a/initramfs-init.in b/initramfs-init.in
12index 7c477c7..69e8d27 100755
13--- a/initramfs-init.in
14+++ b/initramfs-init.in
15@@ -289,6 +289,9 @@ while [ $# -gt 0 ]; do
16 shift
17 done
18
19+# enable debugging if requested
20+[ -n "$KOPT_debug_init" ] && set -x
21+
22 # pick first keymap if found
23 for map in /etc/keymap/*; do
24 if [ -f "$map" ]; then
25--
261.7.7.1
27
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 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=mkinitfs 2pkgname=mkinitfs
3pkgver=2.4.2 3pkgver=2.4.2
4pkgrel=0 4pkgrel=1
5pkgdesc="Tool to generate initramfs images for Alpine" 5pkgdesc="Tool to generate initramfs images for Alpine"
6url=http://git.alpinelinux.org/cgit/mkinitfs 6url=http://git.alpinelinux.org/cgit/mkinitfs
7depends="busybox apk-tools>=2.0" 7depends="busybox apk-tools>=2.0"
8triggers="$pkgname.trigger=/usr/share/kernel/*" 8triggers="$pkgname.trigger=/usr/share/kernel/*"
9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
10 0001-init-generate-the-repositories-after-relocation.patch
10 eglibc.patch 11 eglibc.patch
11 " 12 "
12arch="noarch" 13arch="noarch"
@@ -43,4 +44,5 @@ package() {
43 make install DESTDIR="$pkgdir" || return 1 44 make install DESTDIR="$pkgdir" || return 1
44} 45}
45md5sums="0a2306eefdeb8a92121eae6546d0d873 mkinitfs-2.4.2.tar.bz2 46md5sums="0a2306eefdeb8a92121eae6546d0d873 mkinitfs-2.4.2.tar.bz2
47f2719523ec4c5e877ae46e70e6f85edb 0001-init-generate-the-repositories-after-relocation.patch
46e59c2f7de496fe430b07e32fd812ebe0 eglibc.patch" 48e59c2f7de496fe430b07e32fd812ebe0 eglibc.patch"