Browse Source

Horrible kludge to preconfigure jnlp application

Rob Austein 5 years ago
parent
commit
08b13cc74d
4 changed files with 20 additions and 46 deletions
  1. 6 4
      Dockerfile
  2. 3 40
      README.md
  3. 0 0
      handlers.json
  4. 11 2
      startup.sh

+ 6 - 4
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
 

+ 3 - 40
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.

File diff suppressed because it is too large
+ 0 - 0
handlers.json


+ 11 - 2
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

Some files were not shown because too many files changed in this diff