Skip to content

Instantly share code, notes, and snippets.

@CvH
Last active November 17, 2022 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CvH/722fe6466553538be11910ae5f131ed3 to your computer and use it in GitHub Desktop.
Save CvH/722fe6466553538be11910ae5f131ed3 to your computer and use it in GitHub Desktop.
Download latest version of Firefox, LibreOffice, Acrobat Reader, 7Zip, Paint.net and Notepad++
#!/bin/bash
# requires curl and jq
DL_PATH="/var/www/"
download() {
wget --show-progress -N -q --directory-prefix="${DL_PATH}/${FOLDERNAME}" "$1"
}
download_notification() {
echo -e "\n--------------------------------------------------\n"
echo -e "checking ${FOLDERNAME}\n"
}
dl_acrobat() {
local FOLDERNAME="Adobe Acrobat Reader"
download_notification
ACROBAT_VERSION="$(curl -sS https://helpx.adobe.com/acrobat/release-note/release-notes-acrobat-reader.html | grep -oE "[0-9]{2,}+\.[0-9]{3,}+\.[0-9]{4,}+" | head -1)"
download "https://ardownload2.adobe.com/pub/adobe/acrobat/win/AcrobatDC/${ACROBAT_VERSION//./}/AcroRdrDCx64${ACROBAT_VERSION//./}_de_DE.exe"
}
dl_firefox() {
local FOLDERNAME="Firefox"
download_notification
FIREFOX_VERSION="$(wget --spider -S --max-redirect 0 "https://download.mozilla.org/?product=firefox-msi-latest-ssl&os=win64&lang=de" 2>&1 | grep -oE "https://.*/releases/.*/Firefox.*Setup.*.msi" | head -1)"
download "${FIREFOX_VERSION}"
}
dl_notepad() {
local FOLDERNAME="Notepad++"
download_notification
NOTEPAD_VERSION="$(curl https://api.github.com/repos/notepad-plus-plus/notepad-plus-plus/releases/latest -s | jq .name -r | grep -oE "[0-9.]+")"
download "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v${NOTEPAD_VERSION}/npp.${NOTEPAD_VERSION}.Installer.x64.exe"
}
dl_7zip() {
local FOLDERNAME="7Zip"
download_notification
ZIP_VERSION="$(curl -sS https://www.7-zip.org/download.html | grep -oE "7z[0-9]+-x64.exe" | head -1)"
download "https://www.7-zip.org/a/${ZIP_VERSION}"
}
dl_paintnet() {
local FOLDERNAME="Paint.net"
download_notification
PAINTNET_VERSION="$(curl https://api.github.com/repos/paintdotnet/release/releases/latest -s | jq .name -r | grep -oE "[0-9.]+")"
download "https://github.com/paintdotnet/release/releases/download/v${PAINTNET_VERSION}/paint.net.${PAINTNET_VERSION}.install.x64.zip"
}
dl_libreoffice() {
local FOLDERNAME="LibreOffice"
download_notification
LIBREOFFICE_VERSION="$(curl -sSL https://download.documentfoundation.org/libreoffice/stable/ | grep -oP '(?<=href=")\d{1,2}.\d{1,2}.\d{1,2}.*(?=/")' | head -n1)"
download "https://download.documentfoundation.org/libreoffice/stable/${LIBREOFFICE_VERSION}/win/x86_64/LibreOffice_${LIBREOFFICE_VERSION}_Win_x64.msi"
}
dl_acrobat
dl_firefox
dl_notepad
dl_7zip
dl_paintnet
dl_libreoffice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment