From 35fdd0e3010a18c0d58faee55463ab238b441d69 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 30 Sep 2021 19:38:07 -0500 Subject: [PATCH] Add command line option for curl to ignore certs Signed-off-by: Matt DeVillier --- firmware-util.sh | 13 ++++++++++--- firmware.sh | 38 +++++++++++++++++++------------------- functions.sh | 8 ++++---- kodi.sh | 12 ++++++------ setup-kodi.sh | 15 +++++++++++---- uefi-flash.sh | 13 ++++++++++--- 6 files changed, 60 insertions(+), 39 deletions(-) diff --git a/firmware-util.sh b/firmware-util.sh index 97c978a..eb7047d 100644 --- a/firmware-util.sh +++ b/firmware-util.sh @@ -26,16 +26,23 @@ else cd /tmp fi +#check for cmd line param +if [[ "$1" = "-k" ]]; then + export CURL="curl -k" +else + export CURL="curl" +fi + #get support scripts echo -e "\nDownloading supporting files..." rm -rf firmware.sh >/dev/null 2>&1 rm -rf functions.sh >/dev/null 2>&1 rm -rf sources.sh >/dev/null 2>&1 -curl -sLO ${script_url}firmware.sh +$CURL -sLO ${script_url}firmware.sh rc0=$? -curl -sLO ${script_url}functions.sh +$CURL -sLO ${script_url}functions.sh rc1=$? -curl -sLO ${script_url}sources.sh +$CURL -sLO ${script_url}sources.sh rc2=$? if [[ $rc0 -ne 0 || $rc1 -ne 0 || $rc2 -ne 0 ]]; then echo -e "Error downloading one or more required files; cannot continue" diff --git a/firmware.sh b/firmware.sh index e519a81..8d96a9a 100644 --- a/firmware.sh +++ b/firmware.sh @@ -77,8 +77,8 @@ fi #download SeaBIOS update echo_yellow "\nDownloading RW_LEGACY firmware update\n(${rwlegacy_file})" -curl -s -L -O ${rwlegacy_source}${rwlegacy_file}.md5 -curl -s -L -O ${rwlegacy_source}${rwlegacy_file} +$CURL -sLO ${rwlegacy_source}${rwlegacy_file}.md5 +$CURL -sLO ${rwlegacy_source}${rwlegacy_file} #verify checksum on downloaded file md5sum -c ${rwlegacy_file}.md5 --quiet 2> /dev/null [[ $? -ne 0 ]] && { exit_red "RW_LEGACY download checksum fail; download corrupted, cannot flash"; return 1; } @@ -87,9 +87,9 @@ md5sum -c ${rwlegacy_file}.md5 --quiet 2> /dev/null if [ "$preferUSB" = true ]; then #swanky special case if [[ "$device" = "swanky" ]]; then - curl -s -L -o bootorder "${cbfs_source}bootorder.usb2" + $CURL -sLo bootorder "${cbfs_source}bootorder.usb2" else - curl -s -L -o bootorder "${cbfs_source}bootorder.usb" + $CURL -sLo bootorder "${cbfs_source}bootorder.usb" fi if [ $? -ne 0 ]; then echo_red "Unable to download bootorder file; boot order cannot be changed." @@ -100,7 +100,7 @@ if [ "$preferUSB" = true ]; then fi #useHeadless? if [ "$useHeadless" = true ]; then - curl -s -L -O "${cbfs_source}${hswbdw_headless_vbios}" + $CURL -sLO "${cbfs_source}${hswbdw_headless_vbios}" if [ $? -ne 0 ]; then echo_red "Unable to download headless VGA BIOS; headless firmware cannot be installed." else @@ -382,8 +382,8 @@ fi #download firmware file cd /tmp echo_yellow "\nDownloading Full ROM firmware\n(${coreboot_file})" -curl -s -L -O "${firmware_source}${coreboot_file}" -curl -s -L -O "${firmware_source}${coreboot_file}.sha1" +$CURL -sLO "${firmware_source}${coreboot_file}" +$CURL -sLO "${firmware_source}${coreboot_file}.sha1" #verify checksum on downloaded file sha1sum -c ${coreboot_file}.sha1 --quiet > /dev/null 2>&1 @@ -391,7 +391,7 @@ sha1sum -c ${coreboot_file}.sha1 --quiet > /dev/null 2>&1 #preferUSB? if [[ "$preferUSB" = true && $useUEFI = false ]]; then - curl -s -L -o bootorder "${cbfs_source}bootorder.usb" + $CURL -sLo bootorder "${cbfs_source}bootorder.usb" if [ $? -ne 0 ]; then echo_red "Unable to download bootorder file; boot order cannot be changed." else @@ -408,7 +408,7 @@ fi #useHeadless? if [ "$useHeadless" = true ]; then - curl -s -L -O "${cbfs_source}${hswbdw_headless_vbios}" + $CURL -sLO "${cbfs_source}${hswbdw_headless_vbios}" if [ $? -ne 0 ]; then echo_red "Unable to download headless VGA BIOS; headless firmware cannot be installed." else @@ -419,7 +419,7 @@ fi #addPXE? if [ "$addPXE" = true ]; then - curl -s -L -O "${cbfs_source}${pxe_optionrom}" + $CURL -sLO "${cbfs_source}${pxe_optionrom}" if [ $? -ne 0 ]; then echo_red "Unable to download PXE option ROM; PXE capability cannot be added." else @@ -540,8 +540,8 @@ the touchpad firmware, otherwise the touchpad will not work." [[ "$wpEnabled" = true ]] && { exit_red "\nHardware write-protect enabled, cannot downgrade touchpad firmware."; return 1; } # download TP firmware echo_yellow "\nDownloading touchpad firmware\n(${touchpad_eve_fw})" - curl -s -LO "${other_source}${touchpad_eve_fw}" - curl -s -LO "${other_source}${touchpad_eve_fw}.sha1" + $CURL -s -LO "${other_source}${touchpad_eve_fw}" + $CURL -s -LO "${other_source}${touchpad_eve_fw}.sha1" #verify checksum on downloaded file sha1sum -c ${touchpad_eve_fw}.sha1 --quiet > /dev/null 2>&1 if [[ $? -eq 0 ]]; then @@ -687,7 +687,7 @@ else #download shellball ROM echo_yellow "Downloading shellball.${_device}.bin" - curl -s -L -o /tmp/stock-firmware.rom ${shellball_source}shellball.${_device}.bin; + $CURL -sLo /tmp/stock-firmware.rom ${shellball_source}shellball.${_device}.bin; [[ $? -ne 0 ]] && { exit_red "Error downloading; unable to restore stock firmware."; return 1; } #extract VPD from current firmware if present @@ -967,7 +967,7 @@ if [[ "$confirm" = "Y" || "$confirm" = "y" ]]; then exit_red "Error disabling software write-protect; unable to restore bitmaps."; return 1 fi #download shellball - curl -s -L -o /tmp/shellball.rom ${shellball_source}shellball.${device}.bin; + $CURL -sLo /tmp/shellball.rom ${shellball_source}shellball.${device}.bin; [[ $? -ne 0 ]] && { exit_red "Error downloading shellball; unable to restore bitmaps."; return 1; } #extract GBB region, bitmaps ${cbfstoolcmd} /tmp/shellball.rom read -r GBB -f gbb.new >/dev/null 2>&1 @@ -1015,8 +1015,8 @@ read -ep "Do you wish to continue? [y/N] " cd /tmp #download SeaBIOS payload -curl -s -L -O ${bootstub_source}/${bootstub_payload_baytrail} -curl -s -L -O ${bootstub_source}/${bootstub_payload_baytrail}.md5 +$CURL -sLO ${bootstub_source}/${bootstub_payload_baytrail} +$CURL -sLO ${bootstub_source}/${bootstub_payload_baytrail}.md5 #verify checksum on downloaded file md5sum -c ${bootstub_payload_baytrail}.md5 --quiet > /dev/null 2>&1 @@ -1047,9 +1047,9 @@ fi #USB boot priority read -ep "Default to booting from USB? If N, always boot from internal storage unless selected from boot menu. [y/N] " if [[ "$REPLY" = "y" || "$REPLY" = "Y" ]]; then - curl -s -L -o bootorder ${cbfs_source}/bootorder.usb + $CURL -sLo bootorder ${cbfs_source}/bootorder.usb else - curl -s -L -o bootorder ${cbfs_source}/bootorder.emmc + $CURL -sLo bootorder ${cbfs_source}/bootorder.emmc fi @@ -1146,7 +1146,7 @@ ${cbfstoolcmd} boot_stub.stock extract -n config -f config.${device} > /dev/null if [[ $? -ne 0 ]]; then echo_yellow "No valid BOOT_STUB backup found; attempting to download/extract from a shellball ROM" #download and extract from shellball ROM - curl -s -L -o /tmp/shellball.rom ${shellball_source}shellball.${device}.bin + $CURL -sLo /tmp/shellball.rom ${shellball_source}shellball.${device}.bin if [[ $? -ne 0 ]]; then exit_red "No valid BOOT_STUB backup found; error downloading shellball ROM; unable to restore stock BOOT_STUB." return 1 diff --git a/functions.sh b/functions.sh index 6c162af..efccd13 100644 --- a/functions.sh +++ b/functions.sh @@ -200,7 +200,7 @@ if [ ! -f ${cbfstoolcmd} ]; then fi #echo_yellow "Downloading cbfstool utility" - curl -sLO "${util_source}cbfstool.tar.gz" + $CURL -sLO "${util_source}cbfstool.tar.gz" if [ $? -ne 0 ]; then echo_red "Error downloading cbfstool; cannot proceed." #restore working dir @@ -258,9 +258,9 @@ if [ ! -f ${flashromcmd} ]; then if [[ "$isChromeOS" = true ]]; then #needed to avoid dependencies not found on older ChromeOS - curl -sLo "flashrom.tar.gz" "${util_source}flashrom_old.tar.gz" + $CURL -sLo "flashrom.tar.gz" "${util_source}flashrom_old.tar.gz" else - curl -sLO "${util_source}flashrom.tar.gz" + $CURL -sLO "${util_source}flashrom.tar.gz" fi if [ $? -ne 0 ]; then echo_red "Error downloading flashrom; cannot proceed." @@ -295,7 +295,7 @@ if [ ! -f ${gbbutilitycmd} ]; then working_dir=`pwd` cd /tmp - curl -sLO "${util_source}gbb_utility.tar.gz" + $CURL -sLO "${util_source}gbb_utility.tar.gz" if [ $? -ne 0 ]; then echo_red "Error downloading gbb_utility; cannot proceed." #restore working dir diff --git a/kodi.sh b/kodi.sh index a2e7650..acae8a6 100644 --- a/kodi.sh +++ b/kodi.sh @@ -51,7 +51,7 @@ img_file="${LE_version}.img" img_url="${LE_url}${img_file}.gz" cd /tmp -curl -L -o ${img_file}.gz $img_url +$CURL -Lo ${img_file}.gz $img_url if [ $? -ne 0 ]; then exit_red "Failed to download LibreELEC; check your Internet connection and try again"; return 1 fi @@ -215,7 +215,7 @@ echo_yellow "Updating bootloader" #get/extract syslinux tar_file="${util_source}${syslinux_version}.tar.bz2" -curl -s -L -o /tmp/Storage/syslinux.tar.bz2 $tar_file +$CURL -sLo /tmp/Storage/syslinux.tar.bz2 $tar_file if [ $? -ne 0 ]; then LE_install_error "Failed to download syslinux; check your Internet connection and try again" fi @@ -278,7 +278,7 @@ echo_yellow "Downloading LibreELEC" tar_file="${LE_version}.tar" tar_url="${LE_url}${tar_file}" cd /tmp/Storage -curl -L -o $tar_file $tar_url +$CURL -Lo $tar_file $tar_url if [ $? -ne 0 ]; then LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" fi @@ -435,7 +435,7 @@ echo -e "" #Install via chrx export CHRX_NO_REBOOT=1 -curl -L -s -o chrx ${chrx_url} +$CURL -sLo chrx ${chrx_url} sh ./chrx -d ${ubuntu_package} -r ${ubuntu_version} -H ChromeBox -y $kodi_install $useBeta #chrx will end with prompt for user to press enter to reboot @@ -509,7 +509,7 @@ echo_yellow "Partitions formatted and mounted; installing bootloader" #get/extract syslinux tar_file="${util_source}${syslinux_version}.tar.bz2" -curl -s -L -o /tmp/Storage/syslinux.tar.bz2 $tar_file > /dev/null 2>&1 +$CURL -sLo /tmp/Storage/syslinux.tar.bz2 $tar_file > /dev/null 2>&1 if [ $? -ne 0 ]; then LE_install_error "Failed to download syslinux; check your Internet connection and try again" fi @@ -539,7 +539,7 @@ echo_yellow "Downloading LibreELEC" tar_file="${LE_version}.tar" tar_url="${LE_url}${tar_file}" cd /tmp/Storage -curl -L -o $tar_file $tar_url +$CURL -Lo $tar_file $tar_url if [ $? -ne 0 ]; then LE_install_error "Failed to download LibreELEC; check your Internet connection and try again" fi diff --git a/setup-kodi.sh b/setup-kodi.sh index c69c408..5f06fc2 100644 --- a/setup-kodi.sh +++ b/setup-kodi.sh @@ -22,19 +22,26 @@ else cd /tmp fi +#check for cmd line param +if [[ "$1" = "-k" ]]; then + export CURL="curl -k" +else + export CURL="curl" +fi + #get support scripts echo -e "\nDownloading supporting files..." rm -rf firmware.sh >/dev/null 2>&1 rm -rf functions.sh >/dev/null 2>&1 rm -rf sources.sh >/dev/null 2>&1 rm -rf kodi.sh >/dev/null 2>&1 -curl -sLO ${script_url}firmware.sh +$CURL -sLO ${script_url}firmware.sh rc0=$? -curl -sLO ${script_url}functions.sh +$CURL -sLO ${script_url}functions.sh rc1=$? -curl -sLO ${script_url}sources.sh +$CURL -sLO ${script_url}sources.sh rc2=$? -curl -sLO ${script_url}kodi.sh +$CURL -sLO ${script_url}kodi.sh rc3=$? if [[ $rc0 -ne 0 || $rc1 -ne 0 || $rc2 -ne 0 || $rc3 -ne 0 ]]; then echo -e "Error downloading one or more required files; cannot continue" diff --git a/uefi-flash.sh b/uefi-flash.sh index 338d123..da24472 100644 --- a/uefi-flash.sh +++ b/uefi-flash.sh @@ -26,16 +26,23 @@ else cd /tmp fi +#check for cmd line param +if [[ "$1" = "-k" ]]; then + export CURL="curl -k" +else + export CURL="curl" +fi + #get support scripts echo -e "\nDownloading supporting files..." rm -rf firmware.sh >/dev/null 2>&1 rm -rf functions.sh >/dev/null 2>&1 rm -rf sources.sh >/dev/null 2>&1 -curl -sLO ${script_url}firmware.sh +$CURL -sLO ${script_url}firmware.sh rc0=$? -curl -sLO ${script_url}functions.sh +$CURL -sLO ${script_url}functions.sh rc1=$? -curl -sLO ${script_url}sources.sh +$CURL -sLO ${script_url}sources.sh rc2=$? if [[ $rc0 -ne 0 || $rc1 -ne 0 || $rc2 -ne 0 ]]; then echo -e "Error downloading one or more required files; cannot continue"