]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/mountdest.sh
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 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
28 umount
/harddisk
2> /dev
/null
29 echo "${DEVICE} is empty - SKIP"
32 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
33 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
34 umount
/harddisk
2> /dev
/null
35 echo "${DEVICE}1 is source drive - SKIP"
38 umount
/harddisk
2> /dev
/null
39 echo -n "$DEVICE" > /tmp
/dest_device
40 echo "${DEVICE} - yes, it is our destination"
41 exit 0 # IDE / use DEVICE for grub
45 # scan USB/SCSI devices
47 for DEVICE
in $
(kudzu
-qps -t 30 -c HD
-b SCSI |
grep device
: | cut
-d ' ' -f 2 |
sort |
uniq); do
48 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
49 umount
/harddisk
2> /dev
/null
50 echo "${DEVICE} is empty - SKIP"
53 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
54 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
55 umount
/harddisk
2> /dev
/null
56 echo "${DEVICE} is source drive - SKIP"
59 umount
/harddisk
2> /dev
/null
60 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
61 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
62 umount
/harddisk
2> /dev
/null
63 echo "${DEVICE}1 is source drive - SKIP"
66 umount
/harddisk
2> /dev
/null
67 echo -n "$DEVICE" > /tmp
/dest_device
68 echo "${DEVICE} - yes, it is our destination"
69 exit 1 # SCSI/USB (always use /dev/sda as bootdevicename)
76 for DEVICE
in $
(kudzu
-qps -t 30 -c HD
-b RAID |
grep device
: | cut
-d ' ' -f 2 |
sort |
uniq); do
77 if [ "$(grep ${DEVICE}p1 /proc/partitions)" = "" ]; then
78 umount
/harddisk
2> /dev
/null
79 echo "${DEVICE}p1 is empty - SKIP"
82 mount
/dev
/${DEVICE}p1
/harddisk
2> /dev
/null
83 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
84 umount
/harddisk
2> /dev
/null
85 echo "${DEVICE}p1 is source drive - SKIP"
88 umount
/harddisk
2> /dev
/null
89 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
90 umount
/harddisk
2> /dev
/null
91 echo "${DEVICE} is empty - SKIP"
94 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
95 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
96 umount
/harddisk
2> /dev
/null
97 echo "${DEVICE}1 is source drive - SKIP"
100 umount
/harddisk
2> /dev
/null
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 echo -n "$DEVICE" > /tmp
/dest_device
108 echo "${DEVICE} - yes, it is our destination"
109 exit 2 # Raid ( /dev/device/diskx )
117 for DEVICE
in vda vdb vdc vdd
; do
118 if [ ! -e /dev
/${DEVICE} ]; then
121 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
122 umount
/harddisk
2> /dev
/null
123 echo "${DEVICE} is empty - SKIP"
126 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
127 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
128 umount
/harddisk
2> /dev
/null
129 echo "${DEVICE} is source drive - SKIP"
132 umount
/harddisk
2> /dev
/null
133 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
134 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
135 umount
/harddisk
2> /dev
/null
136 echo "${DEVICE}1 is source drive - SKIP"
139 umount
/harddisk
2> /dev
/null
140 echo -n "$DEVICE" > /tmp
/dest_device
141 echo "${DEVICE} - yes, it is our destination"
142 exit 0 # like ide / use device for grub
149 exit 10 # Nothing found