Commit 34656652 authored by Natanael Copa's avatar Natanael Copa

main/mkinitfs: fix -b option

parent 3bb9b2ed
From d64e5baefc7e1ca75e6f1ca50f28e96b30991c6a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 3 Sep 2009 09:06:54 +0000
Subject: [PATCH] mkinitfs: fix -b option
---
mkinitfs.in | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mkinitfs.in b/mkinitfs.in
index e18b59c..0332151 100755
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -16,7 +16,7 @@ _cp() {
local i
if [ -n "$list_sources" ]; then
for i in "$@"; do
- echo $i
+ echo "$basedir"/$i
done
return
fi
@@ -24,7 +24,7 @@ _cp() {
for i in "$@"; do
local dest="$tmpdir"/${i%/*}
mkdir -p "$dest"
- cp -flLpR "$i" "$dest" 2>/dev/null || cp -pR "$i" "$dest"
+ cp -flLpR "$basedir"/"$i" "$dest" 2>/dev/null || cp -pR "$i" "$dest"
done
}
@@ -121,7 +121,7 @@ initfs_kmods() {
[ -z "$list_sources" ] && rm -rf "$tmpdir"/lib/modules
files=$(find_kmods)
for file in $files; do
- _cp "$basedir"/$file
+ _cp $file
done
[ -z "$list_sources" ] && depmod $kernel -b "$tmpdir"
}
--
1.6.4.2
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_rc3
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
0001-mkinitfs-fix-b-option.patch
"
license="GPL-2"
build() {
cd "$srcdir"/$pkgname-$pkgver
patch -p1 -i ../0001-mkinitfs-fix-b-option.patch || return 1
make
make || return 1
make install DESTDIR="$pkgdir" || return 1
}
md5sums="7f0e2ec039d10a01f46a7a049d6cbea0 mkinitfs-2.0_rc3.tar.bz2"
md5sums="7f0e2ec039d10a01f46a7a049d6cbea0 mkinitfs-2.0_rc3.tar.bz2
49292145e7f94c047e705e329d2c3708 0001-mkinitfs-fix-b-option.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