#!/bin/sh # T2 SDE: target/share/install/rootfs/sbin/init # Partially based on linuxrc.c, Copyright (C) 2003, 2004 Clifford Wolf and Rene Rebe # Converted from C to shell, heavily cleaned and improved for the T2 SDE by: # (C)2005-2024 Rene Rebe, ExactCODE GmbH; Germany. export PATH="/sbin:/bin:/usr/sbin:/usr/bin" export HOME="/root" cd /dev; rm -f fd ln -sf /proc/kcore core ln -sf /proc/self/fd fd ln -sf fd/0 stdin ln -sf fd/1 stdout ln -sf fd/2 stderr cd / mkdir -p /mnt echo " T2 SDE installer second stage. The second stage is a small Linux distribution, loaded into your system's memory. It has everything needed to install T2 Linux, restore a previous installation, or perform maintenance, rescue and backup tasks." for x in /etc/setup-*.sh /setup/setup.sh; do if [ -f "$x" ]; then echo; echo "Running $x ..."; sh $x echo "Setup script $x finished." fi done ttydevs="console= $(< /proc/cmdline)" ttydevs=${ttydevs##*console=} ttydevs=${ttydevs%%[ ,]*} if [ ! "$ttydevs" ]; then ttydevs="`grep -a -H Y /sys/class/tty/*/console`" ttydevs="${ttydevs%%/console*}" ttydevs=${ttydevs##*/} fi ttydevs="${ttydevs:-tty1 tty2 tty3 tty4 tty5 tty6}" while true; do echo -n " If you use a serial terminal, enter the names of terminal devices to use, for example 'ttyS0' or 'ttyUSB0' for the first serial port or just 'console', just hit enter otherwise. (default: $ttydevs): " read _ttydevs if [ "$_ttydevs" ]; then # check for x in $_ttydevs; do [ ! -c /dev/$x ] && echo "$x is not a char-device." && continue 2 done ttydevs="$_ttydevs" fi break done echo " If you don't know what to do, it's a good time to read the T2 documentation. To start a normal installation, simply run: 'install'" if type -p dialog > /dev/null; then echo "(or 'install -text' if you prefer non-dialog based menus)" fi echo " https://t2sde.org/support" for x in $ttydevs; do [[ "$x" != /dev/tty[0-9]* ]] && TERM=linux ( ( while : ; do agetty -i -J -n -N -l /sbin/login-shell $x $TERM; done ) & ) done exec < /dev/null > /dev/null 2>&1 while : ; do sleep 1; done