aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-07-15 13:13:50 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-07-15 13:15:46 +0000
commit91d7d6cdb16c647a41a186670665611b85b760f6 (patch)
treec569d39638558c75ad8bb611f9ec0380b29e2cc9 /main/alpine-conf
parent0fa8d03670123b208b9a7474dfed261152bc60fe (diff)
downloadaports-91d7d6cdb16c647a41a186670665611b85b760f6.tar.bz2
aports-91d7d6cdb16c647a41a186670665611b85b760f6.tar.xz
main/alpine-conf: fix setup-bootable kernel name change
Diffstat (limited to 'main/alpine-conf')
-rw-r--r--main/alpine-conf/0001-setup-bootable-warn-and-fix-kernel-name-change.patch169
-rw-r--r--main/alpine-conf/APKBUILD12
2 files changed, 177 insertions, 4 deletions
diff --git a/main/alpine-conf/0001-setup-bootable-warn-and-fix-kernel-name-change.patch b/main/alpine-conf/0001-setup-bootable-warn-and-fix-kernel-name-change.patch
new file mode 100644
index 0000000000..11f6bbe0eb
--- /dev/null
+++ b/main/alpine-conf/0001-setup-bootable-warn-and-fix-kernel-name-change.patch
@@ -0,0 +1,169 @@
+From 0cc00b53d8e918699413dbe1ddd1989bb4ddec4a Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 15 Jul 2015 15:10:42 +0200
+Subject: [PATCH] setup-bootable: warn and fix kernel name change
+
+---
+ setup-bootable.in | 103 +++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 94 insertions(+), 9 deletions(-)
+
+diff --git a/setup-bootable.in b/setup-bootable.in
+index 116f776..35a5f73 100644
+--- a/setup-bootable.in
++++ b/setup-bootable.in
+@@ -84,10 +84,87 @@ find_disk_dev() {
+ return 1
+ }
+
++find_syslinux_cfg() {
++ # find where new syslinux.cfg is
++ for i in boot/syslinux/syslinux.cfg syslinux.cfg; do
++ if [ -e "$1"/$i ]; then
++ syslinux_cfg=$i
++ vecho "Found $syslinux_cfg"
++ break
++ fi
++ done
++}
++
++fix_syslinux_kernel() {
++ echo "Fixing $syslinux_cfg: kernel $1 -> $2"
++ sed -i -e "/^\s*[Kk][Ee][Rr][Nn][Ee][Ll]\s/s|$1|$2|" \
++ "$destdir/$syslinux_cfg"
++}
++
++fix_syslinux_initrd() {
++ echo "Fixing $syslinux_cfg: initrd $1 -> $2"
++ sed -i -e "/^\s*[Ii][Nn][Ii][Tt][Rr][Dd]\s/s|$1|$2|" \
++ -e "/^\s*[Aa][Pp][Pp][Ee][Nn][Dd]\s/s|initrd=$1|initrd=$2|" \
++ "$destdir/$syslinux_cfg"
++}
++
++check_syslinux() {
++ if [ -z "$syslinux_cfg" ]; then
++ find_syslinux_cfg "$destdir"
++ fi
++ if [ -z "$syslinux_cfg" ]; then
++ die "Could not find any syslinux.cfg. Aborting"
++ fi
++
++ # kernels
++ for i in $(awk 'tolower($1) == "kernel" {print $2}' "$destdir"/$syslinux_cfg); do
++ k="${destdir%/}/${i#/}"
++ f=${k##*/}
++
++ if [ -e "$k" ] && [ "${f#vmlinuz}" != "$f" ]; then
++ continue
++ fi
++
++ if [ -e "${k%/*}"/vmlinuz-$f ] && [ -n "$fix_syslinux_cfg" ]; then
++ fix_syslinux_kernel "$i" "${i%/*}"/vmlinuz-$f
++ elif ! [ -e "$k" ]; then
++ echo "Warning: $syslinux_cfg: kernel $k was not found"
++ echo " Run $0 -c -f "$destdir" to fix"
++ fi
++ done
++
++ #initramfs
++ initrds=$(awk 'tolower($1) == "initrd" {print $2}' \
++ "$destdir"/$syslinux_cfg)
++ for i in $(awk 'tolower($1) == "append" {print $0}' \
++ "$destdir"/$syslinux_cfg); do
++ case $i in
++ initrd=*) initrds=${i#initrd=};;
++ esac
++ done
++
++ for i in $initrds; do
++ if [ -e "$destdir"/$i ]; then
++ continue
++ fi
++ fname=${i##*/}
++ flavor=${fname%.gz}
++
++ new=${i%/*}/initramfs-$flavor
++ if [ -e "$destdir"/$new ] && [ -n "$fix_syslinux_cfg" ]; then
++ fix_syslinux_initrd "$i" "$new"
++ else
++ echo "Warning: initrd $i was not found. System will likely not boot"
++ echo " Run $0 -f -c "$destdir" to fix"
++ fi
++ done
++}
++
+ usage() {
+ cat <<__EOF__
+ $prog $version
+ usage: $prog [-fhUusv] SOURCE [DEST]
++ $prog -c DIR
+
+ Copy the contents of SOURCE to DEST and make DEST bootable.
+
+@@ -97,19 +174,24 @@ or a device. If DEST is ommitted /media/usb will be used.
+ Options:
+ -f Force overwrite existing files. Will overwrite syslinux.cfg if upgrade.
+ -h Show this help.
++ -k fix kernel and initrd name in syslinux.cfg if needed.
+ -U Replace current alpine_dev in syslinux.cfg with UUID if UUID found.
+ -u Upgrade mode. Keep existing syslinux.cfg and don't run syslinux.
+ -s Force run syslinux, even if upgrade mode.
+ -v Verbose mode. Display whats going on.
+
++ -c Check syslinux.cfg in destination DIR. Use with -f to fix.
++
+ __EOF__
+ exit 1
+ }
+
+-while getopts "fhUusv" opt; do
++while getopts "c:fhkUusv" opt; do
+ case "$opt" in
+- f) force=1;;
++ c) check_syslinux="$OPTARG";;
++ f) force=1; fix_syslinux_cfg=1;;
+ h) usage;;
++ k) fix_syslinux_cfg=1;;
+ U) replace_alpine_dev=1;;
+ u) upgrade=1;;
+ s) syslinux=1;;
+@@ -122,6 +204,11 @@ shift $(($OPTIND - 1))
+ src=${1}
+ dest=${2:-/media/usb}
+
++if [ -n "$check_syslinux" ]; then
++ destdir="$check_syslinux"
++ check_syslinux
++ exit 0
++fi
+
+ [ -z "$src" ] && usage
+
+@@ -235,13 +322,8 @@ elif [ -n "$srcurl" ]; then
+ fi
+
+ # find where new syslinux.cfg is
+-for i in boot/syslinux/syslinux.cfg syslinux.cfg; do
+- if [ -e "$destdir"/.new/$i ]; then
+- syslinux_cfg=$i
+- vecho "Found $syslinux_cfg"
+- break
+- fi
+-done
++find_syslinux_cfg "$destdir"/.new
++
+ # abort early in case unexpected trouble
+ if [ -z "$syslinux_cfg" ]; then
+ die "Could not find any syslinux.cfg on new iso?"
+@@ -288,6 +370,9 @@ if [ -n "$replace_alpine_dev" -o -z "$upgrade" ] && [ -n "$UUID" ]; then
+ "$destdir"/$syslinux_cfg
+ fi
+
++# verify syslinux.cfg
++check_syslinux
++
+ # cleanup
+ [ -z "$keep_old" ] && rm -rf "$destdir"/.old "$destdir"/.new
+
+--
+2.4.5
+
diff --git a/main/alpine-conf/APKBUILD b/main/alpine-conf/APKBUILD
index 9269dba537..4eccf55172 100644
--- a/main/alpine-conf/APKBUILD
+++ b/main/alpine-conf/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alpine-conf
pkgver=3.2.1
-pkgrel=4
+pkgrel=5
pkgdesc="Alpine configuration management scripts"
url=http://git.alpinelinux.org/cgit/$pkgname
arch="all"
@@ -11,6 +11,7 @@ source="http://dev.alpinelinux.org/archive/alpine-conf/alpine-conf-$pkgver.tar.x
0001-setup-apkrepos-fix-speed-test-of-mirrors.patch
0001-setup-disk-add-raid-to-initfs-if-root-is-on-lvm.patch
0001-setup-disk-fix-btrfs-root.patch
+ 0001-setup-bootable-warn-and-fix-kernel-name-change.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
@@ -40,12 +41,15 @@ package() {
md5sums="d8863487539eb41de219303addf71aa1 alpine-conf-3.2.1.tar.xz
f1439adcfc377c56b987b379b725f0af 0001-setup-apkrepos-fix-speed-test-of-mirrors.patch
f2da5b6cf6e4f1c1d24b59210b172bd8 0001-setup-disk-add-raid-to-initfs-if-root-is-on-lvm.patch
-bb1acd69593e19a9ab686cf6b790bbdb 0001-setup-disk-fix-btrfs-root.patch"
+bb1acd69593e19a9ab686cf6b790bbdb 0001-setup-disk-fix-btrfs-root.patch
+f73ccf7115d83a7230fd124c507e3c5c 0001-setup-bootable-warn-and-fix-kernel-name-change.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
-1ec287f5ec4ca94af1b02067eb3a785e527a7658ed737b28e5f39c437db66625 0001-setup-disk-fix-btrfs-root.patch"
+1ec287f5ec4ca94af1b02067eb3a785e527a7658ed737b28e5f39c437db66625 0001-setup-disk-fix-btrfs-root.patch
+8fdde27235e14dc1f0f8ed7edb1f086b792f6be060e329e8c2c59d9064b1ee3f 0001-setup-bootable-warn-and-fix-kernel-name-change.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
-0d7e6ce26798ab42bf1e2cbda6421e811e949d427e1ff69210abd950686f5ff0a5d61404db9de160268ae976e768aba74f51814b8a9b6e318c32563f924a3965 0001-setup-disk-fix-btrfs-root.patch"
+0d7e6ce26798ab42bf1e2cbda6421e811e949d427e1ff69210abd950686f5ff0a5d61404db9de160268ae976e768aba74f51814b8a9b6e318c32563f924a3965 0001-setup-disk-fix-btrfs-root.patch
+df9c2cec67054390d8e8c81b797cfbf0f1b142faabe389f2adf99094b15642285ad683a875728cfff0f13ebb91b3d16eb1ded2ee889b0f9d29a6d05a2a584b83 0001-setup-bootable-warn-and-fix-kernel-name-change.patch"