~ubuntu-branches/ubuntu/natty/os-prober/natty

« back to all changes in this revision

Viewing changes to linux-boot-probes/common/50mounted-tests

  • Committer: Bazaar Package Importer
  • Author(s): Frans Pop
  • Date: 2007-02-27 20:16:49 UTC
  • mfrom: (1.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070227201649-dayeca1vogcnuhov
Tags: 1.17
Check for both upper and lowercase filenames when detecting Windows
NT/XP/2000. Thanks to Thanatermesis.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# Sub-tests that require a mounted partition.
3
3
. /usr/share/os-prober/common.sh
4
4
set -e
 
5
 
5
6
partition=$1
6
7
 
7
8
parsefstab () {
23
24
        mkdir $tmpmnt
24
25
fi
25
26
 
 
27
# If DO_MOUNTED is set, also process already mounted partitions by temporarily
 
28
# unmounting them.
 
29
oldmnt=$(mount |grep "$partition "|cut -d' ' -f 3)
 
30
if [ -n "$DO_MOUNTED" ] && [ -n "$oldmnt" ]; then
 
31
        oldopts=$(mount |grep "$partition "|sed 's/.*(\(.*\)).*/\1/')
 
32
        umount $partition
 
33
fi
 
34
 
26
35
for type in $(grep -v nodev /proc/filesystems); do
27
36
        if mount -o ro -t $type $partition $tmpmnt 2>/dev/null; then
28
37
                bootpart=""
87
96
                                        debug "$test succeeded"
88
97
                                        umount $tmpmnt/boot 2>/dev/null || true         
89
98
                                        umount $tmpmnt
 
99
                                        if [ -n "$DO_MOUNTED" ] && [ -n "$oldmnt" ]; then
 
100
                                                mount $partition $oldmnt -o $oldopts
 
101
                                        fi
90
102
                                        rmdir $tmpmnt || true
91
103
                                        exit 0
92
104
                                fi
95
107
                
96
108
                umount $tmpmnt/boot 2>/dev/null || true         
97
109
                umount $tmpmnt
 
110
                if [ -n "$DO_MOUNTED" ] && [ -n "$oldmnt" ]; then
 
111
                        mount $partition $oldmnt -o $oldopts
 
112
                fi
98
113
 
99
114
                break
100
115
        fi