#Packager: Dimitris Tzemos # # Make sure you delete all *.xpi files from the source directory before # creating a package for a new firefox version pkgname=mozilla-firefox #pkgver=130.0 pkgver=${pkgver:-$(wget --spider -S --max-redirect 0 "https://download.mozilla.org/?product=firefox-latest&os=linux${LIBDIRSUFFIX}&lang=en-US" 2>&1 | sed -n '/Location: /{s|.*/firefox-\(.*\)\.tar.*|\1|p;q;}')} #_majorver=`echo $pkgver | sed "s/\(.*\)\.\(.*\)\.\(.*\)esr/\1esr/"` #_majorver=$pkgver pkgrel=1dj arch=${arch:-x86_64} source=("https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-$arch/en-US/firefox-$pkgver.tar.bz2" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/ar.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/bg.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/cs.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/da.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/de.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/en-US.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/el.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/es-AR.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/es-CL.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/es-ES.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/es-MX.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/fi.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/fr.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/he.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/hu.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/it.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/ja.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/lv.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/nb-NO.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/nl.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/pl.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/pt-BR.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/pt-PT.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/ro.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/ru.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/sv-SE.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/tr.xpi" "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$pkgver/linux-i686/xpi/uk.xpi" "mozilla-firefox.desktop" "slackel.js" "firefox.cfg" "policies.json") docs=("readme.txt" "install" "copying" "changelog" "authors" "news" "todo") options=('noextract') # Don't start repackaging if the same version is already installed if (/bin/ls /var/log/packages/$pkgname-$pkgver-$arch-*.txz >/dev/null 2>&1 ) || (/bin/ls $pkgname-$pkgver-$arch-*.txz >/dev/null 2>&1) ; then echo "Firefox ($pkgver) is already installed; exiting" exit 0 fi doinst() { # update the mime desktop database if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q fi # update the mime database if [ -x /usr/bin/update-mime-database ]; then /usr/bin/update-mime-database usr/share/mime > /dev/null 2>&1 fi # glib schemas if [ -x /usr/bin/glib-compile-schemas ]; then /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas > /dev/null 2>&1 fi } slackdesc=\ ( #|-----handy-ruler------------------------------------------------------| "mozilla-firefox (safe and easy web browser from Mozilla)" "Firefox delivers safe, easy web browsing. A familiar user interface," "enhanced security features including protection from online identity" "theft, and integrated search let you get the most out of the web." ) build() { MOZ_ALLOW_DOWNGRADE=${MOZ_ALLOW_DOWNGRADE:-YES} # extract the firefox tarball cd $startdir/src tar xf firefox-$pkgver.tar.bz2 cd $startdir/src/firefox mkdir -p $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox cp -R ./* $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/ mkdir -p $startdir/pkg/usr/bin mkdir -p $startdir/pkg/usr/share/applications cp $startdir/src/mozilla-firefox.desktop $startdir/pkg/usr/share/applications/ mkdir -p $startdir/pkg/usr/share/icons/hicolor/{16x16,32x32,48x48,128x128}/apps cp $startdir/src/firefox/browser/chrome/icons/default/default16.png $startdir/pkg/usr/share/icons/hicolor/16x16/apps/firefox.png cp $startdir/src/firefox/browser/chrome/icons/default/default32.png $startdir/pkg/usr/share/icons/hicolor/32x32/apps/firefox.png cp $startdir/src/firefox/browser/chrome/icons/default/default48.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/firefox.png cp $startdir/src/firefox/browser/chrome/icons/default/default128.png $startdir/pkg/usr/share/icons/hicolor/128x128/apps/firefox.png # configuration mkdir -p $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/distribution cp $startdir/src/policies.json $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/distribution/ cp $startdir/src/slackel.js $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/defaults/pref/ cp $startdir/src/firefox.cfg $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/ # locales mkdir -p $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/distribution/extensions for locale in `basename -a -s ".xpi" $startdir/src/*.xpi`; do cp $startdir/src/${locale}.xpi $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/distribution/extensions/langpack-${locale}\@firefox.mozilla.org.xpi done # If MOZ_ALLOW_DOWNGRADE=YES, replace the /usr/bin/firefox symlink with a # shell script that sets the MOZ_ALLOW_DOWNGRADE=1 environment variable so # that a detected browser downgrade does not reset the user profile: if [ "$MOZ_ALLOW_DOWNGRADE" = "YES" ]; then rm -f $startdir/pkg/usr/bin/firefox cat << EOF > $startdir/pkg/usr/bin/firefox #!/bin/sh # # Shell script to start Mozilla Firefox. # # Don't reset the user profile on a detected browser downgrade: export MOZ_ALLOW_DOWNGRADE=1 # Start Firefox: exec /usr/lib${LIBDIRSUFFIX}/firefox/firefox "\$@" EOF chown root:root $startdir/pkg/usr/bin/firefox chmod 755 $startdir/pkg/usr/bin/firefox fi # Fix duplicate binary, https://bugzilla.mozilla.org/show_bug.cgi?id=658850 ( cd $startdir/pkg/usr/lib$LIBDIRSUFFIX/firefox if cmp firefox firefox-bin ; then ln -sf firefox-bin firefox fi ) mkdir -p $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/browser/extensions/ mkdir -p $startdir/pkg/usr/lib${LIBDIRSUFFIX}/mozilla/plugins ( cd $startdir/pkg/usr/lib${LIBDIRSUFFIX}/firefox/browser ln -s ../../mozilla/plugins plugins ) #echo mozilla-firefox-esr > $startdir/$pkgname-$pkgver-$arch-$pkgrel.con }