]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
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. # | |
11 | # # | |
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. # | |
16 | # # | |
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/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | echo "Scanning source media" | |
23 | ||
24 | # scan CDROM devices | |
25 | for DEVICE in $(kudzu -qps -t 30 -c CDROM | grep device: | cut -d ' ' -f 2 | sort | uniq); do | |
26 | mount /dev/${DEVICE} /cdrom 2> /dev/null | |
27 | if [ -n "$(ls /cdrom/ipfire-*.tbz2 2>/dev/null)" ]; then | |
28 | echo -n ${DEVICE} > /tmp/source_device | |
29 | echo "Found tarball on ${DEVICE}" | |
30 | else | |
31 | echo "Found no tarballs on ${DEVICE} - SKIP" | |
32 | fi | |
33 | umount /cdrom 2> /dev/null | |
34 | done | |
35 | ||
36 | # scan HD device unpart (usb sticks, etc.) | |
37 | for DEVICE in $(kudzu -qps -t 30 -c HD | grep device: | cut -d ' ' -f 2 | sort | uniq); do | |
38 | mount /dev/${DEVICE} /cdrom 2> /dev/null | |
39 | if [ -n "$(ls /cdrom/ipfire-*.tbz2 2>/dev/null)" ]; then | |
40 | echo -n ${DEVICE} > /tmp/source_device | |
41 | echo "Found tarball on ${DEVICE}" | |
42 | else | |
43 | umount /cdrom 2> /dev/null | |
44 | echo "Found no tarballs on ${DEVICE} - SKIP" | |
45 | fi | |
46 | umount /cdrom 2> /dev/null | |
47 | done | |
48 | ||
49 | # scan HD device part1 (usb sticks, etc.) | |
50 | for DEVICE in $(kudzu -qps -t 30 -c HD | grep device: | cut -d ' ' -f 2 | sort | uniq); do | |
51 | mount /dev/${DEVICE}1 /cdrom 2> /dev/null | |
52 | if [ -n "$(ls /cdrom/ipfire-*.tbz2 2>/dev/null)" ]; then | |
53 | echo -n ${DEVICE}1 > /tmp/source_device | |
54 | echo "Found tarball on ${DEVICE}1" | |
55 | else | |
56 | umount /cdrom 2> /dev/null | |
57 | echo "Found no tarballs on ${DEVICE} - SKIP" | |
58 | fi | |
59 | umount /cdrom 2> /dev/null | |
60 | done | |
61 | ||
62 | if [ -e "/tmp/source_device" ]; then | |
63 | mount /dev/$(cat /tmp/source_device) /cdrom 2> /dev/null | |
64 | exit 0 | |
65 | else | |
66 | exit 10 | |
67 | fi |