adjust resources path

This commit is contained in:
pompurin404
2024-08-08 10:09:38 +08:00
parent 7d6ca923db
commit 090e4d3cfa
7 changed files with 83 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
pkgname=mihomo-party-electron
_pkgname=mihomo-party
pkgver=0.1.3
pkgrel=1
pkgdesc="Another Mihomo GUI."
arch=('x86_64' 'aarch64')
url="https://github.com/pompurin404/mihomo-party"
license=('GPL3')
conflicts=("mihomo-party-git" 'mihomo-party-bin' 'mihomo-party')
depends=('electron' 'gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'libsecret')
optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).')
makedepends=('nodejs' 'pnpm' 'libxcrypt-compat' 'asar')
install=$_pkgname.install
source=("${_pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=("52d761e9432e17477acb8adb5744676df946476e0eb5210fee2b6d45f497f218")
options=('!lto')
prepare(){
cd $srcdir/${_pkgname}-${pkgver}
pnpm install
}
build(){
cd $srcdir/${_pkgname}-${pkgver}
pnpm build:linux deb
}
package() {
asar extract $srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/app.asar ${pkgdir}/opt/mihomo-party
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha
cd ${pkgdir}/../..
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
install -Dm644 "$srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png"
chown -R root:root ${pkgdir}
}

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Name=mihomo-party
Exec=mihomo-party %U
Terminal=false
Type=Application
Icon=mihomo-party
StartupWMClass=mihomo-party
MimeType=x-scheme-handler/clash;x-scheme-handler/mihomo;
Comment=Mihomo Party
Categories=Utility;

View File

@@ -0,0 +1,14 @@
# Colored makepkg-like functions
note() {
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
}
_all_off="$(tput sgr0)"
_bold="${_all_off}$(tput bold)"
_blue="${_bold}$(tput setaf 4)"
_yellow="${_bold}$(tput setaf 3)"
post_install() {
note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf"
note "The launcher is called: 'mihomo-party'"
}

View File

@@ -0,0 +1,12 @@
#!/usr/bin/bash
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
# Allow users to override command-line options
if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then
mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")"
echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]}
fi
# Launch
exec electron /opt/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"