]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/mountdest.sh
1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 ###############################################################################
21 echo "Scanning for possible destination drives"
26 # Don't mount if the device does not exist.
27 [ -e "${what}" ] ||
return 1
29 mount
${what} /harddisk
2>/dev
/null
33 umount
-l /harddisk
2>/dev
/null
36 function check_source_drive
() {
37 local device
="/dev/${1}"
41 for dev
in ${device} ${device}1; do
42 # Mount the device (if possible).
43 _mount
${dev} ||
continue
45 if [ -n "$(ls /harddisk/ipfire-*.tlz 2>/dev/null)" ]; then
51 # Stop if the device has been detected as a source drive.
52 [ "${ret}" = "0" ] && break
58 for path
in /sys
/block
/*; do
59 device
=$
(basename ${path})
61 # Skip devices which cannot be used.
73 # Guess if this could be a raid device.
74 for dev
in ${device} ${device}p1
; do
75 if [ -e "/dev/${dev}" ]; then
81 echo "Checking ${device}"
82 if check_source_drive
${device}; then
83 echo " is source drive - skipping"
88 echo " OK, this is it..."
89 echo -n "${device}" > /tmp
/dest_device