From 8f9255cacd07735c900039c86a87cb95022ce38a Mon Sep 17 00:00:00 2001 From: fiftydinar <65243233+fiftydinar@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:10:52 +0200 Subject: [PATCH] chore: Make `curl` commands clearer & more standardized --- modules/brew/brew.sh | 2 +- modules/chezmoi/chezmoi.sh | 2 +- modules/fonts/sources/google-fonts.sh | 2 +- modules/fonts/sources/nerd-fonts.sh | 2 +- modules/gnome-extensions/gnome-extensions.sh | 4 ++-- modules/rpm-ostree/rpm-ostree.sh | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/brew/brew.sh b/modules/brew/brew.sh index 06fbc23..c343b1b 100644 --- a/modules/brew/brew.sh +++ b/modules/brew/brew.sh @@ -75,7 +75,7 @@ touch /.dockerenv # Always install Brew echo "Downloading and installing Brew..." -curl -sfLo /tmp/brew-install https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh +curl -fLs https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o /tmp/brew-install echo "Downloaded Brew install script" chmod +x /tmp/brew-install /tmp/brew-install diff --git a/modules/chezmoi/chezmoi.sh b/modules/chezmoi/chezmoi.sh index 5c1f0d9..201d52f 100644 --- a/modules/chezmoi/chezmoi.sh +++ b/modules/chezmoi/chezmoi.sh @@ -93,7 +93,7 @@ else echo "Checking if curl is installed and executable at /usr/bin/curl" if [ -x /usr/bin/curl ]; then echo "Downloading chezmoi binary from the latest Github release" - /usr/bin/curl -fLs https://github.com/twpayne/chezmoi/releases/latest/download/chezmoi-linux-amd64 -o /usr/bin/chezmoi + /usr/bin/curl -fLs --create-dirs https://github.com/twpayne/chezmoi/releases/latest/download/chezmoi-linux-amd64 -o /usr/bin/chezmoi echo "Downloaded chezmoi binary and installed into /usr/bin" echo "Ensuring chezmoi is executable" /usr/bin/chmod 755 /usr/bin/chezmoi diff --git a/modules/fonts/sources/google-fonts.sh b/modules/fonts/sources/google-fonts.sh index 38a9f8c..2aad554 100644 --- a/modules/fonts/sources/google-fonts.sh +++ b/modules/fonts/sources/google-fonts.sh @@ -31,7 +31,7 @@ for FONT in "${FONTS[@]}"; do if FILENAME=$(echo "${FILE_REF}" | jq -er '.filename' 2>/dev/null); then if URL=$(echo "${FILE_REF}" | jq -er '.url' 2>/dev/null); then echo "Downloading ${FILENAME} from ${URL}" - curl "${URL}" -sfo "${DEST}/${FONT}/${FILENAME##*/}" # everything before the last / is removed to get the filename + curl -fLs --create-dirs "${URL}" -o "${DEST}/${FONT}/${FILENAME##*/}" # everything before the last / is removed to get the filename echo "Downloaded ${FILENAME}" else echo "Failed to extract URLs for: ${FONT}" >&2 diff --git a/modules/fonts/sources/nerd-fonts.sh b/modules/fonts/sources/nerd-fonts.sh index c5550b8..18cb1db 100644 --- a/modules/fonts/sources/nerd-fonts.sh +++ b/modules/fonts/sources/nerd-fonts.sh @@ -15,7 +15,7 @@ for FONT in "${FONTS[@]}"; do mkdir -p "${DEST}/${FONT}" echo "Downloading ${FONT} from ${URL}/${FONT}.tar.xz" - curl "${URL}/${FONT}.tar.xz" -sfL -o "/tmp/fonts/${FONT}.tar.xz" + curl -fLs --create-dirs "${URL}/${FONT}.tar.xz" -o "/tmp/fonts/${FONT}.tar.xz" echo "Downloaded ${FONT}" tar -xf "/tmp/fonts/${FONT}.tar.xz" -C "${DEST}/${FONT}" diff --git a/modules/gnome-extensions/gnome-extensions.sh b/modules/gnome-extensions/gnome-extensions.sh index ef6b35f..9f40ae4 100644 --- a/modules/gnome-extensions/gnome-extensions.sh +++ b/modules/gnome-extensions/gnome-extensions.sh @@ -56,7 +56,7 @@ if [[ ${#INSTALL[@]} -gt 0 ]]; then echo "Installing ${EXTENSION} Gnome extension with version ${VERSION}" # Download archive echo "Downloading ZIP archive ${URL}" - curl -fs -o "${ARCHIVE_DIR}" "${URL}" + curl -fLs --create-dirs "${URL}" -o "${ARCHIVE_DIR}" echo "Downloaded ZIP archive ${URL}" # Extract archive echo "Extracting ZIP archive" @@ -185,7 +185,7 @@ if [[ ${#INSTALL[@]} -gt 0 ]] && ! "${LEGACY}"; then echo "Installing '${EXT_NAME}' Gnome extension with version ${SUITABLE_VERSION}" # Download archive echo "Downloading ZIP archive ${URL}" - curl -fs -o "${ARCHIVE_DIR}" "${URL}" + curl -fLs --create-dirs "${URL}" -o "${ARCHIVE_DIR}" echo "Downloaded ZIP archive ${URL}" # Extract archive echo "Extracting ZIP archive" diff --git a/modules/rpm-ostree/rpm-ostree.sh b/modules/rpm-ostree/rpm-ostree.sh index dcd49e9..cfdc813 100644 --- a/modules/rpm-ostree/rpm-ostree.sh +++ b/modules/rpm-ostree/rpm-ostree.sh @@ -15,7 +15,7 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then REPO_URL="${REPO//[$'\t\r\n ']}" echo "Downloading repo file ${REPO_URL}" - curl -fs --output-dir "/etc/yum.repos.d/" -O "${REPO_URL}" + curl -fLs --create-dirs -O "${REPO_URL}" --output-dir "/etc/yum.repos.d/" echo "Downloaded repo file ${REPO_URL}" elif [[ "${REPO}" =~ ^https?:\/\/.* ]] && [[ "${REPO}" != "https://copr.fedorainfracloud.org/coprs/"* ]]; then REPO_URL="${REPO//[$'\t\r\n ']}" @@ -23,7 +23,7 @@ if [[ ${#REPOS[@]} -gt 0 ]]; then CLEAN_REPO_NAME="${CLEAN_REPO_NAME//\//.}" echo "Downloading repo file ${REPO_URL}" - curl -fs -o "/etc/yum.repos.d/${CLEAN_REPO_NAME}" "${REPO_URL}" + curl -fLs --create-dirs "${REPO_URL}" -o "/etc/yum.repos.d/${CLEAN_REPO_NAME}" echo "Downloaded repo file ${REPO_URL}" elif [[ ! "${REPO}" =~ ^https?:\/\/.* ]] && [[ "${REPO}" == *".repo" ]] && [[ -f "${CONFIG_DIRECTORY}/rpm-ostree/${REPO}" ]]; then cp "${CONFIG_DIRECTORY}/rpm-ostree/${REPO}" "/etc/yum.repos.d/${REPO##*/}" @@ -170,7 +170,7 @@ if [[ ${#REPLACE[@]} -gt 0 ]]; then REPO_URL="${REPO//[$'\t\r\n ']}" echo "Downloading repo file ${REPO_URL}" - curl -fs --output-dir "/etc/yum.repos.d/" -O "${REPO_URL}" + curl -fLs --create-dirs -O "${REPO_URL}" --output-dir "/etc/yum.repos.d/" echo "Downloaded repo file ${REPO_URL}" rpm-ostree override replace --experimental --from "repo=copr:copr.fedorainfracloud.org:${MAINTAINER}:${REPO_NAME}" "${REPLACE_STR}"