rename sparrow package to sparrowwallet and sparrowserver on linux

This commit is contained in:
Craig Raw 2025-05-15 09:28:42 +02:00
parent af4c68a09c
commit d0da85171c
11 changed files with 170 additions and 52 deletions

View file

@ -30,7 +30,7 @@ jobs:
- name: Package tar distribution - name: Package tar distribution
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
run: ./gradlew packageTarDistribution run: ./gradlew packageTarDistribution
- name: Upload Artifacts - name: Upload Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Sparrow Build - ${{ runner.os }} ${{ runner.arch }} name: Sparrow Build - ${{ runner.os }} ${{ runner.arch }}
@ -43,9 +43,6 @@ jobs:
- name: Package headless tar distribution - name: Package headless tar distribution
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
run: ./gradlew -Djava.awt.headless=true packageTarDistribution run: ./gradlew -Djava.awt.headless=true packageTarDistribution
- name: Rename Headless Artifacts
if: ${{ runner.os == 'Linux' }}
run: for f in build/jpackage/sparrow*; do mv -v "$f" "${f/sparrow/sparrow-server}"; done;
- name: Upload Headless Artifact - name: Upload Headless Artifact
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View file

@ -6,7 +6,6 @@ plugins {
id 'io.matthewnelson.kmp.tor.resource-filterjar' version '408.16.2' id 'io.matthewnelson.kmp.tor.resource-filterjar' version '408.16.2'
} }
def sparrowVersion = '2.1.4'
def os = org.gradle.internal.os.OperatingSystem.current() def os = org.gradle.internal.os.OperatingSystem.current()
def osName = os.getFamilyName() def osName = os.getFamilyName()
if(os.macOsX) { if(os.macOsX) {
@ -20,8 +19,8 @@ if(System.getProperty("os.arch") == "aarch64") {
} }
def headless = "true".equals(System.getProperty("java.awt.headless")) def headless = "true".equals(System.getProperty("java.awt.headless"))
group "com.sparrowwallet" group 'com.sparrowwallet'
version "${sparrowVersion}" version '2.1.4'
repositories { repositories {
mavenCentral() mavenCentral()
@ -239,7 +238,7 @@ jlink {
jpackage { jpackage {
imageName = "Sparrow" imageName = "Sparrow"
installerName = "Sparrow" installerName = "Sparrow"
appVersion = "${sparrowVersion}" appVersion = "${version}"
skipInstaller = os.macOsX || properties.skipInstallers skipInstaller = os.macOsX || properties.skipInstallers
imageOptions = [] imageOptions = []
installerOptions = ['--file-associations', 'src/main/deploy/psbt.properties', '--file-associations', 'src/main/deploy/txn.properties', '--file-associations', 'src/main/deploy/asc.properties', '--file-associations', 'src/main/deploy/bitcoin.properties', '--file-associations', 'src/main/deploy/auth47.properties', '--file-associations', 'src/main/deploy/lightning.properties', '--license-file', 'LICENSE'] installerOptions = ['--file-associations', 'src/main/deploy/psbt.properties', '--file-associations', 'src/main/deploy/txn.properties', '--file-associations', 'src/main/deploy/asc.properties', '--file-associations', 'src/main/deploy/bitcoin.properties', '--file-associations', 'src/main/deploy/auth47.properties', '--file-associations', 'src/main/deploy/lightning.properties', '--license-file', 'LICENSE']
@ -250,11 +249,13 @@ jlink {
} }
if(os.linux) { if(os.linux) {
if(headless) { if(headless) {
installerOptions = ['--license-file', 'LICENSE', '--resource-dir', "src/main/deploy/package/linux-headless/${osArch}"] installerName = "sparrowserver"
installerOptions = ['--license-file', 'LICENSE']
} else { } else {
installerOptions += ['--resource-dir', 'src/main/deploy/package/linux/', '--linux-shortcut', '--linux-menu-group', 'Sparrow'] installerName = "sparrowwallet"
installerOptions += ['--linux-shortcut', '--linux-menu-group', 'Sparrow']
} }
installerOptions += ['--linux-app-category', 'utils', '--linux-app-release', '1', '--linux-rpm-license-type', 'ASL 2.0', '--linux-deb-maintainer', 'mail@sparrowwallet.com'] installerOptions += ['--resource-dir', layout.buildDirectory.dir('deploy/package').get().asFile.toString(), '--linux-app-category', 'utils', '--linux-app-release', '1', '--linux-rpm-license-type', 'ASL 2.0', '--linux-deb-maintainer', 'mail@sparrowwallet.com']
imageOptions += ['--icon', 'src/main/deploy/package/linux/Sparrow.png', '--resource-dir', 'src/main/deploy/package/linux/'] imageOptions += ['--icon', 'src/main/deploy/package/linux/Sparrow.png', '--resource-dir', 'src/main/deploy/package/linux/']
} }
if(os.macOsX) { if(os.macOsX) {
@ -272,6 +273,7 @@ jlink {
if(os.linux) { if(os.linux) {
tasks.jlink.finalizedBy('addUserWritePermission', 'copyUdevRules') tasks.jlink.finalizedBy('addUserWritePermission', 'copyUdevRules')
tasks.jpackageImage.finalizedBy('prepareResourceDir')
} else { } else {
tasks.jlink.finalizedBy('addUserWritePermission') tasks.jlink.finalizedBy('addUserWritePermission')
} }
@ -290,12 +292,39 @@ tasks.register('copyUdevRules', Copy) {
include('*') include('*')
} }
tasks.register('prepareResourceDir', Copy) {
from("src/main/deploy/package/linux${headless ? '-headless' : ''}")
into(layout.buildDirectory.dir('deploy/package'))
include('*')
exclude('*.png')
filter { String line ->
if(line.contains('${size')) {
line = line.replace('${size}', getDirectorySize(layout.buildDirectory.dir('jpackage/Sparrow').get().asFile))
}
return line.replace('${version}', "${version}").replace('${arch}', osArch == 'aarch64' ? 'arm64' : 'amd64')
}
}
static def getDirectorySize(File directory) {
long size = 0
if(directory.isFile()) {
size = directory.length()
} else if(directory.isDirectory()) {
directory.eachFileRecurse { file ->
if(file.isFile()) {
size += file.length()
}
}
}
return Long.toString(size/1024 as long)
}
tasks.register('removeGroupWritePermission', Exec) { tasks.register('removeGroupWritePermission', Exec) {
commandLine 'chmod', '-R', 'g-w', "$buildDir/jpackage/Sparrow" commandLine 'chmod', '-R', 'g-w', "$buildDir/jpackage/Sparrow"
} }
tasks.register('packageZipDistribution', Zip) { tasks.register('packageZipDistribution', Zip) {
archiveFileName = "Sparrow-${sparrowVersion}.zip" archiveFileName = "Sparrow-${version}.zip"
destinationDirectory = file("$buildDir/jpackage") destinationDirectory = file("$buildDir/jpackage")
preserveFileTimestamps = os.macOsX preserveFileTimestamps = os.macOsX
from("$buildDir/jpackage/") { from("$buildDir/jpackage/") {
@ -306,7 +335,7 @@ tasks.register('packageZipDistribution', Zip) {
tasks.register('packageTarDistribution', Tar) { tasks.register('packageTarDistribution', Tar) {
dependsOn removeGroupWritePermission dependsOn removeGroupWritePermission
archiveFileName = "sparrow-${sparrowVersion}-${releaseArch}.tar.gz" archiveFileName = "sparrow${headless ? 'server': 'wallet'}-${version}-${releaseArch}.tar.gz"
destinationDirectory = file("$buildDir/jpackage") destinationDirectory = file("$buildDir/jpackage")
compression = Compression.GZIP compression = Compression.GZIP
from("$buildDir/jpackage/") { from("$buildDir/jpackage/") {

View file

@ -1,9 +0,0 @@
Package: sparrow
Version: 2.1.4-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
Architecture: arm64
Provides: sparrow
Description: Sparrow
Depends: libc6, zlib1g

View file

@ -0,0 +1,12 @@
Package: sparrowserver
Version: ${version}-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
Architecture: ${arch}
Conflicts: sparrow (<= 2.1.4)
Replaces: sparrow (<= 2.1.4)
Provides: sparrowserver
Description: Sparrow Server
Depends: libc6, zlib1g
Installed-Size: ${size}

View file

@ -0,0 +1,85 @@
Summary: Sparrow Server
Name: sparrowserver
Version: ${version}
Release: 1
License: ASL 2.0
Vendor: Unknown
%if "x" != "x"
URL: https://sparrowwallet.com
%endif
%if "x/opt" != "x"
Prefix: /opt
%endif
Provides: sparrowserver
Obsoletes: sparrow <= 2.1.4
%if "xutils" != "x"
Group: utils
%endif
Autoprov: 0
Autoreq: 0
#comment line below to enable effective jar compression
#it could easily get your package size from 40 to 15Mb but
#build time will substantially increase and it may require unpack200/system java to install
%define __jar_repack %{nil}
# on RHEL we got unwanted improved debugging enhancements
%define _build_id_links none
%define package_filelist %{_builddir}/%{name}.files
%define app_filelist %{_builddir}/%{name}.app.files
%define filesystem_filelist %{_builddir}/%{name}.filesystem.files
%define default_filesystem / /opt /usr /usr/bin /usr/lib /usr/local /usr/local/bin /usr/local/lib
%description
Sparrow Server
%global __os_install_post %{nil}
%prep
%build
%install
rm -rf %{buildroot}
install -d -m 755 %{buildroot}/opt/sparrowserver
cp -r %{_sourcedir}/opt/sparrowserver/* %{buildroot}/opt/sparrowserver
if [ "$(echo %{_sourcedir}/lib/systemd/system/*.service)" != '%{_sourcedir}/lib/systemd/system/*.service' ]; then
install -d -m 755 %{buildroot}/lib/systemd/system
cp %{_sourcedir}/lib/systemd/system/*.service %{buildroot}/lib/systemd/system
fi
%if "x%{_rpmdir}/../../LICENSE" != "x"
%define license_install_file %{_defaultlicensedir}/%{name}-%{version}/%{basename:%{_rpmdir}/../../LICENSE}
install -d -m 755 "%{buildroot}%{dirname:%{license_install_file}}"
install -m 644 "%{_rpmdir}/../../LICENSE" "%{buildroot}%{license_install_file}"
%endif
(cd %{buildroot} && find . -path ./lib/systemd -prune -o -type d -print) | sed -e 's/^\.//' -e '/^$/d' | sort > %{app_filelist}
{ rpm -ql filesystem || echo %{default_filesystem}; } | sort > %{filesystem_filelist}
comm -23 %{app_filelist} %{filesystem_filelist} > %{package_filelist}
sed -i -e 's/.*/%dir "&"/' %{package_filelist}
(cd %{buildroot} && find . -not -type d) | sed -e 's/^\.//' -e 's/.*/"&"/' >> %{package_filelist}
%if "x%{_rpmdir}/../../LICENSE" != "x"
sed -i -e 's|"%{license_install_file}"||' -e '/^$/d' %{package_filelist}
%endif
%files -f %{package_filelist}
%if "x%{_rpmdir}/../../LICENSE" != "x"
%license "%{license_install_file}"
%endif
%post
package_type=rpm
%pre
package_type=rpm
%preun
package_type=rpm
%clean

View file

@ -1,9 +0,0 @@
Package: sparrow
Version: 2.1.4-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
Architecture: amd64
Provides: sparrow
Description: Sparrow
Depends: libc6, zlib1g

View file

@ -1,8 +1,8 @@
[Desktop Entry] [Desktop Entry]
Name=Sparrow Name=Sparrow
Comment=Sparrow Comment=Sparrow
Exec=/opt/sparrow/bin/Sparrow %U Exec=/opt/sparrowwallet/bin/Sparrow %U
Icon=/opt/sparrow/lib/Sparrow.png Icon=/opt/sparrowwallet/lib/Sparrow.png
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Finance;Network; Categories=Finance;Network;

View file

@ -0,0 +1,12 @@
Package: sparrowwallet
Version: ${version}-1
Section: utils
Maintainer: Craig Raw <mail@sparrowwallet.com>
Priority: optional
Architecture: ${arch}
Provides: sparrowwallet
Conflicts: sparrow (<= 2.1.4)
Replaces: sparrow (<= 2.1.4)
Description: Sparrow Wallet
Depends: libasound2, libbsd0, libc6, libmd0, libx11-6, libxau6, libxcb1, libxdmcp6, libxext6, libxi6, libxrender1, libxtst6, xdg-utils
Installed-Size: ${size}

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# postinst script for sparrow # postinst script for sparrowwallet
# #
# see: dh_installdeb(1) # see: dh_installdeb(1)
@ -22,9 +22,9 @@ package_type=deb
case "$1" in case "$1" in
configure) configure)
xdg-desktop-menu install /opt/sparrow/lib/sparrow-Sparrow.desktop xdg-desktop-menu install /opt/sparrowwallet/lib/sparrowwallet-Sparrow.desktop
xdg-mime install /opt/sparrow/lib/sparrow-Sparrow-MimeInfo.xml xdg-mime install /opt/sparrowwallet/lib/sparrowwallet-Sparrow-MimeInfo.xml
install -D -m 644 /opt/sparrow/lib/runtime/conf/udev/*.rules /etc/udev/rules.d install -D -m 644 /opt/sparrowwallet/lib/runtime/conf/udev/*.rules /etc/udev/rules.d
if ! getent group plugdev > /dev/null; then if ! getent group plugdev > /dev/null; then
groupadd plugdev groupadd plugdev
fi fi

View file

@ -1,19 +1,20 @@
Summary: Sparrow Summary: Sparrow
Name: sparrow Name: sparrowwallet
Version: 2.1.4 Version: ${version}
Release: 1 Release: 1
License: ASL 2.0 License: ASL 2.0
Vendor: Unknown Vendor: Unknown
%if "x" != "x" %if "x" != "x"
URL: URL: https://sparrowwallet.com
%endif %endif
%if "x/opt" != "x" %if "x/opt" != "x"
Prefix: /opt Prefix: /opt
%endif %endif
Provides: sparrow Provides: sparrowwallet
Obsoletes: sparrow <= 2.1.4
%if "xutils" != "x" %if "xutils" != "x"
Group: utils Group: utils
@ -50,8 +51,8 @@ Sparrow Wallet
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
install -d -m 755 %{buildroot}/opt/sparrow install -d -m 755 %{buildroot}/opt/sparrowwallet
cp -r %{_sourcedir}/opt/sparrow/* %{buildroot}/opt/sparrow cp -r %{_sourcedir}/opt/sparrowwallet/* %{buildroot}/opt/sparrowwallet
if [ "$(echo %{_sourcedir}/lib/systemd/system/*.service)" != '%{_sourcedir}/lib/systemd/system/*.service' ]; then if [ "$(echo %{_sourcedir}/lib/systemd/system/*.service)" != '%{_sourcedir}/lib/systemd/system/*.service' ]; then
install -d -m 755 %{buildroot}/lib/systemd/system install -d -m 755 %{buildroot}/lib/systemd/system
cp %{_sourcedir}/lib/systemd/system/*.service %{buildroot}/lib/systemd/system cp %{_sourcedir}/lib/systemd/system/*.service %{buildroot}/lib/systemd/system
@ -77,9 +78,9 @@ sed -i -e 's/.*/%dir "&"/' %{package_filelist}
%post %post
package_type=rpm package_type=rpm
xdg-desktop-menu install /opt/sparrow/lib/sparrow-Sparrow.desktop xdg-desktop-menu install /opt/sparrowwallet/lib/sparrowwallet-Sparrow.desktop
xdg-mime install /opt/sparrow/lib/sparrow-Sparrow-MimeInfo.xml xdg-mime install /opt/sparrowwallet/lib/sparrowwallet-Sparrow-MimeInfo.xml
install -D -m 644 /opt/sparrow/lib/runtime/conf/udev/*.rules /etc/udev/rules.d install -D -m 644 /opt/sparrowwallet/lib/runtime/conf/udev/*.rules /etc/udev/rules.d
if ! getent group plugdev > /dev/null; then if ! getent group plugdev > /dev/null; then
groupadd plugdev groupadd plugdev
fi fi
@ -251,9 +252,9 @@ desktop_trace ()
echo "$@" echo "$@"
} }
do_if_file_belongs_to_single_package /opt/sparrow/lib/sparrow-Sparrow.desktop xdg-desktop-menu uninstall /opt/sparrow/lib/sparrow-Sparrow.desktop do_if_file_belongs_to_single_package /opt/sparrowwallet/lib/sparrowwallet-Sparrow.desktop xdg-desktop-menu uninstall /opt/sparrowwallet/lib/sparrowwallet-Sparrow.desktop
do_if_file_belongs_to_single_package /opt/sparrow/lib/sparrow-Sparrow-MimeInfo.xml xdg-mime uninstall /opt/sparrow/lib/sparrow-Sparrow-MimeInfo.xml do_if_file_belongs_to_single_package /opt/sparrowwallet/lib/sparrowwallet-Sparrow-MimeInfo.xml xdg-mime uninstall /opt/sparrowwallet/lib/sparrowwallet-Sparrow-MimeInfo.xml
do_if_file_belongs_to_single_package /opt/sparrow/lib/sparrow-Sparrow.desktop desktop_uninstall_default_mime_handler sparrow-Sparrow.desktop application/psbt application/bitcoin-transaction application/pgp-signature x-scheme-handler/bitcoin x-scheme-handler/auth47 x-scheme-handler/lightning do_if_file_belongs_to_single_package /opt/sparrowwallet/lib/sparrowwallet-Sparrow.desktop desktop_uninstall_default_mime_handler sparrowwallet-Sparrow.desktop application/psbt application/bitcoin-transaction application/pgp-signature x-scheme-handler/bitcoin x-scheme-handler/auth47 x-scheme-handler/lightning
%clean %clean

View file

@ -572,16 +572,16 @@ public class AppController implements Initializable {
public void installUdevRules(ActionEvent event) { public void installUdevRules(ActionEvent event) {
String commands = """ String commands = """
sudo install -m 644 /opt/sparrow/lib/runtime/conf/udev/*.rules /etc/udev/rules.d sudo install -m 644 /opt/sparrowwallet/lib/runtime/conf/udev/*.rules /etc/udev/rules.d
sudo udevadm control --reload sudo udevadm control --reload
sudo udevadm trigger sudo udevadm trigger
sudo groupadd -f plugdev sudo groupadd -f plugdev
sudo usermod -aG plugdev `whoami` sudo usermod -aG plugdev `whoami`
"""; """;
String home = System.getProperty(JPACKAGE_APP_PATH); String home = System.getProperty(JPACKAGE_APP_PATH);
if(home != null && !home.startsWith("/opt/sparrow") && home.endsWith("bin/Sparrow")) { if(home != null && !home.startsWith("/opt/sparrowwallet") && home.endsWith("bin/Sparrow")) {
home = home.replace("bin/Sparrow", ""); home = home.replace("bin/Sparrow", "");
commands = commands.replace("/opt/sparrow/", home); commands = commands.replace("/opt/sparrowwallet/", home);
} }
TextAreaDialog dialog = new TextAreaDialog(commands, false); TextAreaDialog dialog = new TextAreaDialog(commands, false);