Files
infix/board/common/rootfs/libexec/finit/hook/mount/all/boot-mode.sh
T
Joachim Wiberg 25db613398 Refactor boot mode handling
With the recent `if:<cond>` addition to Finit we can simplify a lot of
the logic for disabling and enabling features in Infix.  Standardizing
on conditions that Finit provides.

We create boot/netconf, boot/etc, and boot/profinet conditions early,
after all filesystems have been mounted (and cleaned), so they are all
set before Finit loads its configuration files in runlevel S.

The default is still to boot into a managed NETCONF mode, since the end
goal remains to integrate PROFINET as yet another service.  The other
mode, native /etc, should then be the only exception.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2023-03-08 20:02:03 +01:00

27 lines
593 B
Bash
Executable File

#!/bin/sh
# Override boot mode based on user input from setup tool
set_cond()
{
mkdir -p /run/finit/cond/boot
ln -s /run/finit/cond/reconf "/run/finit/cond/boot/$1"
}
# Report to the setup and show tools the current boot mode
if /lib/infix/use-etc; then
if [ -f /mnt/cfg/infix/.use_etc ]; then
cat /mnt/cfg/infix/.use_etc > /tmp/.boot_mode
if grep -qi profinet /mnt/cfg/infix/.use_etc; then
set_cond profinet
else
set_cond etc
fi
else
echo "native /etc" > /tmp/.boot_mode
set_cond etc
fi
else
echo "NETCONF" > /tmp/.boot_mode
set_cond netconf
fi