#! /bin/sh # sept 2020 # пет 04 09:12 < Fruit> ik heb een scriptje dat upstream firefox tot een .deb # vermaalt # пет 04 09:13 < joostvb> scriptje heeft zfs op buildhost nodig? # пет 04 09:13 < Fruit> nee # # van https://www.fruit.je/d/update-firefox set -e url=$(curl -sSfI 'https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US' | tr -d '\015' | awk '/^Location:/ { print $2 }') version=${url##https://*/firefox-} case $version in *[!a-zA-Z0-9-.]) echo "unable to determine version from '$version'" >&2 exit 2 ;; *.tar.gz|*.tar.bz2|*.tar.xz) compression=${version##*.} version=${version%.tar.*} ;; *) echo "unable to determine version from '$version'" >&2 exit 2 esac current=$(awk '/^Package:/ { package = $2 } /^Version:/ { version = $2 } !NF { package = ""; version = "" } { if(package == "firefox" && version != "") { print version; exit } }' /var/lib/dpkg/status) debian=${current#*-} case ${current%%-*} in "$version") echo "current upstream: $version" >&2 echo "already the latest version." >&2 exit 0 echo "currently installed: $version-$debian" >&2 debian=${debian%%[!0-9]*} case $debian in ?*) debian=$((debian + 1)) ;; *) debian=1 esac echo "would upgrade to: $version-$debian" >&2 echo -n "upgrade [Y/n]? " read -r upgrade case $upgrade in [Yy]*) exec ;; [Nn]*) exit ;; ?*) echo "arglebargle, glop-glyf?" >&2 exit ;; *) exec esac ;; *) debian=1 esac tmp=$(mktemp -d) trap 'rm -rf -- "$tmp"' EXIT INT HUP QUIT TERM cd "$tmp" curl -sSfL "$url" >"firefox-$version.orig.tar.$compression" mkdir "firefox-$version" tar xCf "firefox-$version" "firefox-$version.orig.tar.$compression" --strip-components=1 mkdir "firefox-$version/debian" cat >"firefox-$version/debian/changelog" < $(date -R) EOT echo 9 >"firefox-$version/debian/compat" cat >"firefox-$version/debian/control" <<\EOT Source: firefox Section: web Priority: optional Maintainer: Wessel Dankers Build-Depends: debhelper, libatk1.0-0, libc6, libcairo-gobject2, libcairo2, libdbus-1-3, libdbus-glib-1-2, libfontconfig1, libfreetype6, libgcc1, libgdk-pixbuf2.0-0, libglib2.0-0, libgtk-3-0, libgtk2.0-0, libpango-1.0-0, libpangocairo-1.0-0, libpangoft2-1.0-0, libstdc++6, libx11-6, libx11-xcb1, libxcb-shm0, libxcb1, libxcomposite1, libxcursor1, libxdamage1, libxext6, libxfixes3, libxi6, libxrender1, libxt6 Standards-Version: 3.9.1 Package: firefox Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Mozilla Firefox web browser (Mozilla binaries) Firefox is a powerful, extensible web browser with support for modern web application technologies. EOT cat >"firefox-$version/debian/copyright" <<\EOT Copyright: Mostly MPL. See https://www.mozilla.org for details. The Debian packaging is © 2019, Wessel Dankers and is licensed under the GPL version 3 or later, see '/usr/share/common-licenses/GPL-3'. EOT cat >"firefox-$version/debian/firefox.desktop" <<\EOT [Desktop Entry] Name=Firefox Comment=Browse the World Wide Web GenericName=Web Browser X-GNOME-FullName=Firefox Web Browser Exec=/usr/lib/firefox/firefox %u Terminal=false X-MultipleArgs=false Type=Application Icon=firefox Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; StartupWMClass=Firefox StartupNotify=true EOT cat >"firefox-$version/debian/firefox.js" <<\EOT // This is the Debian specific preferences file for Firefox // You can make any change in here, it is the purpose of this file. // You can, with this file and all files present in the // /etc/firefox directory, override any preference you can see in // about:config. // // Note that pref("name", value, locked) is allowed in these // preferences files if you don't want users to be able to override // some preferences. pref("app.update.url", "https://www.fruit.je/update/6/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%SYSTEM_CAPABILITIES%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); pref("app.update.checkInstallTime", false); pref("extensions.update.enabled", true); // Use LANG environment variable to choose locale pref("intl.locale.requested", ""); // Disable default browser checking. pref("browser.shell.checkDefaultBrowser", false); pref("browser.shell.skipDefaultBrowserCheckOnFirstRun", true); // Default to classic view for about:newtab pref("browser.newtabpage.enhanced", false, sticky); // Disable health report upload pref("datareporting.healthreport.uploadEnabled", false); // Default to no suggestions in the urlbar. This still brings a panel asking // the user whether they want to opt-in on first use. pref("browser.urlbar.suggest.searches", false); EOT cat >"firefox-$version/debian/firefox-symbolic.svg" <<\EOT newtab-firefox-gry EOT { cat <<\EOT debian/firefox.desktop usr/share/applications debian/firefox.js etc/firefox debian/firefox-symbolic.svg usr/share/icons/hicolor/symbolic/apps EOT for f in "firefox-$version"/* do file=${f#*/} case $file in debian|*[$IFS]*) ;; *) echo "$file usr/lib/firefox" esac done } >"firefox-$version/debian/install" cat >"firefox-$version/debian/links" <<\EOT usr/lib/firefox/firefox usr/bin/firefox usr/lib/firefox/browser/chrome/icons/default/default16.png usr/share/icons/hicolor/16x16/apps/firefox.png usr/lib/firefox/browser/chrome/icons/default/default32.png usr/share/icons/hicolor/32x32/apps/firefox.png usr/lib/firefox/browser/chrome/icons/default/default48.png usr/share/icons/hicolor/48x48/apps/firefox.png usr/lib/firefox/browser/chrome/icons/default/default64.png usr/share/icons/hicolor/64x64/apps/firefox.png usr/lib/firefox/browser/chrome/icons/default/default128.png usr/share/icons/hicolor/128x128/apps/firefox.png EOT cat >"firefox-$version/debian/rules" <<\EOT #! /usr/bin/make -f %: exec dh $@ EOT chmod 755 "firefox-$version/debian/rules" ( cd "firefox-$version" debuild -us -uc -b ) sudo eatmydata dpkg --unpack firefox_$version-${debian}_amd64.deb sudo eatmydata apt-get -f install