Thanks Liam
This commit is contained in:
parent
fedfe11190
commit
d73d54a688
57
quickget
57
quickget
|
@ -362,20 +362,48 @@ function csv_data() {
|
|||
}
|
||||
|
||||
function create_config() {
|
||||
local OS="${1}"
|
||||
local DESTINATION="${2}"
|
||||
local USE
|
||||
|
||||
if [[ "${DESTINATION}" == "http://"* ]] || [[ "${DESTINATION}" == "https://"* ]]; then
|
||||
web_get "${DESTINATION}" "${OS}"
|
||||
echo "#TODO: create config!"
|
||||
elif [[ "${DESTINATION}" == "/"* ]]; then
|
||||
cp "${OS}" "${DESTINATION}"/
|
||||
echo "#TODO: create config!"
|
||||
else
|
||||
echo "You forget write full path?" && exit 1
|
||||
local VM_PATH="${1}"
|
||||
local INPUT="${2}"
|
||||
OS="custom"
|
||||
if ! mkdir "${VM_PATH}" 2>/dev/null; then
|
||||
echo "ERROR! Could not create directory: ${VM_PATH}. Please verify that it does not already exist"
|
||||
exit 21
|
||||
fi
|
||||
exit 0
|
||||
if [[ "${INPUT}" == "http://"* ]] || [[ "${INPUT}" == "https://"* ]]; then
|
||||
INPUT="$(web_redirect "${INPUT}")"
|
||||
if [[ "${INPUT}" == *".iso" ]] || [[ "${INPUT}" == *".img" ]]; then
|
||||
web_get "${INPUT}" "${VM_PATH}"
|
||||
INPUT="${VM_PATH}/${INPUT##*/}"
|
||||
else
|
||||
echo "ERROR! Only ISO,IMG and QCOW2 file types are supported for --create-config"
|
||||
exit 22
|
||||
fi
|
||||
fi
|
||||
if [[ "${INPUT}" == *".iso" ]]; then
|
||||
echo "Moving image to VM dir" && mv "${INPUT}" "${VM_PATH}"
|
||||
CUSTOM_IMAGE_TYPE="iso"
|
||||
elif [[ "${INPUT}" == *".img" ]]; then
|
||||
echo "Moving image to VM dir" && mv "${INPUT}" "${VM_PATH}"
|
||||
CUSTOM_IMAGE_TYPE="img"
|
||||
elif [[ "${INPUT}" == *".qcow2" ]]; then
|
||||
echo "Moving image to VM dir" && mv "${INPUT}" "${VM_PATH}/disk.qcow2"
|
||||
CUSTOM_IMAGE_TYPE="qcow2"
|
||||
else
|
||||
echo "ERROR! Only ISO,IMG and QCOW2 file types are supported for --create-config"
|
||||
exit 23
|
||||
fi
|
||||
echo "Creating custom VM config for ${INPUT##*/}."
|
||||
case "${INPUT,,}" in
|
||||
*windows-server*) CUSTOM_OS="windows-server";;
|
||||
*windows*) CUSTOM_OS="windows";;
|
||||
*freebsd*) CUSTOM_OS="freebsd";;
|
||||
*kolibrios*) CUSTOM_OS="kolibrios";;
|
||||
*reactos*) CUSTOM_OS="reactos";;
|
||||
*) CUSTOM_OS="linux";;
|
||||
esac
|
||||
echo "Selecting OS: ${CUSTOM_OS}. If this is incorrect, please modify the config file to include the correct OS."
|
||||
echo
|
||||
make_vm_config "${INPUT}"
|
||||
}
|
||||
|
||||
function list_supported() {
|
||||
|
@ -1320,6 +1348,9 @@ function make_vm_config() {
|
|||
batocera)
|
||||
GUEST="batocera"
|
||||
IMAGE_TYPE="img";;
|
||||
custom)
|
||||
GUEST="${CUSTOM_OS}"
|
||||
IMAGE_TYPE="${CUSTOM_IMAGE_TYPE}";;
|
||||
dragonflybsd)
|
||||
GUEST="dragonflybsd"
|
||||
IMAGE_TYPE="iso";;
|
||||
|
|
Loading…
Reference in New Issue