From 7df2c93459424af257d673f055e5d86c6e6db46c Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Thu, 21 Feb 2019 15:42:02 -0800 Subject: [PATCH] main/postmarketos-mkinitfs: support verbose boot (!234) Adds a new initfs hook, verbose-initfs, which doesn't do anything on its own. Modify postmarketos-mkinitfs to check if this hook is installed and if so run `set -x`. It's done this way so verbose boot is enabled as early as possible, before hooks are loaded. Tested on the qemu-aarch64 device. - pmboostrap initfs hook_add verbose-initfs - pmbootstrap qemu --arch aarch64 - confirmed that commands are echoed to the console --- .../10-verbose-initfs.sh | 5 +++++ .../APKBUILD | 17 +++++++++++++++++ main/postmarketos-mkinitfs/APKBUILD | 4 ++-- main/postmarketos-mkinitfs/init.sh.in | 3 +++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh create mode 100644 main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD diff --git a/main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh b/main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh new file mode 100644 index 000000000..5f3d3ad4d --- /dev/null +++ b/main/postmarketos-mkinitfs-hook-verbose-initfs/10-verbose-initfs.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# The verbose feature is actually implemented in postmarketos-mkinitfs itself +# since it needs to be enabled before hooks are run. /init checks if this file +# exists and runs "set -x" if so. +echo "verbose-initfs is enabled. All initramfs shell commands are printed to the console." diff --git a/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD b/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD new file mode 100644 index 000000000..d3ce91127 --- /dev/null +++ b/main/postmarketos-mkinitfs-hook-verbose-initfs/APKBUILD @@ -0,0 +1,17 @@ +pkgname="postmarketos-mkinitfs-hook-verbose-initfs" +pkgver=0.1.0 +pkgrel=0 +pkgdesc="Print all shell commands executed by initramfs to the console" +url="https://postmarketos.org" +depends="postmarketos-mkinitfs" +source="10-verbose-initfs.sh" +arch="noarch" +license="GPL2" + +package() { + mkdir -p "$pkgdir"/etc/postmarketos-mkinitfs/hooks/ + install -Dm644 "$srcdir"/10-verbose-initfs.sh \ + "$pkgdir"/etc/postmarketos-mkinitfs/hooks/ +} + +sha512sums="97d92de64dc870e293a47bb2959877b63f20692030277083e56e499022fc643c1f199a65bd11f8dce9634ac3b80a43dd6934e29de4cf0b53fb2e663f46675a0f 10-verbose-initfs.sh" diff --git a/main/postmarketos-mkinitfs/APKBUILD b/main/postmarketos-mkinitfs/APKBUILD index 8531c10c2..3877e9f6a 100644 --- a/main/postmarketos-mkinitfs/APKBUILD +++ b/main/postmarketos-mkinitfs/APKBUILD @@ -1,5 +1,5 @@ pkgname=postmarketos-mkinitfs -pkgver=0.7.5 +pkgver=0.7.6 pkgrel=0 pkgdesc="Tool to generate initramfs images for postmarketOS" url="https://postmarketos.org" @@ -24,6 +24,6 @@ package() { mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/" } -sha512sums="c8ed2697ba0368b907eaefe7544bff8539adc7e8247af6bd425c722e3cedeb34e303f6bd9e00f283921352bc43dff3db83f3b3c1f427ef597ac15323f1e9c3eb init.sh.in +sha512sums="2479b08e48450f7d46c83b1117d0d81edf26dad8f2107e2ae1b10689f1b063c38181be735957ec1a16392302815355ca879ab71fc28d084e075f490cb2ac42b5 init.sh.in e4972ba261a72daba0d1f2fad425a3df082e18263a716746005f31a5cae313d66c168e09cd1bd0af3cee6a97bdb4b329ee3a8d03381a5b104fb39476bdcc7938 init_functions.sh 5ad842720e7f322bab43aa585103f5bd7e4b11e2e8cce553d406123e4379c160a1b8d7ed1b6aae75b040b2df309c105c412826a8467d552576d6d9ac1f6792ab mkinitfs.sh" diff --git a/main/postmarketos-mkinitfs/init.sh.in b/main/postmarketos-mkinitfs/init.sh.in index 99c4fb5bd..a8982dbac 100644 --- a/main/postmarketos-mkinitfs/init.sh.in +++ b/main/postmarketos-mkinitfs/init.sh.in @@ -1,5 +1,8 @@ #!/bin/sh # shellcheck disable=SC1091 + +[ -e /etc/postmarketos-mkinitfs/hooks/10-verbose-initfs.sh ] && set -x + . /etc/deviceinfo . ./init_functions.sh