diff options
author | Andrew Cady <d@jerkface.net> | 2018-12-23 12:01:24 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2018-12-23 12:01:24 -0500 |
commit | 0c4ea701a4221bfd0baac8aa211e31e99e5b9ab1 (patch) | |
tree | edd3f851f82ab7d379a0050abe15dd570ab27e33 |
initial commit
-rwxr-xr-x | Makefile | 194 | ||||
l--------- | install-firefox | 1 |
2 files changed, 195 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..3f7b6d9 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,194 @@ | |||
1 | #!/usr/bin/make -f | ||
2 | ifeq (beta,$(MAKECMDGOALS)) | ||
3 | product=-beta | ||
4 | else | ||
5 | ifeq (nightly,$(MAKECMDGOALS)) | ||
6 | product=-nightly | ||
7 | else | ||
8 | ifeq (stable,$(MAKECMDGOALS)) | ||
9 | product= | ||
10 | else | ||
11 | ifeq (,$(MAKECMDGOALS)) | ||
12 | product= | ||
13 | else | ||
14 | $(error Incorrect target specified. Specify at most one argument of "beta", "nightly", or "stable") | ||
15 | endif | ||
16 | endif | ||
17 | endif | ||
18 | endif | ||
19 | |||
20 | ifneq (0,$(shell id -u)) | ||
21 | optdir=$(HOME)/.local/opt | ||
22 | applications_dir=$(HOME)/.local/share/applications | ||
23 | $(warning Warning: You are not root. Installing into $(optdir)) | ||
24 | else | ||
25 | optdir=/opt | ||
26 | applications_dir=/usr/share/applications | ||
27 | endif | ||
28 | |||
29 | os=linux64 | ||
30 | lang=en-US | ||
31 | orig_url="https://download.mozilla.org/?product=firefox$(product)-latest-ssl&os=$(os)&lang=$(lang)" | ||
32 | |||
33 | url := $(shell curl -sI $(orig_url) | sed -n 's/^Location: //p') | ||
34 | $(if $(url),,$(error Could not determine url. orig_url=$(orig_url))) | ||
35 | |||
36 | # Use a path that only trusted users can write into. So not /tmp. | ||
37 | dldir=$(optdir) | ||
38 | |||
39 | tarball=$(dldir)/$(notdir $(url)) | ||
40 | destdir=$(optdir)/$(notdir $(tarball:.tar.bz2=)) | ||
41 | tempdir=$(destdir)~tmp | ||
42 | |||
43 | symlink=$(optdir)/firefox | ||
44 | desktop_file=$(applications_dir)/firefox.desktop | ||
45 | global_symlink=/usr/local/bin/firefox | ||
46 | |||
47 | .DEFAULT_GOAL = install | ||
48 | |||
49 | .PHONY: install $(desktop_file) $(global_symlink) alternatives beta nightly stable $(symlink) | ||
50 | |||
51 | install: $(symlink) $(desktop_file) $(global_symlink) alternatives | ||
52 | |||
53 | $(global_symlink): | ||
54 | mkdir -p $(dir $@) | ||
55 | ln -sf $(optdir)/firefox/firefox $(dir $@) | ||
56 | |||
57 | alternatives: | ||
58 | update-alternatives --install /usr/bin/x-www-browser x-www-browser $(optdir)/firefox/firefox 200 | ||
59 | update-alternatives --set x-www-browser $(optdir)/firefox/firefox | ||
60 | |||
61 | $(desktop_file): | ||
62 | : write file $@ $(file >$@,$(desktop_file_contents)) | ||
63 | |||
64 | $(symlink): $(destdir) | ||
65 | cd $(dir $@) && ln -sf $(notdir $(destdir)) $(notdir $@) | ||
66 | |||
67 | beta nightly stable: install | ||
68 | |||
69 | $(destdir): $(tarball) | ||
70 | mkdir -p $(tempdir) | ||
71 | tar -C $(tempdir) --strip-components=1 -jxf $< | ||
72 | mv $(tempdir) $(destdir) | ||
73 | rm $(tarball) || true | ||
74 | |||
75 | .INTERMEDIATE: $(tarball) | ||
76 | |||
77 | $(tarball): | ||
78 | mkdir -p $(dir $@) | ||
79 | curl -C- -o $@.partial $(url) | ||
80 | mv $@.partial $@ | ||
81 | |||
82 | FIREFOX_DIR=$(optdir)/firefox | ||
83 | FIREFOX_EXEC=$(FIREFOX_DIR)/firefox | ||
84 | FIREFOX_ICON=$(FIREFOX_DIR)/browser/chrome/icons/default/default128.png | ||
85 | |||
86 | firefox.desktop: | ||
87 | : $(file > $(desktop_file_contents)) | ||
88 | |||
89 | define desktop_file_contents | ||
90 | [Desktop Entry] | ||
91 | Name=Firefox | ||
92 | Name[bg]=Firefox | ||
93 | Name[ca]=Firefox | ||
94 | Name[cs]=Firefox | ||
95 | Name[el]=Firefox | ||
96 | Name[es]=Firefox | ||
97 | Name[fa]=Firefox | ||
98 | Name[fi]=Firefox | ||
99 | Name[fr]=Firefox | ||
100 | Name[hu]=Firefox | ||
101 | Name[it]=Firefox | ||
102 | Name[ja]=Firefox | ||
103 | Name[ko]=Firefox | ||
104 | Name[nb]=Firefox | ||
105 | Name[nl]=Firefox | ||
106 | Name[nn]=Firefox | ||
107 | Name[no]=Firefox | ||
108 | Name[pl]=Firefox | ||
109 | Name[pt]=Firefox | ||
110 | Name[pt_BR]=Firefox | ||
111 | Name[ru]=Firefox | ||
112 | Name[sk]=Firefox | ||
113 | Name[sv]=Firefox | ||
114 | Comment=Browse the World Wide Web | ||
115 | Comment[bg]=Сърфиране в Мрежата | ||
116 | Comment[ca]=Navegueu per el web | ||
117 | Comment[cs]=Prohlížení stránek World Wide Webu | ||
118 | Comment[de]=Im Internet surfen | ||
119 | Comment[el]=Περιηγηθείτε στον παγκόσμιο ιστό | ||
120 | Comment[es]=Navegue por la web | ||
121 | Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید | ||
122 | Comment[fi]=Selaa Internetin WWW-sivuja | ||
123 | Comment[fr]=Navigue sur Internet | ||
124 | Comment[hu]=A világháló böngészése | ||
125 | Comment[it]=Esplora il web | ||
126 | Comment[ja]=ウェブを閲覧します | ||
127 | Comment[ko]=웹을 돌아 다닙니다 | ||
128 | Comment[nb]=Surf på nettet | ||
129 | Comment[nl]=Verken het internet | ||
130 | Comment[nn]=Surf på nettet | ||
131 | Comment[no]=Surf på nettet | ||
132 | Comment[pl]=Przeglądanie stron WWW | ||
133 | Comment[pt]=Navegue na Internet | ||
134 | Comment[pt_BR]=Navegue na Internet | ||
135 | Comment[ru]=Обозреватель Всемирной Паутины | ||
136 | Comment[sk]=Prehliadanie internetu | ||
137 | Comment[sv]=Surfa på webben | ||
138 | GenericName=Web Browser | ||
139 | GenericName[bg]=Интернет браузър | ||
140 | GenericName[ca]=Navegador web | ||
141 | GenericName[cs]=Webový prohlížeč | ||
142 | GenericName[de]=Webbrowser | ||
143 | GenericName[el]=Περιηγητής ιστού | ||
144 | GenericName[es]=Navegador web | ||
145 | GenericName[fa]=مرورگر اینترنتی | ||
146 | GenericName[fi]=WWW-selain | ||
147 | GenericName[fr]=Navigateur Web | ||
148 | GenericName[hu]=Webböngésző | ||
149 | GenericName[it]=Browser Web | ||
150 | GenericName[ja]=ウェブ・ブラウザ | ||
151 | GenericName[ko]=웹 브라우저 | ||
152 | GenericName[nb]=Nettleser | ||
153 | GenericName[nl]=Webbrowser | ||
154 | GenericName[nn]=Nettlesar | ||
155 | GenericName[no]=Nettleser | ||
156 | GenericName[pl]=Przeglądarka WWW | ||
157 | GenericName[pt]=Navegador Web | ||
158 | GenericName[pt_BR]=Navegador Web | ||
159 | GenericName[ru]=Интернет-браузер | ||
160 | GenericName[sk]=Internetový prehliadač | ||
161 | GenericName[sv]=Webbläsare | ||
162 | X-GNOME-FullName=Firefox Web Browser | ||
163 | X-GNOME-FullName[bg]=Интернет браузър (Firefox) | ||
164 | X-GNOME-FullName[ca]=Navegador web Firefox | ||
165 | X-GNOME-FullName[cs]=Firefox Webový prohlížeč | ||
166 | X-GNOME-FullName[el]=Περιηγήτης Ιστού Firefox | ||
167 | X-GNOME-FullName[es]=Navegador web Firefox | ||
168 | X-GNOME-FullName[fa]=مرورگر اینترنتی Firefox | ||
169 | X-GNOME-FullName[fi]=Firefox-selain | ||
170 | X-GNOME-FullName[fr]=Navigateur Web Firefox | ||
171 | X-GNOME-FullName[hu]=Firefox webböngésző | ||
172 | X-GNOME-FullName[it]=Firefox Browser Web | ||
173 | X-GNOME-FullName[ja]=Firefox ウェブ・ブラウザ | ||
174 | X-GNOME-FullName[ko]=Firefox 웹 브라우저 | ||
175 | X-GNOME-FullName[nb]=Firefox Nettleser | ||
176 | X-GNOME-FullName[nl]=Firefox webbrowser | ||
177 | X-GNOME-FullName[nn]=Firefox Nettlesar | ||
178 | X-GNOME-FullName[no]=Firefox Nettleser | ||
179 | X-GNOME-FullName[pl]=Przeglądarka WWW Firefox | ||
180 | X-GNOME-FullName[pt]=Firefox Navegador Web | ||
181 | X-GNOME-FullName[pt_BR]=Navegador Web Firefox | ||
182 | X-GNOME-FullName[ru]=Интернет-браузер Firefox | ||
183 | X-GNOME-FullName[sk]=Internetový prehliadač Firefox | ||
184 | X-GNOME-FullName[sv]=Webbläsaren Firefox | ||
185 | Exec=$(FIREFOX_EXEC) %u | ||
186 | Terminal=false | ||
187 | X-MultipleArgs=false | ||
188 | Type=Application | ||
189 | Icon=$(FIREFOX_ICON) | ||
190 | Categories=Network;WebBrowser; | ||
191 | 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; | ||
192 | StartupWMClass=Firefox | ||
193 | StartupNotify=true | ||
194 | 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 | |||