Skip to content

Commit

Permalink
Fix hardcoded Path in XDG Intgration and add DEB/RPM Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoellnitz committed Mar 25, 2024
1 parent 7d80ce2 commit 65eaa6b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
49 changes: 47 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2023 Martin Goellnitz
* Copyright (C) 2013-2024 Martin Goellnitz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,6 +18,7 @@
plugins {
id "edu.sc.seis.launch4j" version "2.5.4"
id "net.ossindex.audit" version "0.4.11"
id "com.netflix.nebula.ospackage" version "11.8.1"
}
def l4j = true

Expand Down Expand Up @@ -148,7 +149,50 @@ startScripts {
}
}

distZip.dependsOn startScripts
ospackage {
packageName = 'jfilesync'
version = '3.0-SNAPSHOT'
maintainer = 'Martin Goellnitz'
url = 'https://mgoellnitz.github.io/JFileSync3'
into("/usr/share/applications") {
from 'xdg'
include '*.desktop'
}
into("/usr/share/icons/hicolor/64x64") {
from 'xdg'
include '*.png'
}
into("/usr/share/$project.name") {
from '.'
include 'legal/*.*'
include 'profiles/*.*'
include 'README.md'
}
into("/usr/lib/$packageName/lib") {
from "build/install/$project.name/lib"
include '*.jar'
}
into("/usr/lib/$packageName/script") {
from "build/install/$project.name/bin"
include "$project.name"
}
}

installDist.dependsOn startScripts

buildDeb.dependsOn installDist

buildDeb {
link("/usr/bin/$project.name", "/usr/lib/$packageName/script/$project.name")
}

buildRpm.dependsOn buildDeb

buildRpm {
link("/usr/bin/$project.name", "/usr/lib/$packageName/script/$project.name")
}

distZip.dependsOn buildRpm

distZip {
// TODO: later...
Expand All @@ -175,6 +219,7 @@ distZip {
from 'xdg'
include '*.desktop'
include '*.png'
include 'prepare*.sh'
}
// legal stuff, examples, and documentation
into(project.name) {
Expand Down
4 changes: 2 additions & 2 deletions xdg/JFileSync3.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Encoding=UTF-8
Name=JFileSync3 - 3.0-SNAPSHOT
Comment=Syncing and Encryption
Exec=/opt/JFileSync3/bin/JFileSync3
Icon=/opt/JFileSync3/bin/JFileSync3.png
Exec=JFileSync3
Icon=JFileSync3.png
Categories=Application;Java
Version=1.0
Type=Application
Expand Down
17 changes: 17 additions & 0 deletions xdg/prepare_desktop_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
DIR=$(dirname $(readlink -f $0))
if [ -f $DIR/../lib/JFileSync3.jar ] ; then
if [ -f ~/.config/user-dirs.dirs ] ; then
DESKTOP_DIR=~/$(cat ~/.config/user-dirs.dirs |grep XDG_DESKTOP_DIR|sed -e 's/^.*HOME.\(.*\)./\1/g')
else
if [ -f ~/.config/user-dirs.dirs ] ; then
DESKTOP_DIR=~/$(cat /etc/xdg/user-dirs.defaults |grep DESKTOP|sed -e 's/^.*=\(.*\)$/\1/g')
else
DESKTOP_DIR=~/Desktop
fi
fi
PATTERN=$(echo $DIR|sed -e 's/\//\\\//g')\\/
sed -i.bak -e "s/^Exec=.*/Exec=${PATTERN}JFileSync3/" $DIR/JFileSync3.desktop
sed -i.bak -e "s/^Icon=.*/Icon=${PATTERN}JFileSync3.png/" $DIR/JFileSync3.desktop
rm $DIR/JFileSync3.desktop.bak
fi

0 comments on commit 65eaa6b

Please sign in to comment.