Changeset 2888 in MondoRescue for branches/2.2.9/mindi/rootfs/sbin/init


Ignore:
Timestamp:
Oct 11, 2011, 6:56:35 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Try to Fix #499 by changing init in order to never exit, and rebooting using sysrq in /proc (not portable). Maybe should move to using a real init, and a separated rcS script.
  • Fixes the shell msg error by using setsid as per Busybox FAQ
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/rootfs/sbin/init

    r2885 r2888  
    99CaughtSoftReset() {
    1010    trap SIGTERM
    11     reboot -f
     11    # Now kill all processes
     12    kill -TERM -1
     13    sync
     14    sleep 1
     15    kill -KILL -1
     16    sync
     17    # Try to umount what we can again
     18    umount -a -d -r 2> /dev/null
     19    # now reboot hard
     20    # This doesn't work nor does reboot
     21    # ctrlaltdel hard &
     22    # reboot -f
     23    echo s > /proc/sysrq-trigger
     24    echo u > /proc/sysrq-trigger
     25    echo b > /proc/sysrq-trigger
     26    # That script should never end
     27    while [ "1" == "1" ]; do
     28        sleep 10
     29    done
    1230}
    1331
     
    4765
    4866
     67GetShell() {
     68    echo -en "Type 'exit' to reboot the PC\n"
     69    umount -d /mnt/cdrom 2> /dev/null
     70    mount / -o rw,remount > /dev/null 2> /dev/null
     71    LogIt "Launching Shell"
     72    setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
     73}
     74
    4975
    5076Die() {
    5177    LogIt "Fatal error! $1" 1
    52     exit 1
    53 }
    54 
     78    GetShell
     79}
    5580
    5681
     
    698723ExtractDataDisksAndLoadModules() {
    699724    LogIt "Installing additional tools ..." 1
     725    # BCO: test return value
    700726    install-additional-tools
    701727    # Keep the kernel silent again
     
    717743MINDI_REV=PBREV
    718744trap CaughtSoftReset SIGTERM
     745trap GetShell SIGINTR
    719746LOGFILE=/var/log/mondorestore.log
    720747PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/games
     
    963990    sleep 1
    964991else
    965     echo -en "Type 'exit' to reboot the PC\n"
    966     umount -d /mnt/cdrom 2> /dev/null
    967     mount / -o rw,remount > /dev/null 2> /dev/null
    968     LogIt "Launching Shell"
    969     sh
     992    GetShell
    970993fi
    971994CaughtSoftReset
    972 # reboot
Note: See TracChangeset for help on using the changeset viewer.