Use local isos fixed (#361)

* Start adding params for existing isos

* Merge parameter handling code

* initial testing seems reasonable

Note that if copying files in, "wget -c " will assume

smaller-than-remote files are parts and continue
so likely will cause hashing failures
or if no hash check then corrupt isos.

* Added usage for --help

* Usage enhanced and added to Readme

* spurios unused cruft removed

* Fixed race

adding belts and braces

* Removed debugging and cruft

* Not yet able to cache windows because windows

* Working for cached macos

with limitations
pull/365/head
Phil Clifford 3 years ago committed by GitHub
parent 65b78eb8a4
commit da8d0c7899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      quickget

@ -537,23 +537,34 @@ function check_hash() {
} }
function copy_local(){ function copy_local(){
case $OS in
windows)
echo "${OS} not (yet?) supported for local isos" ;;
macos)
# echo "${OS} not (yet?) supported for local isos" ;;
if [ -n "${ISODIR}" ]; then
for macfile in RecoveryImage.dmg RecoveryImage.chunklist
do
find "${ISODIR}" -type f -name "${macfile}" -exec cp -pv \{\} "$DIR"/ \;
done
fi;;
*)
if [ -n "${ISODIR}" ]; then if [ -n "${ISODIR}" ]; then
# use supplied filename or default to original distro ISO name # use supplied filename or default to original distro ISO name
if [ -z ${LOCALISO} ]; then if [ -z "${LOCALISO}" ]; then
LOCALISO=${FILE} LOCALISO=${FILE}
fi fi
LOCALFILE=$(find ${ISODIR} -type f -name "${LOCALISO}" -print -quit ) LOCALFILE=$(find "${ISODIR}" -type f -name "${LOCALISO}" -print -quit )
#echo got local file "${LOCALFILE}"
if [ -f "${DIR}/${FILE}" ]; then if [ -f "${DIR}/${FILE}" ]; then
echo "ERROR! File Exists - not copying over local file" echo "ERROR! File Exists - not copying over local file"
echo "Move it out of the way to replace it with a local file" echo "Move it out of the way to replace it with a local file"
exit 1 exit 1
else else
cp -pv "${LOCALFILE}" ${DIR}/${FILE} cp -pv "${LOCALFILE}" "${DIR}"/"${FILE}"
# if ! ; then echo ERROR! Failed to copy ${LOCALFILE}" to ${DIR}/${FILE}" # if ! ; then echo ERROR! Failed to copy ${LOCALFILE}" to ${DIR}/${FILE}"
fi fi
#exit 0 # while testing
fi fi
esac
} }
function web_get() { function web_get() {
@ -572,7 +583,14 @@ function web_get() {
echo "ERROR! Unable to create directory ${DIR}" echo "ERROR! Unable to create directory ${DIR}"
exit 1 exit 1
fi fi
if [ -n "${LOCALISO}" ] || [ -n "${ISODIR}" ] ; then
copy_local copy_local
# you only get one shot
LOCALISO=""
ISODIR=""
fi
if command -v aria2c > /dev/null; then if command -v aria2c > /dev/null; then
if ! aria2c -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" -o "${DIR}/${FILE}"; then if ! aria2c -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" -o "${DIR}/${FILE}"; then
@ -613,7 +631,12 @@ function zsync_get() {
exit 1 exit 1
fi fi
if [ -n "${LOCALISO}" ] || [ -n "${ISODIR}" ] ; then
copy_local copy_local
# you only get one shot
LOCALISO=""
ISODIR=""
fi
if ! zsync "${URL}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then if ! zsync "${URL}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then
echo "ERROR! Failed to download ${URL}.zsync" echo "ERROR! Failed to download ${URL}.zsync"
@ -634,6 +657,7 @@ function start_vm_info() {
echo "To start your ${OS} ${RELEASE} virtual machine run:" echo "To start your ${OS} ${RELEASE} virtual machine run:"
echo " quickemu --vm ${OS}-${RELEASE}.conf" echo " quickemu --vm ${OS}-${RELEASE}.conf"
echo echo
exit 0
} }
function make_vm_config() { function make_vm_config() {
@ -684,7 +708,7 @@ EOF
echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf" echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf"
fi fi
if [ "${OS}" == "alma" ] && [ ${ISOTYPE} == "dvd" ]; then if [ "${OS}" == "alma" ] && [ "${ISOTYPE}" == "dvd" ]; then
echo "disk_size=\"32G\"" >> "${OS}-${RELEASE}.conf" echo "disk_size=\"32G\"" >> "${OS}-${RELEASE}.conf"
fi fi
@ -1941,10 +1965,10 @@ languages_windows
# handle parameters # handle parameters
# Take command line arguments # Take command line arguments
#if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
# usage usage
# exit 0 exit 0
#else fi
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "${1}" in case "${1}" in
-isodir|--isodir) -isodir|--isodir)
@ -1967,10 +1991,11 @@ languages_windows
quickemu_version=$( "${whereIam}"/quickemu --version) quickemu_version=$( "${whereIam}"/quickemu --version)
echo "Quickemu Version: ${quickemu_version}" echo "Quickemu Version: ${quickemu_version}"
exit 0;; exit 0;;
test*) -t|--t|-test|--test)
echo "you are just testing echo "you are just testing
ISODIR: ${ISODIR} ISODIR: ${ISODIR}
LOCALISO: ${LOCALISO}" LOCALISO: ${LOCALISO}"
ls -lh "${ISODIR}/${LOCALISO}"
exit 0;; exit 0;;
*) *)

Loading…
Cancel
Save