Skip to content

Commit

Permalink
Add proper packaging for Linux #1
Browse files Browse the repository at this point in the history
  • Loading branch information
durasj committed May 16, 2021
1 parent 0b21090 commit ae48050
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ If you want to create installers, you additionally need:

- Window: [WiX Toolset](https://wixtoolset.org/).
- macOS: Xcode.
- Linux: Distribution-specific tools for building rpm or deb packages, e.g., `fedora-packager` on Fedora.
- Linux: Distribution-specific tools for building rpm or deb packages, e.g., `rpm-build` on Fedora. This script expects to create both `rpm` and `deb` on distributions derived from Debian, which should be possible if you install `rpm`.

## License

Expand Down
5 changes: 2 additions & 3 deletions src/main/resources/com/octosign/whitelabel/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ win.shortcut=

### Linux specific ###

# Name for Linux package.
# Defaults to the application name.
linux.name=
# Maintainer for .deb bundle (email address).
linux.debMaintainer=
# Menu group this application is placed in.
# See https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry
# Defaults to "Office".
linux.menuGroup=
# Required packages or capabilities for the application.
linux.packageDeps=
Expand Down
52 changes: 47 additions & 5 deletions src/main/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ arguments=(
"--license-file" "$appDirectory/LICENSE"
"--resource-dir" "$resourcesDir"
"--dest" "$output"
"--verbose"
)

if [[ "$platform" == "win" ]]; then
Expand Down Expand Up @@ -72,11 +71,54 @@ if [[ "$platform" == "win" ]]; then
)
fi

$jpackage "${arguments[@]}"
fi

# TODO: Use platform-specific Linux properties
if [[ "$platform" == "linux" ]]; then
cp "$resourcesDir/Octosign.template.desktop" "$resourcesDir/Octosign.desktop"
sed -i -e "s/PROTOCOL_NAME/$properties_protocol/g" "$resourcesDir/Octosign.desktop"

# TODO: Use platform-specific macOS properties
if [[ ! -z "$properties_linux_debMaintainer" ]]; then
arguments+=(
"--linux-deb-maintainer" "$properties_linux_debMaintainer"
)
fi

if [[ ! -z "$properties_linux_appCategory" ]]; then
arguments+=(
"--linux-app-category" "$properties_linux_appCategory"
)
fi

if [[ ! -z "$properties_linux_packageDeps" ]]; then
arguments+=(
"--linux-package-deps" "$properties_linux_packageDeps"
)
fi

arguments+=(
"--linux-rpm-license-type" "${properties_linux_rpmLicenseType:-MIT}"
"--linux-menu-group" "${properties_linux_menuGroup:-Office}"
)

if [[ "$properties_linux_shortcut" == "1" ]]; then
arguments+=(
"--linux-shortcut"
)
fi

# Build both .rpm and .deb from Linux - should work from Debian-like distro but not the other way around
arguments+=(
"--type" "rpm"
)
$jpackage "${arguments[@]}"

$jpackage "${arguments[@]}"
# TODO: Use --resource-dir for resource overrides
if [[ -f "/etc/lsb-release" ]]; then
arguments+=(
"--type" "deb"
)
$jpackage "${arguments[@]}"
fi
fi

# TODO: Use platform-specific macOS properties
3 changes: 2 additions & 1 deletion src/main/scripts/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Created dynamically during build from main.template.wxs
# Created dynamically during build from *.template.*
main.wxs
Octosign.desktop
9 changes: 9 additions & 0 deletions src/main/scripts/resources/Octosign.template.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=APPLICATION_NAME
Comment=APPLICATION_DESCRIPTION
Exec=APPLICATION_LAUNCHER --url='%u'
Icon=APPLICATION_ICON
Terminal=false
Type=Application
Categories=DEPLOY_BUNDLE_CATEGORY
MimeType=x-scheme-handler/PROTOCOL_NAME;

0 comments on commit ae48050

Please sign in to comment.