Commit 762bdf24 authored by Loic's avatar Loic
Browse files

HBSD: add 'Download only' option

Add option '-F' for download the latest update archive.
The option is able to resume an interrupted download.

Fix issues #57

 signaled by Shawn Webb.
Signed-off-by: Loic's avatarLoic <loic.f@hardenedbsd.org>
parent 930c521d
#!/bin/sh
#-
# Copyright (c) 2015,2020 HardenedBSD
# Copyright (c) 2015,2020,2021 HardenedBSD
# Author: Shawn Webb <shawn.webb@hardenedbsd.org>
#
# This work originally sponsored by G2, Inc
......@@ -43,6 +43,7 @@ dnssec_key="/usr/share/keys/hbsd-update/trusted/dnssec.key"
revoke_dir="/usr/share/keys/hbsd-update/revoked"
fetchonly=0
downloadonly=0
ignorever=0
install_src=0
integriforce=1
......@@ -118,6 +119,7 @@ usage() {
debug_print "\t-c config\tUse a non-default config file"
debug_print "\t-d\t\tDo not use DNSSEC validation"
debug_print "\t-f\t\tFetch only"
debug_print "\t-F\t\tDownload only"
debug_print "\t-h\t\tShow this help screen"
debug_print "\t-I\t\tInteractively remove obsolete files"
debug_print "\t-i\t\tIgnore version check"
......@@ -145,6 +147,10 @@ sigint_handler() {
destroybe=${1}
fi
if [ ${downloadonly} = 1 ]; then
exit 0
fi
debug_print "[-] Caught SIGINT. Cleaning up."
cleanup
......@@ -1117,7 +1123,7 @@ main() {
local_kernel=""
no_kernel=0
while getopts '46dfhimnosBCDITUVb:c:j:K:k:r:Rt:u:v:' opt; do
while getopts '46dfFhimnosBCDITUVb:c:j:K:k:r:Rt:u:v:' opt; do
case "${opt}" in
4)
force_ipv4="yes"
......@@ -1146,6 +1152,9 @@ main() {
f)
fetchonly=1
;;
F)
downloadonly=1
;;
i)
ignorever=1
;;
......@@ -1248,6 +1257,13 @@ main() {
exit 1
fi
if [ ${downloadonly} = 1 ]; then
debug_print "[*] Download the latest update to the current folder."
${FETCH} ${net_flag} -o update-$(get_version).tar -arR \
${baseurl}/update-$(get_version).tar
exit 0
fi
check_version
res=${?}
if [ ${res} -gt 0 ]; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment