~vcs-imports/ipfire/ipfire-2.x

« back to all changes in this revision

Viewing changes to src/install+setup/install/mountdest.sh

  • Committer: Daniel Glanzmann
  • Date: 2008-09-26 17:05:28 UTC
  • mto: (1394.1.12)
  • mto: This revision was merged to the branch mainline in revision 1401.
  • Revision ID: git-v1:19ac4d1b6e234e1391b3d406381e3b74e92c40dd
added new useragent thunderbird

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
###############################################################################
 
3
#                                                                             #
 
4
# IPFire.org - A linux based firewall                                         #
 
5
# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
 
6
#                                                                             #
 
7
# This program is free software: you can redistribute it and/or modify        #
 
8
# it under the terms of the GNU General Public License as published by        #
 
9
# the Free Software Foundation, either version 3 of the License, or           #
 
10
# (at your option) any later version.                                         #
 
11
#                                                                             #
 
12
# This program is distributed in the hope that it will be useful,             #
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
 
15
# GNU General Public License for more details.                                #
 
16
#                                                                             #
 
17
# You should have received a copy of the GNU General Public License           #
 
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
 
19
#                                                                             #
 
20
###############################################################################
 
21
 
 
22
echo "Scanning for possible destination drives"
 
23
 
 
24
# scan IDE devices
 
25
echo "--> IDE"
 
26
for DEVICE in $(kudzu -qps -t 30 -c HD -b IDE | grep device: | cut -d ' ' -f 2 | sort | uniq); do
 
27
                mount /dev/${DEVICE}1 /harddisk 2> /dev/null
 
28
                if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
 
29
                        umount /harddisk 2> /dev/null
 
30
                        echo "${DEVICE} is source drive - SKIP"
 
31
                        continue
 
32
                else
 
33
                        umount /harddisk 2> /dev/null
 
34
                        echo -n "$DEVICE" > /tmp/dest_device
 
35
                        echo "${DEVICE} - yes, it is our destination"
 
36
                        exit 0
 
37
                fi
 
38
done
 
39
 
 
40
# scan USB/SCSI devices
 
41
echo "--> USB/SCSI"
 
42
for DEVICE in $(kudzu -qps -t 30 -c HD -b SCSI | grep device: | cut -d ' ' -f 2 | sort | uniq); do
 
43
                mount /dev/${DEVICE}1 /harddisk 2> /dev/null
 
44
                if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
 
45
                        umount /harddisk 2> /dev/null
 
46
                        echo "${DEVICE} is source drive - SKIP"
 
47
                        continue
 
48
                else
 
49
                        umount /harddisk 2> /dev/null
 
50
                        echo -n "$DEVICE" > /tmp/dest_device
 
51
                        echo "${DEVICE} - yes, it is our destination"
 
52
                        exit 1
 
53
                fi
 
54
done
 
55
 
 
56
# scan RAID devices
 
57
echo "--> RAID"
 
58
for DEVICE in $(kudzu -qps -t 30 -c HD -b RAID | grep device: | cut -d ' ' -f 2 | sort | uniq); do
 
59
                mount /dev/${DEVICE}p1 /harddisk 2> /dev/null
 
60
                if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
 
61
                        umount /harddisk 2> /dev/null
 
62
                        echo "${DEVICE} is source drive - SKIP"
 
63
                        continue
 
64
                else
 
65
                        umount /harddisk 2> /dev/null
 
66
                        mount /dev/${DEVICE}1 /harddisk 2> /dev/null
 
67
                        if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
 
68
                            umount /harddisk 2> /dev/null
 
69
                            echo "${DEVICE} is source drive - SKIP"
 
70
                            continue
 
71
                        else
 
72
                            echo -n "$DEVICE" > /tmp/dest_device
 
73
                            echo "${DEVICE} - yes, it is our destination"
 
74
                            exit 2
 
75
                        fi
 
76
                fi
 
77
done
 
78
 
 
79
exit 10 # Nothing found