Installer: Add installmedia download support.

This commit is contained in:
Arne Fitzenreiter
2010-11-25 14:18:11 +01:00
parent 9e1ceb99a1
commit 0f680bccd3
18 changed files with 323 additions and 23 deletions

View 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

View File

@@ -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);