From 0c4ea701a4221bfd0baac8aa211e31e99e5b9ab1 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 23 Dec 2018 12:01:24 -0500 Subject: initial commit --- Makefile | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ install-firefox | 1 + 2 files changed, 195 insertions(+) create mode 100755 Makefile create mode 120000 install-firefox diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..3f7b6d9 --- /dev/null +++ b/Makefile @@ -0,0 +1,194 @@ +#!/usr/bin/make -f +ifeq (beta,$(MAKECMDGOALS)) +product=-beta +else +ifeq (nightly,$(MAKECMDGOALS)) +product=-nightly +else +ifeq (stable,$(MAKECMDGOALS)) +product= +else +ifeq (,$(MAKECMDGOALS)) +product= +else +$(error Incorrect target specified. Specify at most one argument of "beta", "nightly", or "stable") +endif +endif +endif +endif + +ifneq (0,$(shell id -u)) +optdir=$(HOME)/.local/opt +applications_dir=$(HOME)/.local/share/applications +$(warning Warning: You are not root. Installing into $(optdir)) +else +optdir=/opt +applications_dir=/usr/share/applications +endif + +os=linux64 +lang=en-US +orig_url="https://download.mozilla.org/?product=firefox$(product)-latest-ssl&os=$(os)&lang=$(lang)" + +url := $(shell curl -sI $(orig_url) | sed -n 's/^Location: //p') +$(if $(url),,$(error Could not determine url. orig_url=$(orig_url))) + +# Use a path that only trusted users can write into. So not /tmp. +dldir=$(optdir) + +tarball=$(dldir)/$(notdir $(url)) +destdir=$(optdir)/$(notdir $(tarball:.tar.bz2=)) +tempdir=$(destdir)~tmp + +symlink=$(optdir)/firefox +desktop_file=$(applications_dir)/firefox.desktop +global_symlink=/usr/local/bin/firefox + +.DEFAULT_GOAL = install + +.PHONY: install $(desktop_file) $(global_symlink) alternatives beta nightly stable $(symlink) + +install: $(symlink) $(desktop_file) $(global_symlink) alternatives + +$(global_symlink): + mkdir -p $(dir $@) + ln -sf $(optdir)/firefox/firefox $(dir $@) + +alternatives: + update-alternatives --install /usr/bin/x-www-browser x-www-browser $(optdir)/firefox/firefox 200 + update-alternatives --set x-www-browser $(optdir)/firefox/firefox + +$(desktop_file): + : write file $@ $(file >$@,$(desktop_file_contents)) + +$(symlink): $(destdir) + cd $(dir $@) && ln -sf $(notdir $(destdir)) $(notdir $@) + +beta nightly stable: install + +$(destdir): $(tarball) + mkdir -p $(tempdir) + tar -C $(tempdir) --strip-components=1 -jxf $< + mv $(tempdir) $(destdir) + rm $(tarball) || true + +.INTERMEDIATE: $(tarball) + +$(tarball): + mkdir -p $(dir $@) + curl -C- -o $@.partial $(url) + mv $@.partial $@ + +FIREFOX_DIR=$(optdir)/firefox +FIREFOX_EXEC=$(FIREFOX_DIR)/firefox +FIREFOX_ICON=$(FIREFOX_DIR)/browser/chrome/icons/default/default128.png + +firefox.desktop: + : $(file > $(desktop_file_contents)) + +define desktop_file_contents +[Desktop Entry] +Name=Firefox +Name[bg]=Firefox +Name[ca]=Firefox +Name[cs]=Firefox +Name[el]=Firefox +Name[es]=Firefox +Name[fa]=Firefox +Name[fi]=Firefox +Name[fr]=Firefox +Name[hu]=Firefox +Name[it]=Firefox +Name[ja]=Firefox +Name[ko]=Firefox +Name[nb]=Firefox +Name[nl]=Firefox +Name[nn]=Firefox +Name[no]=Firefox +Name[pl]=Firefox +Name[pt]=Firefox +Name[pt_BR]=Firefox +Name[ru]=Firefox +Name[sk]=Firefox +Name[sv]=Firefox +Comment=Browse the World Wide Web +Comment[bg]=Сърфиране в Мрежата +Comment[ca]=Navegueu per el web +Comment[cs]=Prohlížení stránek World Wide Webu +Comment[de]=Im Internet surfen +Comment[el]=Περιηγηθείτε στον παγκόσμιο ιστό +Comment[es]=Navegue por la web +Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید +Comment[fi]=Selaa Internetin WWW-sivuja +Comment[fr]=Navigue sur Internet +Comment[hu]=A világháló böngészése +Comment[it]=Esplora il web +Comment[ja]=ウェブを閲覧します +Comment[ko]=웹을 돌아 다닙니다 +Comment[nb]=Surf på nettet +Comment[nl]=Verken het internet +Comment[nn]=Surf på nettet +Comment[no]=Surf på nettet +Comment[pl]=Przeglądanie stron WWW +Comment[pt]=Navegue na Internet +Comment[pt_BR]=Navegue na Internet +Comment[ru]=Обозреватель Всемирной Паутины +Comment[sk]=Prehliadanie internetu +Comment[sv]=Surfa på webben +GenericName=Web Browser +GenericName[bg]=Интернет браузър +GenericName[ca]=Navegador web +GenericName[cs]=Webový prohlížeč +GenericName[de]=Webbrowser +GenericName[el]=Περιηγητής ιστού +GenericName[es]=Navegador web +GenericName[fa]=مرورگر اینترنتی +GenericName[fi]=WWW-selain +GenericName[fr]=Navigateur Web +GenericName[hu]=Webböngésző +GenericName[it]=Browser Web +GenericName[ja]=ウェブ・ブラウザ +GenericName[ko]=웹 브라우저 +GenericName[nb]=Nettleser +GenericName[nl]=Webbrowser +GenericName[nn]=Nettlesar +GenericName[no]=Nettleser +GenericName[pl]=Przeglądarka WWW +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador Web +GenericName[ru]=Интернет-браузер +GenericName[sk]=Internetový prehliadač +GenericName[sv]=Webbläsare +X-GNOME-FullName=Firefox Web Browser +X-GNOME-FullName[bg]=Интернет браузър (Firefox) +X-GNOME-FullName[ca]=Navegador web Firefox +X-GNOME-FullName[cs]=Firefox Webový prohlížeč +X-GNOME-FullName[el]=Περιηγήτης Ιστού Firefox +X-GNOME-FullName[es]=Navegador web Firefox +X-GNOME-FullName[fa]=مرورگر اینترنتی Firefox +X-GNOME-FullName[fi]=Firefox-selain +X-GNOME-FullName[fr]=Navigateur Web Firefox +X-GNOME-FullName[hu]=Firefox webböngésző +X-GNOME-FullName[it]=Firefox Browser Web +X-GNOME-FullName[ja]=Firefox ウェブ・ブラウザ +X-GNOME-FullName[ko]=Firefox 웹 브라우저 +X-GNOME-FullName[nb]=Firefox Nettleser +X-GNOME-FullName[nl]=Firefox webbrowser +X-GNOME-FullName[nn]=Firefox Nettlesar +X-GNOME-FullName[no]=Firefox Nettleser +X-GNOME-FullName[pl]=Przeglądarka WWW Firefox +X-GNOME-FullName[pt]=Firefox Navegador Web +X-GNOME-FullName[pt_BR]=Navegador Web Firefox +X-GNOME-FullName[ru]=Интернет-браузер Firefox +X-GNOME-FullName[sk]=Internetový prehliadač Firefox +X-GNOME-FullName[sv]=Webbläsaren Firefox +Exec=$(FIREFOX_EXEC) %u +Terminal=false +X-MultipleArgs=false +Type=Application +Icon=$(FIREFOX_ICON) +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 +endef diff --git a/install-firefox b/install-firefox new file mode 120000 index 0000000..33ceb8f --- /dev/null +++ b/install-firefox @@ -0,0 +1 @@ +Makefile \ No newline at end of file -- cgit v1.2.3