]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/mountdest.sh
a8242330b77e7fb2b967dac6c60d2591d3e7b6ce
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
22 echo "Scanning for possible destination drives"
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-*.tlz 2>/dev/null)" ]; then
29 umount
/harddisk
2> /dev
/null
30 echo "${DEVICE}1 is source drive - SKIP"
33 umount
/harddisk
2> /dev
/null
34 echo -n "$DEVICE" > /tmp
/dest_device
35 echo "${DEVICE} - yes, it is our destination"
36 exit 0 # IDE / use DEVICE for grub
40 # scan USB/SCSI devices
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} /harddisk
2> /dev
/null
44 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
45 umount
/harddisk
2> /dev
/null
46 echo "${DEVICE} is source drive - SKIP"
49 umount
/harddisk
2> /dev
/null
50 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
51 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
52 umount
/harddisk
2> /dev
/null
53 echo "${DEVICE}1 is source drive - SKIP"
56 umount
/harddisk
2> /dev
/null
57 echo -n "$DEVICE" > /tmp
/dest_device
58 echo "${DEVICE} - yes, it is our destination"
59 exit 1 # SCSI/USB (always use /dev/sda as bootdevicename)
66 for DEVICE
in $
(kudzu
-qps -t 30 -c HD
-b RAID |
grep device
: | cut
-d ' ' -f 2 |
sort |
uniq); do
67 mount
/dev
/${DEVICE}p1
/harddisk
2> /dev
/null
68 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
69 umount
/harddisk
2> /dev
/null
70 echo "${DEVICE}p1 is source drive - SKIP"
73 umount
/harddisk
2> /dev
/null
74 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
75 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
76 umount
/harddisk
2> /dev
/null
77 echo "${DEVICE}1 is source drive - SKIP"
80 umount
/harddisk
2> /dev
/null
81 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
82 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
83 umount
/harddisk
2> /dev
/null
84 echo "${DEVICE} is source drive - SKIP"
87 echo -n "$DEVICE" > /tmp
/dest_device
88 echo "${DEVICE} - yes, it is our destination"
89 exit 2 # Raid ( /dev/device/diskx )
97 for DEVICE
in vda vdb vdc vdd
; do
98 if [ ! -e /dev
/${DEVICE} ]; then
101 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
102 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
103 umount
/harddisk
2> /dev
/null
104 echo "${DEVICE} is source drive - SKIP"
107 umount
/harddisk
2> /dev
/null
108 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
109 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
110 umount
/harddisk
2> /dev
/null
111 echo "${DEVICE}1 is source drive - SKIP"
114 umount
/harddisk
2> /dev
/null
115 echo -n "$DEVICE" > /tmp
/dest_device
116 echo "${DEVICE} - yes, it is our destination"
117 exit 0 # like ide / use device for grub
124 exit 10 # Nothing found