From 63bf53c3db43d372fe14f749d9c7e81140148bf5 Mon Sep 17 00:00:00 2001 From: detiam Date: Mon, 18 Dec 2023 02:16:21 +0800 Subject: [PATCH] fix broken launch script --- PKGBUILD | 27 +++++++++++++++------------ hmcl-launch-script | 39 +++++++++++++++++++++++++++++++-------- hmcl.desktop | 2 +- 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 83a04d3..52292e9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -13,23 +13,24 @@ pkgdesc='An unofficial build of HMCL that trying to compile and run HMCL with th arch=('any') url='https://github.com/huanghongxun/HMCL' license=('GPL3') -depends=('java-openjfx>=17') -makedepends=('java-environment>=17' 'gradle') +_JAVA_VERSION=17 +_JAR_PATH="/usr/share/java/$pkgname.jar" +depends=("java-openjfx>=$_JAVA_VERSION" 'archlinux-java-run') +makedepends=("java-environment>=$_JAVA_VERSION" 'gradle') provides=('hmcl') conflicts=('hmcl') source=('hmcl.desktop' 'hmcl-launch-script' 'craft_table.png' "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz" - "0001-Target-java-17.patch" - "0002-Cleanup.patch" -) -sha256sums=('b4e8aa0f349bb3f5dd15a31c5a13ac3e10e5a5bcd2f97cf390041924275e43ef' - '858b5082bc58ddc44fe74625937876e78442fdf5ff948d1e91cddbf170af9eeb' - '2989a1b5301b8c7b9afdae5696c6a4e5246afa2d4f1f3d3dad5c192f036a9b4c' - '69680efbdb9dc18ab8d6973ee4be442671133641a61602608084fb7fe67c3082' - '7b9511c0f0eceef29577e879a00e0ab341fddeed6e9e33f54cefbaca11ae9354' - '5df53d14eda958ca6eb236732308171895516813e9b666681b810eb8d3d294e0') + "0001-Target-java-$_JAVA_VERSION.patch" + "0002-Cleanup.patch") +sha256sums=('04ee0621a295728d4ad5d23d6bf8853d5715053153b336203ce7e73ce8b66440' + '505c335bce8685fff97f6fbd0c4b916fa697dfc73ff22735d7c188b3811bc422' + '2989a1b5301b8c7b9afdae5696c6a4e5246afa2d4f1f3d3dad5c192f036a9b4c' + '69680efbdb9dc18ab8d6973ee4be442671133641a61602608084fb7fe67c3082' + '7b9511c0f0eceef29577e879a00e0ab341fddeed6e9e33f54cefbaca11ae9354' + '5df53d14eda958ca6eb236732308171895516813e9b666681b810eb8d3d294e0') prepare() { cd "$_pkgname-$pkgver" @@ -61,7 +62,9 @@ check() { package() { install -Dm755 'hmcl-launch-script' "$pkgdir/usr/bin/$pkgname" install -Dm644 'hmcl.desktop' "$pkgdir/usr/share/applications/$pkgname.desktop" - install -Dm644 "$_pkgname-$pkgver/HMCL/build/libs/$_pkgname-$pkgver.jar" "$pkgdir/usr/share/java/$pkgname/$pkgname.jar" + install -Dm644 "$_pkgname-$pkgver/HMCL/build/libs/$_pkgname-$pkgver.jar" "$pkgdir/$_JAR_PATH" install -Dm644 'craft_table.png' "$pkgdir/usr/share/icons/hicolor/48x48/apps/$pkgname.png" install -Dm644 "$_pkgname-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + sed -i -e "s|%JAVA_VERSION%|$_JAVA_VERSION|" -e "s|%JAR_PATH%|$_JAR_PATH|" "$pkgdir/usr/bin/$pkgname" } diff --git a/hmcl-launch-script b/hmcl-launch-script index 4a923a4..743e7ab 100755 --- a/hmcl-launch-script +++ b/hmcl-launch-script @@ -1,12 +1,35 @@ -#!/bin/sh +#!/usr/bin/env sh set -eu -if [ "${1:-}" != -p ]; then - WORKDIR=${XDG_CONFIG_HOME:-$HOME/.config}/hmcl - mkdir -p "$WORKDIR" - cd "$WORKDIR" -fi +print_usage() { + cat <