# !/bin/sh
M_TITLE="Copy rootfs to SD/CF"
+# Unfinished script.
+exit 0
die() {
echo "ERROR: $1" >/dev/tty0
ask_format() {
if test "$ROOTFS_TARGET_FS" != ext2
then
- echo -e "\nYou are not using the ext2 filesystem on your target.\nYou now have two choices:"
+ echo -e "\nYou are not using the ext2 filesystem on your target ($ROOTFS_TARGET_FS)$.\nYou now have two choices:"
echo -e "\t[1] Reformat to ext2"
echo -e "\t[2] Use an image-file ontop of the existing filesystem"
direct_install() {
- format_target
+ #format_target
echo -n "Creating temporary directory..."
mkdir -p /media/temp && echo ok || die "mkdir -p /media/temp failed!"
then
echo -e "\nAltboot is a boot-manager which allows to boot from SD,\nCF and NFS"
echo -e "\nFor security reasons altboot requires a password\nto boot into init=/bin/sh."
- echo -e "${C_RED}This is *not* your root password!\nIt is used by altboot alone!${C_RESET}"
- echo -e "${C_BLUE}\nNote:\tThe password will be echoed to the screen\n\tand it will be asked twice for confirmation.${C_RESET}"
- echo -e "\nPlease enter a new master password:\n"
+ echo -e "${C_RED}This is *not* your root password!\nIt is used by altboot alone!${C_RESET}\n"
+ #echo -e "${C_BLUE}\nNote:\tThe password will be echoed to the screen\n\tand it will be asked twice for confirmation.${C_RESET}"
+ #echo -e "\nPlease enter a new master password:\n"
while true
do
- echo -en "New password: "
+ echo -en "\nNew password: "
+
+ stty -echo
read junk1 < /dev/tty0
+ stty echo
+
if ! test -z "$junk1"
then
- echo -n "Repeat: "
+ echo -en "\nRepeat: "
+
+ stty -echo
read junk2 < /dev/tty0
+ stty echo
+ echo ""
if test "$junk1" = "$junk2"
then
# New menu entries can be created be putting files into /etc/altboot-menu.
#
+
test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
CURRENT_ENV="`set`"
mount -t proc proc /proc >/dev/null 2>&1
key_ints="`cat /proc/interrupts | grep keyboard | awk '{print $2}'`"
+ stty -echo
echo -en "\n\nPlease press any key to launch altboot." > /dev/tty1
test -z "$TIMEOUT" && TIMEOUT="3"
if test "`cat /proc/interrupts | grep keyboard | awk '{print $2}'`" != "$key_ints"
then
launch_altboot=yes
+ stty echo
break
fi
echo -n "." >/dev/tty1
wait_for_input() {
while true
do
- echo -n "Please choose one of the above [$last_selection]: " </dev/tty0 > /dev/tty0 2>&1
- read junk < /dev/tty0 2>&1
-
+
+
+ # Do _not_ change the next few lines!
+ #
# This is required to work around an annoying busybox bug.
# Every key you press while this script runs will be
- # picked up by the next "read $junk". And there's no goddamn way
- # to prevent it. So the next read would pick up the "any" key the user pressed
+ # picked up by the next "read $junk".
+ # So the next read would pick up the "any" key the user pressed
# above to launch the altboot menu.
- junk="`echo "$junk" | sed -n "s/.*\([0-9]\)/\1/p"`"
+
+
+ # This filters an "<ENTER>" from the user as "any key"
+ ( while :; do read x< /dev/tty0 2>&1; done; ) > /dev/null 2>&1 &
+ sleep 1; kill $!
+
+
+
+ echo -n "Please choose one of the above [$last_selection]: " </dev/tty0 > /dev/tty0 2>&1
+ read junk< /dev/tty0 2>&1
+ # This filters other chars the user may have used
+ junk="`echo "$junk" | sed -n "s/.*\([0-9]\)/\1/p"`"
if test "$junk" -lt "$cnt" -o "$junk" -eq "$cnt"
then
# * * * * * * This is the main function * * * * * *
+# if /sbin/init is launched with a parameter, it is very likely that the user is trying to switch runlevels
+# manually by running "/sbin/init $RUN_LEVEL". If it is empty (or just contains "tty1") we assume that the kernel
+# launched init during bootup
if test -n "$*" -a "$*" != "tty1"
then
echo "altboot: Using real init [$REAL_INIT] [$*] *" >/dev/tty1
else
# Execute scripts in /etc/altboot.rc before doing anything else.
- # Required for special situations, like booting spitz
+ # Required in special situations, like booting spitz
RC_FILES=`ls /etc/altboot.rc | grep \.sh$`
for file in $RC_FILES