source: MondoRescue/branches/3.2/mondo/src/restore-scripts/mondo/mr-mount-subroutine-me@ 3542

Last change on this file since 3542 was 3542, checked in by Bruno Cornec, 8 years ago
  • Rename all mondorestore scripts with the mr- prefix and adapt callers
  • Place these scripts in /usr/bin on the restore media
  • Fix a mindi bug where these scripts were not copied anymore with previous modifications around removal of cd
  • Property svn:keywords set to Id
  • Property svn:unix-mode set to 755
File size: 1.7 KB
Line 
1#!/bin/sh
2#
3# $Id: mr-mount-subroutine-me 3542 2016-03-24 16:48:03Z bruno $
4#
5
6LogIt "mr-mount-subroutine-me --- starting"
7if [ "$#" -ne "0" ] ; then
8 LogIt "mr-mount-subroutine-me < mountlist" 1
9 exit 1
10fi
11
12# ----------- mount partitions to be restored to --------------
13
14errors=0
15
16read incoming
17while [ "$incoming" != "" ] ; do
18 partno=`echo $incoming | cut -d' ' -f1`
19 mountpt=`echo $incoming | cut -d' ' -f2`
20 mounttype=`echo $incoming | cut -d' ' -f3`
21 mountdir="/mnt/RESTORING$mountpt"
22 if [ "$mounttype" = "swap" ] ; then
23 swapon $partno
24 else
25 if [ -e "$mountdir" ] && [ ! -d "$mountdir" ] ; then
26 LogIt "$mountdir exists (but not a dir). Deleting..." 2
27 rm -f "$mountdir"
28 mkdir -p "$mountdir"
29 else
30 LogIt "Making dir $mountdir..." 2
31 mkdir -p "$mountdir"
32 fi
33 if [ "$?" -ne "0" ] ; then
34 LogIt "Failed to mkdir $mountdir" 3
35 errors=$(($errors+1))
36 else
37 LogIt "$mountdir mounted ok." 2
38 fi
39 LogIt "Mounting $partno..." 2
40 if [ -e "/tmp/MOUNT-READONLY" ] ; then
41 mount $partno -t $mounttype -o ro $mountdir
42 else
43 mount $partno -t $mounttype $mountdir
44 fi
45 if [ "$?" -ne "0" ] ; then
46 LogIt "Failed to mount $partno" 3
47 errors=$(($errors+1))
48 fi
49 res=`mount | grep "$partno"`
50 if [ "$res" = "" ] ; then
51 LogIt "I think I failed to mount $partno" 3
52 errors=$(($errors+1))
53 else
54 LogIt "$partno mounted ok." 2
55 fi
56 fi
57 read incoming
58 [ "$incoming" != "" ] || read incoming
59done
60
61if [ "$errors" = "0" ] ; then
62 LogIt "All partitions mounted ok." 3
63else
64 LogIt "$errors errors occurred during mounting process." 3
65fi
66
67LogIt "mr-mount-subroutine-me --- leaving"
68exit $errors
Note: See TracBrowser for help on using the repository browser.