aboutsummaryrefslogtreecommitdiffstats
path: root/main/mkinitfs/0002-init-fixes-for-new-apk-behaviour.patch
blob: 422bcd93202a18fe217fa597879da7d0faf289d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From a012d00b55499a918f32a0ca8bd4ae2421178dfd Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 6 Aug 2009 10:52:23 +0000
Subject: [PATCH 2/2] init: fixes for new apk behaviour

---
 initramfs-init.in |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/initramfs-init.in b/initramfs-init.in
index 0b295f8..0ea081c 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -6,7 +6,7 @@ SINGLEMODE=no
 sysroot=/sysroot
 
 /bin/busybox mkdir -p /usr/bin /usr/sbin /proc /sys /dev $sysroot \
-	/media/cdrom /media/floppy /media/usb
+	/media/cdrom /media/floppy /media/usb /tmp
 /bin/busybox --install -s
 
 # basic environment
@@ -313,10 +313,6 @@ else
 	rc_add savecache shutdown
 fi
 
-# copy the apk keys to sysroot
-mkdir -p "$sysroot"/etc/apk/keys
-cp -r /etc/apk/keys/* "$sysroot"/etc/apk/keys/ 2>/dev/null
-
 # let user override tmpfs size in fstab in apkovl
 if [ -f $sysroot/etc/fstab ]; then
 	mountopts=$(awk '$2 == "/" && $3 == "tmpfs" { print $4 }' $sysroot/etc/fstab)
@@ -342,13 +338,21 @@ if [ -n "$new_mnt" ] && [ "$new_mnt" != "$ALPINE_MNT" ]; then
 	ALPINE_MNT="$new_mnt"
 fi
 
-# generate apk repositories file
-mkdir -p /etc/apk
-repo_opt=
-for i in $(find $ALPINE_MNT -name 'APK*.gz' -type f -maxdepth 3 \
-	| sed 's:/APK.*\.gz$::'); do
-	repo_opt="$repo_opt --repo $i"
-done
+# copy keys so apk finds them. apk looks for stuff relative --root
+mkdir -p $sysroot/etc/apk/keys/
+cp -a /etc/apk/keys $sysroot/etc/apk
+
+# generate apk repositories file and --repo opt 
+echo "$(find $ALPINE_MNT -name .boot_repository -type f -maxdepth 3 \
+	| sed 's:/.boot_repository$::')" > /tmp/repositories
+
+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 --repo $i"
+	done
+fi
 
 # install new root
 ebegin "Installing packages to root filesystem"
-- 
1.6.4