]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> # | |
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 all Block devices | |
25 | for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;` | |
26 | do | |
27 | mount /dev/${DEVICE} /cdrom 2> /dev/null | |
28 | if [ -n "$(ls /cdrom/ipfire-*.tlz 2>/dev/null)" ]; then | |
29 | echo -n ${DEVICE} > /tmp/source_device | |
30 | echo "Found tarball on ${DEVICE}" | |
31 | exit 0 | |
32 | else | |
33 | echo "Found no tarballs on ${DEVICE} - SKIP" | |
34 | fi | |
35 | umount /cdrom 2> /dev/null | |
36 | done | |
37 | ||
38 | # scan all Partitions on block devices | |
39 | for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;` | |
40 | do | |
41 | for DEVICEP in $(ls /dev/${DEVICE}? | sed "s/\/dev\///" 2> /dev/null);do | |
42 | mount /dev/${DEVICEP} /cdrom 2> /dev/null | |
43 | if [ -n "$(ls /cdrom/ipfire-*.tlz 2>/dev/null)" ]; then | |
44 | echo -n ${DEVICEP} > /tmp/source_device | |
45 | echo "Found tarball on ${DEVICEP}" | |
46 | exit 0 | |
47 | else | |
48 | echo "Found no tarballs on ${DEVICEP} - SKIP" | |
49 | fi | |
50 | umount /cdrom 2> /dev/null | |
51 | done | |
52 | done | |
53 | ||
54 | # scan all Partitions on raid/mmc devices | |
55 | for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;` | |
56 | do | |
57 | for DEVICEP in $(ls /dev/${DEVICE}p? | sed "s/\/dev\///");do | |
58 | mount /dev/${DEVICEP} /cdrom 2> /dev/null | |
59 | if [ -n "$(ls /cdrom/ipfire-*.tlz 2>/dev/null)" ]; then | |
60 | echo -n ${DEVICEP} > /tmp/source_device | |
61 | echo "Found tarball on ${DEVICEP}" | |
62 | exit 0 | |
63 | else | |
64 | echo "Found no tarballs on ${DEVICEP} - SKIP" | |
65 | fi | |
66 | umount /cdrom 2> /dev/null | |
67 | done | |
68 | done | |
69 | ||
70 | exit 10 |