]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/installer/downloadsource.sh
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
20 ###############################################################################
23 wget
-U "IPFire-NetInstall/2.x" "$@"
27 echo "$0: Insufficient number of arguments" >&2
34 # Mount a tmpfs which is big enough to hold the ISO image
35 OUTPUT_DIR
="${OUTPUT%/*}"
37 mkdir
-p "${OUTPUT_DIR}"
38 if ! mount
-t tmpfs none
"${OUTPUT_DIR}" -o size
=512M
; then
39 echo "Could not mount tmpfs to ${OUTPUT_DIR}" >&2
43 echo "Downloading ${URL}..."
44 if ! download
-O "${OUTPUT}" "${URL}"; then
45 echo "Download failed" >&2
51 # Download went well. Checking for BLAKE2 sum
52 if download
-O "${OUTPUT}.b2" "${URL}.b2" &>/dev
/null
; then
53 # Read downloaded checksum
54 read -r b2sum rest
< "${OUTPUT}.b2"
57 # Compute checkum of downloaded image file
58 read -r b2sum_image rest
<<< "$(b2sum "${OUTPUT}")"
60 if [ "${b2sum}" != "${b2sum_image}" ]; then
61 echo "BLAKE2 checksum mismatch: ${b2sum} != ${b2sum_image}" >&2