]>
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-2012 IPFire Team <info@ipfire.org> #
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 `find /sys/block/* -maxdepth 0 -name sd* -exec basename {} \; | sort | uniq`
28 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
29 umount
/harddisk
2> /dev
/null
30 echo "${DEVICE} is empty - SKIP"
33 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
34 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
35 umount
/harddisk
2> /dev
/null
36 echo "${DEVICE} is source drive - SKIP"
39 umount
/harddisk
2> /dev
/null
40 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
41 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
42 umount
/harddisk
2> /dev
/null
43 echo "${DEVICE}1 is source drive - SKIP"
46 umount
/harddisk
2> /dev
/null
47 echo -n "$DEVICE" > /tmp
/dest_device
48 echo "${DEVICE} - yes, it is our destination"
49 exit 1 # (always use /dev/sda as bootdevicename)
56 for DEVICE
in `find /sys/block/* -maxdepth 0 ! -name sd* ! -name sr* ! -name fd* ! -name loop* ! -name ram* -exec basename {} \; | sort | uniq`
58 mount
/dev
/${DEVICE}p1
/harddisk
2> /dev
/null
59 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
60 umount
/harddisk
2> /dev
/null
61 echo "${DEVICE}p1 is source drive - SKIP"
64 umount
/harddisk
2> /dev
/null
65 if [ "$(grep ${DEVICE} /proc/partitions)" = "" ]; then
66 umount
/harddisk
2> /dev
/null
67 echo "${DEVICE} is empty - SKIP"
70 mount
/dev
/${DEVICE}1 /harddisk
2> /dev
/null
71 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
72 umount
/harddisk
2> /dev
/null
73 echo "${DEVICE}1 is source drive - SKIP"
76 umount
/harddisk
2> /dev
/null
77 mount
/dev
/${DEVICE} /harddisk
2> /dev
/null
78 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
79 umount
/harddisk
2> /dev
/null
80 echo "${DEVICE} is source drive - SKIP"
83 echo -n "$DEVICE" > /tmp
/dest_device
84 echo "${DEVICE} - yes, it is our destination"
85 exit 2 # Raid ( /dev/device/diskx )
91 exit 10 # Nothing found