mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-27 11:13:24 +02:00
Installer: Add installmedia download support.
This commit is contained in:
52
src/install+setup/install/downloadsource.sh
Normal file
52
src/install+setup/install/downloadsource.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2010 IPFire Team <info@ipfire.org> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
# Path for testing. Need to be changed for release!
|
||||
IPFireISO=people.ipfire.org/~arne_f/testing/next/ipfire.iso
|
||||
#IPFireISO=download.ipfire.org/iso/ipfire.iso
|
||||
|
||||
#Get user defined download from boot cmdline
|
||||
grep "netinstall=" /proc/cmdline > /dev/null && CMDLINE=1
|
||||
if ( [ "$CMDLINE" == "1" ]); then
|
||||
read CMDLINE < /proc/cmdline
|
||||
POS=${CMDLINE%%netinstall*}
|
||||
POS=${#POS}
|
||||
IPFireISO=`echo ${CMDLINE:POS} | cut -d"=" -f2 | cut -d" " -f1`
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Configure Network with DHCP..."
|
||||
dhcpcd
|
||||
echo
|
||||
echo "Download with wget..."
|
||||
wget $IPFireISO -O /tmp/download.iso -t3 -U IPFire_NetInstall/2.x
|
||||
echo
|
||||
echo "Checking download..."
|
||||
mount /tmp/download.iso -o loop /cdrom 2> /dev/null
|
||||
if [ -n "$(ls /cdrom/ipfire-*.tlz 2>/dev/null)" ]; then
|
||||
echo -n "null" > /tmp/source_device
|
||||
echo "Found tarball in /tmp/download.iso"
|
||||
exit 0
|
||||
else
|
||||
echo "Found no tarballs in /tmp/download.iso - SKIP"
|
||||
fi
|
||||
umount /cdrom 2> /dev/null
|
||||
exit 10
|
||||
@@ -156,19 +156,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
switch (mysystem("/bin/mountsource.sh")) {
|
||||
case 0:
|
||||
break;
|
||||
case 10:
|
||||
errorbox(ctr[TR_NO_CDROM]);
|
||||
goto EXIT;
|
||||
mysystem("/bin/mountsource.sh");
|
||||
|
||||
if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
|
||||
newtWinMessage(title, ctr[TR_OK], ctr[TR_NO_LOCAL_SOURCE]);
|
||||
runcommandwithstatus("/bin/downloadsource.sh",ctr[TR_DOWNLOADING_ISO]);
|
||||
if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
|
||||
errorbox(ctr[TR_DOWNLOAD_ERROR]);
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
/* read source drive letter */
|
||||
if ((handle = fopen("/tmp/source_device", "r")) == NULL) {
|
||||
errorbox(ctr[TR_ERROR_PROBING_CDROM]);
|
||||
goto EXIT;
|
||||
}
|
||||
fgets(sourcedrive, 5, handle);
|
||||
fprintf(flog, "Source drive: %s\n", sourcedrive);
|
||||
fclose(handle);
|
||||
|
||||
Reference in New Issue
Block a user