]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/install+setup/install/mountsource.sh
267823a1dcc14cf549147db2626e27111a444f56
[people/teissler/ipfire-2.x.git] / src / install+setup / install / mountsource.sh
1 #!/bin/sh
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2013 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 #lfs patch source here...
23 version=FullIPFireVersion
24 #
25
26 echo "Scanning source media"
27
28 # scan all Block devices
29 for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;`
30 do
31 mount /dev/${DEVICE} /cdrom 2> /dev/null
32 if [ -n "$(ls /cdrom/${version}.media 2>/dev/null)" ]; then
33 echo -n ${DEVICE} > /tmp/source_device
34 echo "Found ${version} on ${DEVICE}"
35 exit 0
36 else
37 echo "not found on ${DEVICE} - SKIP"
38 fi
39 umount /cdrom 2> /dev/null
40 done
41
42 # scan all Partitions on block devices
43 for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;`
44 do
45 for DEVICEP in $(ls /dev/${DEVICE}? | sed "s/\/dev\///" 2> /dev/null);do
46 mount /dev/${DEVICEP} /cdrom 2> /dev/null
47 if [ -n "$(ls /cdrom/${version}.media 2>/dev/null)" ]; then
48 echo -n ${DEVICEP} > /tmp/source_device
49 echo "Found ${version} on ${DEVICEP}"
50 exit 0
51 else
52 echo "not found on ${DEVICEP} - SKIP"
53 fi
54 umount /cdrom 2> /dev/null
55 done
56 done
57
58 # scan all Partitions on raid/mmc devices
59 for DEVICE in `find /sys/block/* -maxdepth 0 ! -name fd* ! -name loop* ! -name ram* -exec basename {} \;`
60 do
61 for DEVICEP in $(ls /dev/${DEVICE}p? | sed "s/\/dev\///");do
62 mount /dev/${DEVICEP} /cdrom 2> /dev/null
63 if [ -n "$(ls /cdrom/${version}.media 2>/dev/null)" ]; then
64 echo -n ${DEVICEP} > /tmp/source_device
65 echo "Found ${version} on ${DEVICEP}"
66 exit 0
67 else
68 echo "not found on ${DEVICEP} - SKIP"
69 fi
70 umount /cdrom 2> /dev/null
71 done
72 done
73
74 exit 10