aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2019-09-16 05:38:18 +0000
committerRob Austein <sra@hactrn.net>2019-09-16 05:38:18 +0000
commit08b13cc74dde895fe4402a7d04c2180809bc87c7 (patch)
tree45a395f3299d41c606718b773f238106960b8f3f
parentb7434629d7955957eb393b55516ab8de59133e76 (diff)
Horrible kludge to preconfigure jnlp application
-rw-r--r--Dockerfile10
-rw-r--r--README.md43
-rw-r--r--handlers.json1
-rwxr-xr-xstartup.sh13
4 files changed, 21 insertions, 46 deletions
diff --git a/Dockerfile b/Dockerfile
index b8e7f75..b885efe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,8 @@
FROM ubuntu:bionic
+COPY waterfox*.tar.bz2 jre-*.tar.gz /root/
+
RUN apt-get --yes update && apt-get --yes install --no-install-recommends \
bzip2 \
fonts-droid-fallback \
@@ -16,10 +18,6 @@ RUN apt-get --yes update && apt-get --yes install --no-install-recommends \
x11-xserver-utils \
xterm
-COPY startup.sh waterfox*.tar.bz2 jre-*.tar.gz /root/
-COPY icewm.menu /root/.icewm/menu
-COPY ratpoisonrc /root/.ratpoisonrc
-
RUN set -x; \
mkdir -p /usr/local/java && \
tar -C /usr/local -xf /root/waterfox*.tar.bz2 && \
@@ -34,6 +32,10 @@ RUN set -x; \
update-alternatives --set javaws /usr/local/java/jre*/bin/javaws && \
ln -s /usr/local/waterfox/waterfox /usr/local/bin
+COPY startup.sh handlers.json /root/
+COPY icewm.menu /root/.icewm/menu
+COPY ratpoisonrc /root/.ratpoisonrc
+
CMD ["/root/startup.sh"]
WORKDIR /root
diff --git a/README.md b/README.md
index 6f7082c..ca4e514 100644
--- a/README.md
+++ b/README.md
@@ -44,43 +44,6 @@ https://ipmi.foo.example.org
https://ipmi.bar.example.org
```
-There's probably some way to preset Waterfox's MIME handler for `jnlp`
-files to run `/usr/bin/javaws` but after working out all of the above
-I lack the patience to dig further today.
-
-Yeah, there's a way, and it's disgusting: pre-populate the Waterfox
-config tree, then overwrite or edit `handlers.json`. Something like
-this would work for the pre-population step:
-
-```
-waterfox --headless & waterfox=$!
-sleep 2
-kill -HUP $waterfox
-```
-
-Then either blindly `cp` or use a small Python script to edit the
-JSON. The snippet we want to add is:
-
-```
- "application/x-java-jnlp-file": {
- "action": 2,
- "extensions": [
- "jnlp"
- ],
- "handlers": [
- {
- "name": "javaws",
- "path": "/usr/bin/javaws"
- }
- ]
- }
-```
-
-as another entry in the `mimeTypes` section.
-
-```
->>> import json
->>> handlers = json.load(open("handlers.json"))
->>> handlers["mimeTypes"]["application/x-java-jnlp-file"]
-{u'action': 2, u'extensions': [u'jnlp'], u'handlers': [{u'path': u'/usr/bin/javaws', u'name': u'javaws'}]}
-```
+The hack for preconfiguring Waterfox's MIME handler to run
+`/usr/bin/javaws` for `jnlp` files is particularly disgusting, but
+none of the rest of this is particularly nice either. Whatever.
diff --git a/handlers.json b/handlers.json
new file mode 100644
index 0000000..c958e95
--- /dev/null
+++ b/handlers.json
@@ -0,0 +1 @@
+{"defaultHandlersVersion":{"en-US":4},"mimeTypes":{"application/pdf":{"action":3,"extensions":["pdf"]},"application/x-java-jnlp-file":{"action":2,"extensions":["jnlp"],"handlers":[{"name":"javaws","path":"/usr/bin/javaws"}]}},"schemes":{"mailto":{"action":2,"ask":true,"handlers":[null,{"name":"Yahoo! Mail","uriTemplate":"https://compose.mail.yahoo.com/?To=%s"},{"name":"Gmail","uriTemplate":"https://mail.google.com/mail/?extsrc=mailto&url=%s"}]},"irc":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"ircs":{"action":2,"ask":true,"handlers":[null,{"name":"Mibbit","uriTemplate":"https://www.mibbit.com/?url=%s"}]},"webcal":{"action":2,"ask":true,"handlers":[null,{"name":"30 Boxes","uriTemplate":"https://30boxes.com/external/widget?refer=ff&url=%s"}]},"file":{"action":2,"handlers":[{"name":"javaws","path":"/usr/bin/javaws"}]}}} \ No newline at end of file
diff --git a/startup.sh b/startup.sh
index 17cbe4a..bba1ef2 100755
--- a/startup.sh
+++ b/startup.sh
@@ -1,5 +1,7 @@
#!/bin/sh -
+set -x
+
export USER=root HOME=/root DISPLAY=:0 XAUTHORITY=$HOME/.Xauthority
mkdir -p $HOME/.vnc
@@ -8,7 +10,14 @@ chmod -R go= $HOME/.vnc
vncserver $DISPLAY -geometry 1280x768 -depth 16 -nolisten tcp
-#ratpoison
-icewm
+#ratpoison & wm=$!
+icewm & wm=$!
+
+waterfox --headless &
+waterfox=$!
+sleep 2
+kill -HUP $waterfox
+mv handlers.json /root/.waterfox/*.default/
+wait $wm
vncserver -kill $DISPLAY