#!/bin/sh -e

WITH_ACTION=1
. install2-init-functions

# Run initinstall scripts
for f in "$initinstall_dir"/[0-2][0-9]-*; do
	[ -f "$f" -a -x "$f" ] || continue

	action "Running initinstall script [${f##*/}]" "$f" ||:
	update_splash "$f"
done

for f in "$initinstall_dir"/[3-9][0-9]-*; do
	[ -f "$f" -a -x "$f" ] || continue

	action "Running initinstall script [${f##*/}]" "$f" ||:
	update_splash "$f"
done

stop_splash

# Open additional VTs with running shell for debug purposes
if [ -z "${DISPLAY:-}" ] && [ -z "${WAYLAND_DISPLAY:-}" ]; then
	action "Open debug shell on tty2" openvt -f -c 2 -l -- env HOME=/root bash -l || :
	action "Open debug shell on tty3" openvt -f -c 3 -l -- env HOME=/root bash -l || :
fi
