pmaports/main/postmarketos-mkinitfs/init.sh.in
drebrez 4a3a02c60a Automatically compute the minimum size for the partition and resize it during the boot process (#127)
* Automatically compute the minimum size for the partitions
* Automatically resize the pmOS_root partition during the boot process
* Resize root partition only if there is unallocated space at the end of the device.
* Added more echos to make debugging easier while looking at the pmOS_init.log.
* Updated static_code_analysis.sh script to run shellcheck with `-x` option.
2017-08-03 16:01:00 +00:00

51 lines
1.2 KiB
Bash

#!/bin/sh
. ./init_functions.sh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
/bin/busybox --install -s
/bin/busybox-extras --install -s
# Mount everything, set up logging, modules, mdev
mount_proc_sys_dev
setup_log
[ -d /lib/modules ] && modprobe -a @MODULES@
setup_mdev
mount_subpartitions
# Hooks
for hook in /etc/postmarketos-mkinitfs/hooks/*.sh; do
[ -e "$hook" ] || continue
sh "$hook"
done
show_splash /splash-loading.ppm.gz
# Always run dhcp daemon/usb networking for now (later this should only
# be enabled, when having the usb-shell hook installed for debugging,
# or get activated after the initramfs is done with an OpenRC service).
setup_usb_network
start_udhcpd
mount_boot_partition
extract_initramfs_extra @INITRAMFS_EXTRA@
wait_root_partition
resize_root_partition
unlock_root_partition
resize_root_filesystem
mount_root_partition
# Switch root
killall telnetd mdev 2>/dev/null
umount /boot
umount /proc
umount /sys
umount /dev/pts
umount /dev
# shellcheck disable=SC2093
exec switch_root /sysroot /sbin/init
echo "ERROR: switch_root failed!"
echo "Looping forever. Install and use the usb-shell hook to debug this."
echo "For more information, see <https://postmarketos.org/usbhook>"
loop_forever