pmaports/postmarketos-mkinitfs/init_functions.sh
Oliver Smith 1c0ff6aa23 Put postmarketOS aports inside pmbootstrap repo
Later, the aports folder will probably get split up in its own repository.
But right now this is simply convenient.
2017-05-26 22:26:25 +02:00

49 lines
901 B
Bash

#!/bin/sh
# This file will be in /init_functions.sh inside the initramfs.
mount_subpartitions()
{
for i in /dev/mmcblk*; do
case "$(kpartx -l "$i" 2> /dev/null | wc -l)" in
2)
echo "mount subpartitions of $i"
kpartx -afs "$i"
break
;;
*)
continue
;;
esac
done
}
find_root_partition()
{
for i in /dev/mapper/* /dev/mmcblk*; do
cryptsetup isLuks "$i" || continue
echo "$i"
break
done
}
unlock_root_partition()
{
while ! [ -e /dev/mapper/root ]; do
partition="$(find_root_partition)"
if [ -z "$partition" ]; then
echo "Could not find cryptsetup partition."
echo "Maybe you need to insert the sdcard, if your device has"
echo "any? Trying again in one second..."
sleep 1
else
cryptsetup luksOpen "$partition" root
fi
done
}
# $1: path to ppm.gz file
show_splash()
{
gzip -c -d "$1" > /tmp/splash.ppm
fbsplash -s /tmp/splash.ppm
}