Skip to content

Commit

Permalink
Hoopsnake (#6)
Browse files Browse the repository at this point in the history
* Add ship events
* Separate experimental and stable builds for Windows
* Separate experimental and stable builds for MacOS
* remove desktop file during uninstall
* Respond to unsuitable input messages with error
* Allow to view flavor content (show button)
* Add generic listener for Oolite messages
* Improve resilience for unspecified version numbers
* Improve logging and documentation
  • Loading branch information
oocube authored Nov 11, 2024
1 parent 862a6ff commit 1964a62
Show file tree
Hide file tree
Showing 17 changed files with 916 additions and 46 deletions.
58 changes: 45 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
GITVERSION_PATCH: ${{ steps.gitversion.outputs.GITVERSION_PATCH }}
MACOS_MAJORMINORPATCH: ${{ steps.output1.outputs.MACOS_MAJORMINORPATCH }}
DEBIAN_PKGVERSION: ${{ steps.output1.outputs.DEBIAN_PKGVERSION }}
FLAVOR: ${{ steps.output1.outputs.FLAVOR }}
FLAVOR2: ${{ steps.output1.outputs.FLAVOR2 }}
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand Down Expand Up @@ -54,6 +56,11 @@ jobs:
else
echo "MACOS_MAJORMINORPATCH=${GitVersion_MajorMinorPatch}" >> "$GITHUB_OUTPUT"
fi
if [ "$GITHUB_REF_NAME" != "master" ]
then
echo "FLAVOR=_${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "FLAVOR2=-${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
fi
build:
needs: [semver]
Expand Down Expand Up @@ -135,7 +142,7 @@ jobs:
--app-version "${{ needs.semver.outputs.DEBIAN_PKGVERSION }}" \
--copyright Copyright \
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" \
--name "OoliteStarter" \
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \
--dest target/appimage \
--temp target/oolite-starter-tmp \
--vendor "OoliteProject" \
Expand All @@ -150,8 +157,8 @@ jobs:

- name: Tweak AppImage
run: |
cp -v "oolitestarter/src/jpackage/resources-linux/OoliteStarter.desktop" "target/appimage/OoliteStarter/lib/oolitestarter-OoliteStarter.desktop"
# cp -v "oolitestarter/src/main/resources/images/OoliteStarter_Splashscreen_640x360.png" "target/appimage/OoliteStarter/lib/app/splash.png"
mv "oolitestarter/src/jpackage/resources-linux/OoliteStarter.desktop" "oolitestarter/src/jpackage/resources-linux/OoliteStarter${{ needs.semver.outputs.FLAVOR }}.desktop"
#cp -v "oolitestarter/src/jpackage/resources-linux/OoliteStarter.desktop" "target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }}/lib/oolitestarter${{ needs.semver.outputs.FLAVOR2 }}-oolitestarter${{ needs.semver.outputs.FLAVOR2 }}.desktop"
- name: Check status 2
run: |
Expand All @@ -164,8 +171,8 @@ jobs:
run: |
jpackage \
--verbose \
--app-image target/appimage/OoliteStarter \
--name "OoliteStarter" \
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }} \
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \
--app-version "${{ needs.semver.outputs.DEBIAN_PKGVERSION }}" \
--dest target \
--license-file oolitestarter/LICENSE \
Expand Down Expand Up @@ -224,7 +231,20 @@ jobs:
- name: Prepare AppImage for Windows
run: |
jpackage --type app-image --app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" --copyright Copyright --description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" --name "OoliteStarter" --dest target/appimage --temp target/oolite-starter-tmp --vendor "OoliteProject" --verbose --icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico --input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist --main-jar OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}.jar --main-class oolite.starter.MainFrame
jpackage --type app-image `
--app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" `
--copyright Copyright `
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" `
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" `
--dest target/appimage `
--temp target/oolite-starter-tmp `
--vendor "OoliteProject" `
--verbose `
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico `
--input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist `
--main-jar OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}.jar `
--main-class oolite.starter.MainFrame
# --resource-dir src/jpackage/resources
- name: Check status 2
Expand All @@ -234,7 +254,17 @@ jobs:
# for upgrades, it seems we need a UUID - see https://stackoverflow.com/a/67442754/4222206
- name: Finish AppImage for Windows
run: |
jpackage --verbose --app-image target/appimage/OoliteStarter --app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" --name "OoliteStarter" --dest target --win-shortcut --icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico --win-shortcut --win-menu --win-menu-group Oolite --win-dir-chooser --win-upgrade-uuid 0a18c6bc-0418-47dc-9526-3a48030f6af6
jpackage `
--verbose `
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }} `
--app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" `
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" `
--dest target `
--win-shortcut `
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico `
--win-shortcut --win-menu --win-menu-group Oolite `
--win-dir-chooser --win-upgrade-uuid 0a18c6bc-0418-47dc-9526-3a48030f6af6
#--resource-dir src/jpackage/resources
- name: Check status 3
Expand All @@ -244,9 +274,11 @@ jobs:
- name: Rename result (target\OoliteStarter-0.1.16.0.exe)
run: |
gci env:* | sort-object name
$SRC = "target\OoliteStarter-${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}.exe"
$DST = "OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-Windows-%PROCESSOR_ARCHITECTURE%.exe"
$SRC = "target\OoliteStarter${{ needs.semver.outputs.FLAVOR }}-${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}.exe"
$DST = "OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-Windows-${env:PROCESSOR_ARCHITECTURE}.exe"
ren $SRC $DST
env:
PROCESSOR_ARCHITECTURE: ${PROCESSOR_ARCHITECTURE}

- name: Check status 4
run: |
Expand Down Expand Up @@ -305,7 +337,7 @@ jobs:
--app-version "${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}" \
--copyright Copyright \
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" \
--name "OoliteStarter" --dest target/appimage \
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" --dest target/appimage \
--temp target/oolite-starter-tmp --vendor "OoliteProject" --verbose \
--icon oolitestarter/src/main/resources/oolite_logo.png \
--input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist \
Expand Down Expand Up @@ -336,8 +368,8 @@ jobs:
--type pkg \
--verbose \
--app-version "${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}" \
--app-image target/appimage/OoliteStarter.app \
--name "OoliteStarter" \
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }}.app \
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \
--icon oolitestarter/src/main/resources/oolite_logo.png \
--dest target \
--resource-dir oolitestarter/src/jpackage/resources-mac \
Expand All @@ -357,7 +389,7 @@ jobs:
- name: Rename result
run: |
mv ./target/OoliteStarter-${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}.pkg ./target/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-MacOS-${HOSTTYPE}.pkg
mv ./target/OoliteStarter${{ needs.semver.outputs.FLAVOR }}-${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}.pkg ./target/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-MacOS-${HOSTTYPE}.pkg
- name: Check status 4
run: |
Expand Down
38 changes: 35 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@ The Oolite Starter allows users to more comfortably preconfigure Oolite
for various missions. It's main purpose is to ease OXP management, Oolite versions
and manage save games.

So obviously it allows you to install and remove OXPs. It shows conflicts and
dependencies so you can avoid problems as early as possible. If you ever tried
to remember which list of OXPs you had installed, OoliteStarter allows to save
and reconstruct them. You can also share the list of OXPs with others if you like.

Also OoliteStarter remembers which OXPs were in use when you saved the game, and
you can restore that state with just the click of a button.

While you create savegames in Oolite, OoliteStarter allows to browse the savegames
and choose which one to launch. But you can also delete no longer needed files.

There are more goodies like auto update checks for OoliteStarter, OXPs and
Oolite itself. Or MQTT functionality that allow adding more cockpit gauges or
input controls to be connected to Oolite.

## Requirements (generic package only)

* Be aware this is a manual install. If you feel unsure what to do you are likely
better off with the installer packages.
* You need to have Java SDK 21 or newer installed.
If you are unfamiliar with installing Java on Linux, follow
https://www.youtube.com/watch?v=7lzIP-PvHoY
Expand All @@ -21,10 +38,14 @@ and manage save games.

### Generic Package

Be aware this is a manual install. If you feel unsure what to do you are likely
better off with the installer packages.

Download the .tar.gz or the .zip file and extract in a directory of your choice.
You likely want to create a shortcut to run.sh or run.cmd.
You might want to create a shortcut to run.sh or run.cmd.

To remove the software, just delete the directory you have created.
To remove the software, just delete the directory you have created and the
shortcut in case you created it.

If, directly at startup, you see error messages like
java.lang.UnsupportedClassVersionError: oolite/starter/MainFrame has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to...
Expand Down Expand Up @@ -64,7 +85,8 @@ $HOME/.oolite-starter.conf

If this file is not present, do not worry. A warning will be displayed and
OoliteStarter will run. Switch to the `Oolite Versions` tab and add at least one
Oolite installation. Then press Save and the missing file will be created.
Oolite installation (there are Add and Scan options). Then press Save and the
missing file will be created.

For each Oolite installation you can define a number of places in the filesystem.
Since some players have multiple such installations in parallel, they can be
Expand Down Expand Up @@ -353,6 +375,11 @@ These events will be happening:
If OoliteStarter cannot grab the TCP Port it will not complain. But at the same
time it will not be able to receive events to be forwarded to MQTT.

To debug you can use e.g. Mosquitto as broker and the command line client to show
incoming messages. Run something like this command:

mosquitto_sub -h 192.168.178.51 -p 1883 -t "#" -v -u <user> -P <password>

### Feedback Channel

OoliteStarter not only allows Oolite to publish messages to MQTT. It also allows
Expand All @@ -367,6 +394,11 @@ While this may look like overhead it allows future extension of the messages.
Make sure 'somestring' is a valid Oolite command - or expect some Oolite complaints
and ranting in one of the other topics.

As a test you can run e.g. Mosquitto client like this:

mosquitto_pub -h 192.168.178.51 -p 1883 -t "oolite/input" -u <user> -P <password> -m "{'command': 'somestring'}"



### OoliteStarter and Oolite Debug Console

Expand Down
9 changes: 5 additions & 4 deletions src/jpackage/resources-linux/OoliteStarter.desktop
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[Desktop Entry]
Name=OoliteStarter
Comment=UI to manage Oolite, SaveGames and Expansions
Exec=/opt/oolitestarter/bin/OoliteStarter
Icon=/opt/oolitestarter/lib/OoliteStarter.png
Name=APPLICATION_NAME
Comment=APPLICATION_DESCRIPTION
Exec=APPLICATION_LAUNCHER
Icon=APPLICATION_ICON
Terminal=false
Type=Application
Categories=Unknown
MimeType=
StartupWMClass=oolite-starter-MainFrame
DESKTOP_MIMES
11 changes: 9 additions & 2 deletions src/jpackage/resources-linux/postinst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# postinst script for nexus
# postinst script for OoliteStarter
#
# see: dh_installdeb(1)

Expand All @@ -18,10 +18,17 @@ set -e
# the debian-policy package

echo $0 called with $*
printenv | sort
pwd

package_type=deb
LAUNCHER_AS_SERVICE_SCRIPTS

case "$1" in
configure)
xdg-desktop-menu install /opt/oolitestarter/lib/oolitestarter-OoliteStarter.desktop
xdg-desktop-menu install /opt/APPLICATION_PACKAGE/lib/APPLICATION_PACKAGE-*.desktop
DESKTOP_COMMANDS_INSTALL
LAUNCHER_AS_SERVICE_COMMANDS_INSTALL
;;

abort-upgrade|abort-remove|abort-deconfigure)
Expand Down
45 changes: 45 additions & 0 deletions src/jpackage/resources-linux/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh
# prerm script for APPLICATION_PACKAGE
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


echo $0 called with $*
printenv | sort
pwd

package_type=deb
#COMMON_SCRIPTS
DESKTOP_SCRIPTS
LAUNCHER_AS_SERVICE_SCRIPTS

case "$1" in
remove|upgrade|deconfigure)
xdg-desktop-menu uninstall /opt/APPLICATION_PACKAGE/lib/APPLICATION_PACKAGE-APPLICATION_PACKAGE.desktop
DESKTOP_COMMANDS_UNINSTALL
LAUNCHER_AS_SERVICE_COMMANDS_UNINSTALL
;;

failed-upgrade)
;;

*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac

exit 0
Loading

0 comments on commit 1964a62

Please sign in to comment.