Subject: [alpine-aports] [PATCH] main/alpine-conf: fix fs-related packages loading, load lvm2 only if _lvm install, remove bashisms, remove installing sfdisk to destination system

From: Valery Kartel <[email-masked]>
Date: Tue, 15 Dec 2015 15:06:54 +0200

---
 .../0003-setup-disk-fix-package-loading.patch      | 51 ++++++++++++++++++++++
 main/alpine-conf/APKBUILD                          | 12 +++--
 2 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100644 main/alpine-conf/0003-setup-disk-fix-package-loading.patch

diff --git a/main/alpine-conf/0003-setup-disk-fix-package-loading.patch b/main/alpine-conf/0003-setup-disk-fix-package-loading.patch
new file mode 100644
index 0000000..f79f9cc
--- /dev/null
+++ b/main/alpine-conf/0003-setup-disk-fix-package-loading.patch
@@ -0,0 +1,51 @@
+--- old/setup-disk.in
++++ new/setup-disk.in
+@@ -323,7 +323,7 @@
+ 	cp /etc/apk/keys/* "$mnt"/etc/apk/keys/
+ 
+ 	local apkflags="--initdb --quiet --progress --update-cache --clean-protected"
+-	local pkgs=$(cat "$mnt"/etc/apk/world "$mnt"/var/lib/apk/world 2>/dev/null)
++	local pkgs=$(grep -v sfdisk "$mnt"/etc/apk/world "$mnt"/var/lib/apk/world 2>/dev/null)
+ 	pkgs="$pkgs acct linux-$KERNEL_FLAVOR alpine-base"
+ 	if [ "$(rc --sys)" = "XEN0" ]; then
+ 		pkgs="$pkgs xen-hypervisor"
+@@ -436,17 +436,19 @@
+ 
+ # install needed programs
+ init_progs() {
+-	local raidpkg= fs= fstools="e2fsprogs"
++	local lvmpkg= raidpkg= fs= fstools=
+ 	[ -n "$USE_RAID" ] && raidpkg="mdadm"
++	[ -n "$USE_LVM" ] && lvmpkg="lvm2"
+ 	for fs in $BOOTFS $ROOTFS $VARFS; do
+ 		case $fs in
++		ext[234]) fstools="$fstools e2fsprogs"; modprobe ext4;;
+ 		xfs) fstools="$fstools xfsprogs"; modprobe xfs;;
+ 		# we need load btrfs module early to avoid the error message:
+ 		# 'failed to open /dev/btrfs-control'
+ 		btrfs) fstools="$fstools btrfs-progs"; modprobe btrfs;;
+ 		esac
+ 	done
+-	apk add --quiet sfdisk lvm2 $raidpkg syslinux $fstools $@
++	apk add --quiet sfdisk $lvmpkg $raidpkg syslinux $fstools $@
+ }
+ 
+ show_disk_info() {
+@@ -541,7 +543,7 @@
+ 			--metadata=0.90 --quiet --run $@ $missing || return 1
+ 		bootdev=/dev/md0
+ 	fi
+-	[ "$BOOTFS" == "btrfs" ] && mkfs_args=""
++	[ "$BOOTFS" = "btrfs" ] && mkfs_args=""
+ 	mkfs.$BOOTFS $mkfs_args $bootdev
+ 	BOOT_DEV="$bootdev"
+ }
+@@ -733,7 +735,7 @@
+ # setup
+ setup_root() {
+ 	local root_dev="$1" boot_dev="$2" mkfs_args="-q"
+-	[ "$ROOTFS" == "btrfs" ] && mkfs_args=""
++	[ "$ROOTFS" = "btrfs" ] && mkfs_args=""
+ 	mkfs.$ROOTFS $mkfs_args "$root_dev"
+ 	mkdir -p "$SYSROOT"
+ 	mount -t $ROOTFS $root_dev "$SYSROOT" || return 1
diff --git a/main/alpine-conf/APKBUILD b/main/alpine-conf/APKBUILD
index 6984911..1cb79a8 100644
--- a/main/alpine-conf/APKBUILD
+++ b/main/alpine-conf/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=alpine-conf
 pkgver=3.2.1
-pkgrel=8
+pkgrel=9
 pkgdesc="Alpine configuration management scripts"
 url=http://git.alpinelinux.org/cgit/$pkgname
 arch="all"
@@ -16,6 +16,7 @@ source="http://dev.alpinelinux.org/archive/alpine-conf/alpine-conf-$pkgver.tar.x
 	0001-setup-disk-fix-detection-of-volume-group.patch
 	0002-makefile_fix_lbu_conf_perms.patch
 	0002-setup-disk-fix-fs.patch
+	0003-setup-disk-fix-package-loading.patch
 	"
 
 _builddir="$srcdir"/$pkgname-$pkgver
@@ -50,7 +51,8 @@ f73ccf7115d83a7230fd124c507e3c5c  0001-setup-bootable-warn-and-fix-kernel-name-c
 8a67f0ac0826102dc9dceab34c6e036e  0001-setup-timezone-fix-use-of-z-option.patch
 6d8735a89245a5828760b0db80c19edd  0001-setup-disk-fix-detection-of-volume-group.patch
 afb885ce5e0851a052a5678fa7072039  0002-makefile_fix_lbu_conf_perms.patch
-4588eb258315445c6a537e5856f5eff8  0002-setup-disk-fix-fs.patch"
+4588eb258315445c6a537e5856f5eff8  0002-setup-disk-fix-fs.patch
+f9d4ec46db77cad21e3cb3fcbfb099f7  0003-setup-disk-fix-package-loading.patch"
 sha256sums="f0e7954bb1a5144f551694acfde818bbad4e42a575e7a8e3a06a777ade7a5d9d  alpine-conf-3.2.1.tar.xz
 e30d5fc4c1ae6af9673c543427561d027792c1bb26e3901ce954d15689dc66e9  0001-setup-apkrepos-fix-speed-test-of-mirrors.patch
 6e532930bc263d004975fe1feac115f17452e9f80b5efb22f538e7ebcbb6636d  0001-setup-disk-add-raid-to-initfs-if-root-is-on-lvm.patch
@@ -59,7 +61,8 @@ e30d5fc4c1ae6af9673c543427561d027792c1bb26e3901ce954d15689dc66e9  0001-setup-apk
 c917e5e1e4f7cf7cb5a0cd9922d7e92654d761fb301977c02866a03f374fd184  0001-setup-timezone-fix-use-of-z-option.patch
 cafb433dc1bef88a645b4c4504b207fb09392d112294219d706ac04984725c8c  0001-setup-disk-fix-detection-of-volume-group.patch
 ebcddce2df3bbaf8f807eb9d4a46811c01c4f254e8577fd3b34fc22575e3439f  0002-makefile_fix_lbu_conf_perms.patch
-59e88d552282291c9326f3d0b42761837464e5a6c5d288fb8eea76612df6a1a0  0002-setup-disk-fix-fs.patch"
+59e88d552282291c9326f3d0b42761837464e5a6c5d288fb8eea76612df6a1a0  0002-setup-disk-fix-fs.patch
+c46cfde4e462a4e756679158136de0cee25cc435ca8a8763a0d17a348e5717c9  0003-setup-disk-fix-package-loading.patch"
 sha512sums="20c11b134234708d86fe4cc093c4073df3496a43d13994d0df369066afed39a9a3c97cebacdbb6518f212e414c9456c31ee41bd600b3fc29e892448118a7b5e8  alpine-conf-3.2.1.tar.xz
 135bd0a0638f14a90d896c31de09eb3aa08cd7b2b1452fa20fdf12d128282c5c9eee5c1d76f7d8b62714f15395f225bf61c9968ad04ff164e64e8924c89abbd6  0001-setup-apkrepos-fix-speed-test-of-mirrors.patch
 cd2c1f3adef443edf4473719f1cf4f277336fb59527ba70ed30f1f2c87d3cc63afe55a009b5bb5666ff79784ea8a79730dfb67a37d8e3fd8fe8fd7eb88a564fc  0001-setup-disk-add-raid-to-initfs-if-root-is-on-lvm.patch
@@ -68,4 +71,5 @@ df9c2cec67054390d8e8c81b797cfbf0f1b142faabe389f2adf99094b15642285ad683a875728cff
 13062f853d30126d77c5201516d978bf30e154a8efd66b0869c7732550694a49e7ad45d29014242cb51a3917c8e7da6af99e51319792a2e89cb8ff9dd69ea08e  0001-setup-timezone-fix-use-of-z-option.patch
 0aee56acd398d22af0dbee887a15c7bf1529c7c6b23618643078be1bd9db300f1fb1f4a2549cf09f21c29aa19d6510221399442582b8a6525f24a3c2f10c174e  0001-setup-disk-fix-detection-of-volume-group.patch
 f24d781f75f1e6fcb7ce5d2351a6fb158eaee11b06fc1d1e73ccb01a22c889b07a0703453259a8e69c8281230527f33b60a3eb217cafff4b15261fb1b4f91044  0002-makefile_fix_lbu_conf_perms.patch
-12f95213dd6ce50089e8428b4cdf72f2e4de1137bd5f85d34a7a52fa0116fb3dfb0abb8989d66db32600cf387fffe7ffb96f6f94dc87b8ae12159ecaa883ae6e  0002-setup-disk-fix-fs.patch"
+12f95213dd6ce50089e8428b4cdf72f2e4de1137bd5f85d34a7a52fa0116fb3dfb0abb8989d66db32600cf387fffe7ffb96f6f94dc87b8ae12159ecaa883ae6e  0002-setup-disk-fix-fs.patch
+1a6e244e21bfd25809873dd85e0aeda0674f085b9239e8fae263b5c28e523c900a6af53874540863f19b0368cd0c292736bdb4b60d863558efcab330b69586d2  0003-setup-disk-fix-package-loading.patch"
-- 
2.6.4

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---