]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/install+setup/install/mountdest.sh
Dem Installer ne bessere Rechnung fuer die Diskgroessen bekommen.
[people/pmueller/ipfire-2.x.git] / src / install+setup / install / mountdest.sh
1 #!/bin/sh
2
3 echo "Scanning for possible destination drives"
4
5 # scan IDE devices
6 echo "--> IDE"
7 for DEVICE in $(kudzu -qps -t 30 -c HD -b IDE | grep device: | cut -d ' ' -f 2 | sort | uniq); do
8 mount /dev/${DEVICE}1 /harddisk 2> /dev/null
9 if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
10 umount /harddisk 2> /dev/null
11 echo "${DEVICE} is source drive - SKIP"
12 continue
13 else
14 umount /harddisk 2> /dev/null
15 echo -n "$DEVICE" > /tmp/dest_device
16 echo "${DEVICE} - yes, it is our destination"
17 exit 0
18 fi
19 done
20
21 # scan USB/SCSI devices
22 echo "--> USB/SCSI"
23 for DEVICE in $(kudzu -qps -t 30 -c HD -b SCSI | grep device: | cut -d ' ' -f 2 | sort | uniq); do
24 mount /dev/${DEVICE}1 /harddisk 2> /dev/null
25 if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
26 umount /harddisk 2> /dev/null
27 echo "${DEVICE} is source drive - SKIP"
28 continue
29 else
30 umount /harddisk 2> /dev/null
31 echo -n "$DEVICE" > /tmp/dest_device
32 echo "${DEVICE} - yes, it is our destination"
33 exit 1
34 fi
35 done
36
37 # scan RAID devices
38 echo "--> RAID"
39 for DEVICE in $(kudzu -qps -t 30 -c HD -b RAID | grep device: | cut -d ' ' -f 2 | sort | uniq); do
40 mount /dev/${DEVICE}p1 /harddisk 2> /dev/null
41 if [ -n "$(ls /harddisk/ipfire-*.tbz2 2>/dev/null)" ]; then
42 umount /harddisk 2> /dev/null
43 echo "${DEVICE} is source drive - SKIP"
44 continue
45 else
46 umount /harddisk 2> /dev/null
47 echo -n "$DEVICE" > /tmp/dest_device
48 echo "${DEVICE} - yes, it is our destination"
49 exit 2
50 fi
51 done
52
53 exit 10 # Nothing found