mirror of
				https://github.com/oSoWoSo/DistroHopper.git
				synced 2024-08-14 22:46:53 +00:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									65b78eb8a4
								
							
						
					
					
						commit
						da8d0c7899
					
				
					 1 changed files with 48 additions and 23 deletions
				
			
		
							
								
								
									
										71
									
								
								quickget
									
										
									
									
									
								
							
							
						
						
									
										71
									
								
								quickget
									
										
									
									
									
								
							|  | @ -537,23 +537,34 @@ function check_hash() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function copy_local(){ | function copy_local(){ | ||||||
|   if [ -n "${ISODIR}" ]; then |   case $OS in | ||||||
|     # use supplied filename or default to original distro ISO name |     windows) | ||||||
|       if [ -z ${LOCALISO} ]; then |       echo "${OS} not (yet?)  supported for local isos" ;; | ||||||
|         LOCALISO=${FILE} |     macos) | ||||||
|       fi |       # echo "${OS} not (yet?)  supported for local isos" ;; | ||||||
|       LOCALFILE=$(find ${ISODIR} -type f -name "${LOCALISO}" -print -quit ) |       if [ -n "${ISODIR}" ]; then | ||||||
|       #echo got local file "${LOCALFILE}" |       for macfile in RecoveryImage.dmg RecoveryImage.chunklist | ||||||
|       if [ -f "${DIR}/${FILE}" ]; then |       do | ||||||
|         echo "ERROR! File Exists - not copying over local file" |         find "${ISODIR}" -type f -name "${macfile}" -exec cp -pv \{\} "$DIR"/ \; | ||||||
|         echo "Move it out of the way to replace it with a local file" |       done | ||||||
|         exit 1 |       fi;; | ||||||
|       else |     *) | ||||||
|         cp -pv "${LOCALFILE}" ${DIR}/${FILE} |       if [ -n "${ISODIR}" ]; then | ||||||
|       # if ! ; then echo ERROR! Failed to copy ${LOCALFILE}" to ${DIR}/${FILE}" |         # use supplied filename or default to original distro ISO name | ||||||
|       fi |           if [ -z "${LOCALISO}" ]; then | ||||||
|       #exit 0 # while testing |             LOCALISO=${FILE} | ||||||
|     fi |           fi | ||||||
|  |           LOCALFILE=$(find "${ISODIR}" -type f -name "${LOCALISO}" -print -quit ) | ||||||
|  |           if [ -f "${DIR}/${FILE}" ]; then | ||||||
|  |             echo "ERROR! File Exists - not copying over local file" | ||||||
|  |             echo "Move it out of the way to replace it with a local file" | ||||||
|  |             exit 1 | ||||||
|  |           else | ||||||
|  |             cp -pv "${LOCALFILE}" "${DIR}"/"${FILE}" | ||||||
|  |           # if ! ; then echo ERROR! Failed to copy ${LOCALFILE}" to ${DIR}/${FILE}" | ||||||
|  |           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…
	
	Add table
		Add a link
		
	
		Reference in a new issue