Add additional files into initramfs when debug-shell is installed (#1358)

This commit is contained in:
Daniele Debernardi 2018-03-26 20:12:58 +02:00 committed by Oliver Smith
parent 7fec589ed4
commit a7afd519ef
5 changed files with 37 additions and 15 deletions

View File

@ -0,0 +1,3 @@
/usr/bin/evtest
/usr/bin/fftest
/usr/sbin/fbdebug

View File

@ -1,16 +1,21 @@
pkgname=postmarketos-mkinitfs-hook-debug-shell
pkgver=0.1.1
pkgrel=1
pkgrel=2
pkgdesc="Root shell in the initramfs (security hole, for debugging only)"
url="https://github.com/postmarketOS"
depends="postmarketos-mkinitfs fbdebug"
source="20-debug-shell.sh"
depends="postmarketos-mkinitfs fbdebug evtest linuxconsoletools"
source="20-debug-shell.sh 20-debug-shell.files"
arch="noarch"
license="GPL2"
options="!check"
package() {
mkdir -p "$pkgdir"/etc/postmarketos-mkinitfs/hooks/
install -Dm644 "$srcdir"/20-debug-shell.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/20-debug-shell.sh
install -Dm644 "$srcdir"/20-debug-shell.files \
"$pkgdir"/etc/postmarketos-mkinitfs/files/20-debug-shell.files
}
sha512sums="30df4a3e2f8a82c8c83e80e645fb10516bfae51bc014c28b7d73d48bd0b2f238c186909a0727e5636cf7087aa1e4a348c83a6cf26e99552cea80922d4086627f 20-debug-shell.sh"
sha512sums="30df4a3e2f8a82c8c83e80e645fb10516bfae51bc014c28b7d73d48bd0b2f238c186909a0727e5636cf7087aa1e4a348c83a6cf26e99552cea80922d4086627f 20-debug-shell.sh
2761269b5809ed7a1692a26d3e28deea20392d6f5e00fcc209aec8835849b96f791270eb7ad00794cf492d8dda28b940f6d6557b0b764ca46314883a0692d174 20-debug-shell.files"

View File

@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs
pkgver=0.6.1
pkgver=0.6.2
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://github.com/postmarketOS"
@ -25,4 +25,4 @@ package() {
}
sha512sums="a09a48026a5cac308fa54e37c72e89fd7901e749f73720f3e8d3ec11a4d1527dbc1e5011aff53b1beffb6ff444c8df11a56e43d27ac0180ce8ddc79332be1d0d init.sh.in
f45548b295393cb078e4c456acef0eaac11705c4b5bc33981c320580c843231589fdfc78b25e182cd202435381d1be37085df01b6e272eee0af2ca0f89b3b4f5 init_functions.sh
5075df824ae86cc73590513a2212411a5aa2a840268c3850ea22e541717ce254e15b812f98c22e708fb0a21d87b8c6eb0059cf667ca3350412e39dad2d81879e mkinitfs.sh"
833f8a6c3753da7581fefb56a6a68f61663f2910d6b89b7a9cc3033ac922589b1d07ba246cbcd8e0a99fc8df128f9ae1b1bf2bd8cf3cad65a323cf712c03ae2d mkinitfs.sh"

View File

@ -1,5 +0,0 @@
- support for adding files/modules in hooks (one file per hook):
- add build() function
- should have add_module and add_file functions
- add run() function

View File

@ -25,6 +25,21 @@ parse_commandline()
modules_path="/lib/modules/${kernel}"
}
# Verify that each file required by the installed hooks exists and exit with an
# error if they don't.
check_hook_files()
{
for file in "/etc/postmarketos-mkinitfs/files"/*.files; do
[ -f "$file" ] || continue
while IFS= read -r line; do
if ! [ -f "$line" ]; then
echo "ERROR: File ${line} specified in ${file} does not exist!"
exit 1
fi
done < "$file"
done
}
create_folders()
{
for dir in /bin /sbin /usr/bin /usr/sbin /proc /sys /dev /tmp /lib \
@ -111,9 +126,12 @@ get_binaries()
if [ "${deviceinfo_msm_refresher}" == "true" ]; then
BINARIES="${BINARIES} /usr/sbin/msm-fb-refresher"
fi
if [ -f /usr/sbin/fbdebug ]; then
BINARIES="${BINARIES} /usr/sbin/fbdebug"
fi
for file in "/etc/postmarketos-mkinitfs/files"/*.files; do
[ -f "$file" ] || continue
while IFS= read -r line; do
BINARIES="${BINARIES} ${line}"
done < "$file"
done
lddtree -l $BINARIES | sort -u
}
@ -382,6 +400,7 @@ generate_initramfs_extra()
# initialize
source_deviceinfo
parse_commandline "$1" "$2" "$3"
check_hook_files
echo "==> initramfs: creating $outfile"
tmpdir=$(mktemp -d /tmp/mkinitfs.XXXXXX)