#!/bin/sh
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: target/idunn/initramfs/etc_rc.d_rc.trymount.sh
|
|
# Copyright (C) 2008 - 2009 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
. /etc/conf/idunn
|
|
|
|
verbose=
|
|
delayed=
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-v) verbose=yes ;;
|
|
delayed)
|
|
delayed=yes ;;
|
|
*)
|
|
echo "trymount: $1: option not understood." 1>&2
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if grep -q "^[^ ]* $rootfs " /proc/mounts; then
|
|
# alredy mounted
|
|
error=0
|
|
elif [ -n "$root" ]; then
|
|
. /etc/rc.d/functions.in
|
|
|
|
root_type=
|
|
root_tag=
|
|
root_options="$root_mode"
|
|
|
|
if [ "$delayed" = yes -a "$rootdelay" != "0" ]; then
|
|
title "Waiting ${rootdelay}s before trying to mount $rootfs."
|
|
check sleep "$rootdelay"
|
|
status
|
|
fi
|
|
|
|
case "$root_method" in
|
|
nfs)
|
|
root_type="$root_method"
|
|
root_options="$root_options,nolock,intr,tcp"
|
|
;;
|
|
find) # UUID= or LABEL=
|
|
root_tag="$root"
|
|
root=$(blkid -l -o device -t "$root_tag")
|
|
[ -z "$root" ] || root_type=$(blkid -o value -s TYPE "$root")
|
|
[ -z "$root_type" ] || root_tag="$root_tag, $root_type"
|
|
;;
|
|
device)
|
|
root_type=$(blkid -o value -s TYPE "$root")
|
|
;;
|
|
esac
|
|
|
|
if [ -z "$root" ]; then
|
|
title "Mounting $root_tag at $rootfs."
|
|
elif [ -z "$root_type" ]; then
|
|
title "Mounting $root (undetermined) at $rootfs."
|
|
elif [ -z "$root_tag" ]; then
|
|
title "Mounting $root ($root_type) at $rootfs."
|
|
else
|
|
title "Mounting $root ($root_tag) at $rootfs."
|
|
fi
|
|
|
|
if [ -n "$root_type" ]; then
|
|
modprobe -q "$root_type"
|
|
check mount -t "$root_type" -o "$root_options" "$root" "$rootfs"
|
|
else
|
|
check false
|
|
fi
|
|
|
|
status
|
|
else
|
|
[ -z "$verbose" ] ||
|
|
cat <<-EOT >&2
|
|
sorry, root device not specified.
|
|
mount it at $rootfs and try again
|
|
EOT
|
|
error=1
|
|
fi
|
|
exit ${error:-0}
|