Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add real deb #484

Merged
merged 9 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/jvm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,30 @@ jobs:
with:
name: synology-spk
path: |
/toolkit/build_env/ds.apollolake-7.2/image/packages/*.spk
/toolkit/build_env/ds.apollolake-7.2/image/packages/*.spk
Build_DEB:
needs: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: get-version
uses: jactions/[email protected]
- uses: actions/download-artifact@v4
with:
name: maven-dist
path: target/
- name: Set short git commit SHA
id: vars
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote the variables in the shell script to prevent globbing and word splitting.

The static analysis tool has identified potential issues with unquoted variables in the shell script. To prevent unexpected behavior caused by globbing and word splitting, please quote the variables.

Apply this diff to fix the issues:

-          calculatedSha=$(git rev-parse --short ${{ github.sha }})
-          echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
+          calculatedSha=$(git rev-parse --short "${{ github.sha }}")
+          echo "COMMIT_SHORT_SHA=$calculatedSha" >> "$GITHUB_ENV"

Committable suggestion was skipped due to low confidence.

Tools
actionlint

103-103: shellcheck reported issue in this script: SC2086:info:2:43: Double quote to prevent globbing and word splitting

(shellcheck)


103-103: shellcheck reported issue in this script: SC2086:info:4:60: Double quote to prevent globbing and word splitting

(shellcheck)

run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
sed -i "s/<version>/${{ env.PBH_VERSION }}_$COMMIT_SHORT_SHA/g" pkg/deb/DEBIAN/control
cd pkg && dpkg -b deb peerbanhelper.${{ env.PBH_VERSION }}_$COMMIT_SHORT_SHA.deb
env:
PBH_VERSION: ${{ steps.get-version.outputs.version }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: deb
path: |
pkg/*.deb
2 changes: 1 addition & 1 deletion .github/workflows/jvm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Run build script
run: sudo PBH_VERSION=${{ env.PBH_VERSION }} IMAGE=${{ env.IMAGE }} bash synopkg/build-script.sh
run: sudo PBH_VERSION=${{ env.PBH_VERSION }} IMAGE=${{ env.IMAGE }} bash pkg/synopkg/build-script.sh
env:
PBH_VERSION: ${{ steps.get-version.outputs.version }}
IMAGE: ghostchu/peerbanhelper-snapshot:sha-${{ env.COMMIT_SHORT_SHA }}
Expand Down
1 change: 1 addition & 0 deletions pkg/deb/DEBIAN/conffiles
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/peerbanhelper/
8 changes: 8 additions & 0 deletions pkg/deb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: peerbanhelper
Version: <version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the placeholder version with the actual version number.

The Version field currently uses a placeholder <version>. Please replace it with the actual version number of the package before building the Debian package.

Depends: java-runtime (>=21)
Section: universe/net
Priority: optional
Architecture: all
Maintainer: Ghost_chu
Description: PeerBanHelper is a tool to auto ban peers on the bitorrent network
1 change: 1 addition & 0 deletions pkg/deb/DEBIAN/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/peerbanhelper
5 changes: 5 additions & 0 deletions pkg/deb/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
USER=peerbanhelper
adduser --system $USER
mkdir -p /etc/peerbanhelper
chown $USER /etc/peerbanhelper
Binary file added pkg/deb/usr/lib/peerbanhelper/PeerBanHelper.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions pkg/deb/usr/lib/systemd/system/peerbanhelper.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=PeerBanHelper Service
After=network.target
[Service]
User=peerbanhelper
WorkingDirectory=/etc/peerbanhelper
ExecStart=/usr/bin/java -Xmx386M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps -jar /usr/lib/peerbanhelper/PeerBanHelper.jar
Restart=on-failure
[Install]
WantedBy=multi-user.target

File renamed without changes.
Loading