source: MondoRescue/trunk/mondo/mondo/restore-scripts/mondo/mount-subroutine-me@ 30

Last change on this file since 30 was 30, checked in by bcornec, 19 years ago

Id property added on files to allow for better conf. management

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#!/bin/sh
2
3LogIt "mount-subroutine-me --- starting"
4if [ "$#" -ne "0" ] ; then
5 LogIt "mount-subroutine-me < mountlist" 1
6 exit 1
7fi
8
9# ----------- mount partitions to be restored to --------------
10
11#echo "START mount-me"
12
13errors=0
14
15read incoming
16while [ "$incoming" != "" ] ; do
17 partno=`echo $incoming | cut -d' ' -f1`
18 mountpt=`echo $incoming | cut -d' ' -f2`
19 mounttype=`echo $incoming | cut -d' ' -f3`
20 mountdir="/mnt/RESTORING$mountpt"
21 if [ "$mounttype" = "swap" ] ; then
22 swapon $partno
23 else
24 if [ -e "$mountdir" ] && [ ! -d "$mountdir" ] ; then
25 LogIt "$mountdir exists (but not a dir). Deleting..." 2
26 rm "$mountdir" -f
27 mkdir -p "$mountdir"
28 else
29 LogIt "Making dir $mountdir..." 2
30 mkdir -p "$mountdir"
31 fi
32 if [ "$?" -ne "0" ] ; then
33 LogIt "Failed to mkdir $mountdir" 3
34 errors=$(($errors+1))
35 else
36 LogIt "$mountdir mounted ok." 2
37 fi
38 LogIt "Mounting $partno..." 2
39 if [ -e "/tmp/MOUNT-READONLY" ] ; then
40 mount $partno -t $mounttype -o ro $mountdir
41 else
42 mount $partno -t $mounttype $mountdir
43 fi
44 if [ "$?" -ne "0" ] ; then
45 LogIt "Failed to mount $partno" 3
46 errors=$(($errors+1))
47 fi
48 res=`mount | grep "$partno"`
49 if [ "$res" = "" ] ; then
50 LogIt "I think I failed to mount $partno" 3
51 errors=$(($errors+1))
52 else
53 LogIt "$partno mounted ok." 2
54 fi
55 fi
56 read incoming
57 [ "$incoming" != "" ] || read incoming
58done
59
60if [ "$errors" = "0" ] ; then
61 LogIt "All partitions mounted ok." 3
62else
63 LogIt "$errors errors occurred during mounting process." 3
64fi
65
66LogIt "mount-subroutine-me --- leaving"
67exit $errors
Note: See TracBrowser for help on using the repository browser.