Nix wrote:
> On 8 May 2007, Michael Tokarev told this:
>> BTW, for such recovery purposes, I use initrd (initramfs really, but
>> does not matter) with a normal (but tiny) set of commands inside,
>> thanks to busybox.  So everything can be done without any help from
>> external "recovery CD".  Very handy at times, especially since all
>> the network drivers are here on the initramfs too, so I can even
>> start a netcat server while in initramfs, and perform recovery from
>> remote system... ;)
> 
> What you should probably do is drop into the shell that's being used to
> run init if mount fails (or, more generally, if after mount runs it

That's exactly what my initscript does ;)

chk() {
  while ! "$@"; do
    warn "the following command failed:"
    warn "$*"
    p="** Continue(Ignore)/Shell/Retry (C/s/r)? "
    while : ; do
      if ! read -t 10 -p "$p" x 2>&1; then
        echo "(timeout, continuing)"
        return 1
      fi
      case "$x" in
        [Ss!]*) /bin/sh 2>&1 ;;
        [Rr]*) break;;
        [CcIi]*|"") return 1;;
        *) echo "(unrecognized response)";;
      esac
    done
  done
}

chk mount -n -t proc proc /proc
chk mount -n -t sysfs sysfs /sys
...
info "mounting $rootfstype fs on $root (options: $rootflags)"
chk mount -n -t $rootfstype -o $rootflags $root /root
if [ $? != 0 ] && ! grep -q "^[^ ]\\+ /root " /proc/mounts; then
  warn "root filesystem ($rootfstype on $root) is NOT mounted!"
fi
...

> hasn't ended up mounting anything: there's no need to rely on mount's
> success/failure status). [...]

Well, so far exitcode has been reliable.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to