Commit 2251f300 authored by Natanael Copa's avatar Natanael Copa

main/mkinitfs: backport fixes for new apk-tools behaviour

parent f4a76bb2
From 745fe99e8be2f889ff79a544dd6a314b69437258 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 6 Aug 2009 09:24:24 +0000
Subject: [PATCH 1/2] mkinitfs: support for -q. echo to stdout rather than stderr
---
mkinitfs.in | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/mkinitfs.in b/mkinitfs.in
index 5b7bfbd..c0746fe 100755
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -152,6 +152,7 @@ options:
-l only list files that would have been used
-L list available features
-o set another outfile
+ -q Quiet mode
-t use tempdir when creating initramfs image
EOF
@@ -161,7 +162,7 @@ EOF
# main
-while getopts "b:c:f:F:hi:kLlo:t:" opt; do
+while getopts "b:c:f:F:hi:kLlo:qt:" opt; do
case "$opt" in
b) basedir="$OPTARG";;
c) config="$OPTARG";;
@@ -173,6 +174,7 @@ while getopts "b:c:f:F:hi:kLlo:t:" opt; do
L) list_features=1;;
l) list_sources=1;;
o) outfile="$OPTARG";;
+ q) quiet=1;;
t) tmpdir="$OPTARG";;
*) usage;;
esac
@@ -218,8 +220,8 @@ if [ -z "$keeptmp" ]; then
[ -d "$tmpdir" ] && rm -rf "$tmpdir"/*
fi
-if [ -z "$list_sources" ]; then
- echo "==> initramfs: creating $outfile" >&2
+if [ -z "$list_sources" ] && [ -z "$quiet" ]; then
+ echo "==> initramfs: creating $outfile"
fi
initfs_base || exit 1
initfs_kmods || exit 1
--
1.6.4
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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mkinitfs
pkgver=2.0_rc1
pkgrel=0
pkgrel=1
pkgdesc="Tool to generate initramfs images for Alpine"
url=http://git.alpinelinux.org/cgit/mkinitfs
depends="busybox"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
0001-mkinitfs-support-for-q.-echo-to-stdout-rather-than-s.patch
0002-init-fixes-for-new-apk-behaviour.patch
"
license="GPL-2"
build() {
cd "$srcdir"/$pkgname-$pkgver
patch -p1 -i ../0001-mkinitfs-support-for-q.-echo-to-stdout-rather-than-s.patch || return 1
patch -p1 -i ../0002-init-fixes-for-new-apk-behaviour.patch || return 1
make
make install DESTDIR="$pkgdir" || return 1
}
md5sums="4c8ae5a6cdeae50ddb36a8e3d3268eb2 mkinitfs-2.0_rc1.tar.bz2"
md5sums="4c8ae5a6cdeae50ddb36a8e3d3268eb2 mkinitfs-2.0_rc1.tar.bz2
ccbd60017cd2498f7e14e4b661efffb7 0001-mkinitfs-support-for-q.-echo-to-stdout-rather-than-s.patch
eb588902edfef79a8912b5c81dfd6f1e 0002-init-fixes-for-new-apk-behaviour.patch"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment