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
This commit is contained in:
Zhuowei Zhang 2019-02-21 15:42:02 -08:00 committed by Oliver Smith
parent 624c046cd4
commit 7df2c93459
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 27 additions and 2 deletions

View file

@ -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."

View file

@ -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"

View file

@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs pkgname=postmarketos-mkinitfs
pkgver=0.7.5 pkgver=0.7.6
pkgrel=0 pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS" pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org" url="https://postmarketos.org"
@ -24,6 +24,6 @@ package() {
mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/" mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/"
} }
sha512sums="c8ed2697ba0368b907eaefe7544bff8539adc7e8247af6bd425c722e3cedeb34e303f6bd9e00f283921352bc43dff3db83f3b3c1f427ef597ac15323f1e9c3eb init.sh.in sha512sums="2479b08e48450f7d46c83b1117d0d81edf26dad8f2107e2ae1b10689f1b063c38181be735957ec1a16392302815355ca879ab71fc28d084e075f490cb2ac42b5 init.sh.in
e4972ba261a72daba0d1f2fad425a3df082e18263a716746005f31a5cae313d66c168e09cd1bd0af3cee6a97bdb4b329ee3a8d03381a5b104fb39476bdcc7938 init_functions.sh e4972ba261a72daba0d1f2fad425a3df082e18263a716746005f31a5cae313d66c168e09cd1bd0af3cee6a97bdb4b329ee3a8d03381a5b104fb39476bdcc7938 init_functions.sh
5ad842720e7f322bab43aa585103f5bd7e4b11e2e8cce553d406123e4379c160a1b8d7ed1b6aae75b040b2df309c105c412826a8467d552576d6d9ac1f6792ab mkinitfs.sh" 5ad842720e7f322bab43aa585103f5bd7e4b11e2e8cce553d406123e4379c160a1b8d7ed1b6aae75b040b2df309c105c412826a8467d552576d6d9ac1f6792ab mkinitfs.sh"

View file

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# shellcheck disable=SC1091 # shellcheck disable=SC1091
[ -e /etc/postmarketos-mkinitfs/hooks/10-verbose-initfs.sh ] && set -x
. /etc/deviceinfo . /etc/deviceinfo
. ./init_functions.sh . ./init_functions.sh