-
-
Notifications
You must be signed in to change notification settings - Fork 37
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 freebsd pkg #539
Add freebsd pkg #539
Changes from 15 commits
8532202
dccaeb4
02b1efd
492554f
2924fcd
8de7567
35ac11f
4a37887
58d9b97
4d3d59e
6e602bc
47bf39f
b4173be
6b57dd8
76fc6e1
f172aba
d522844
ff3ce2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: FreeBSD pkg Package Build | ||
|
||
on: | ||
workflow_call: | ||
jobs: | ||
pkg: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: java_info | ||
uses: YunaBraska/java-info-action@main | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: maven-dist | ||
path: target/ | ||
- name: Replace pkg version | ||
run: | | ||
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | ||
sed -i "s/<version>/${{ env.PBH_VERSION }}/g" pkg/pkg/MANIFEST | ||
env: | ||
PBH_VERSION: ${{ steps.java_info.outputs.project_version }} | ||
- name: Build FreeBSD pkg | ||
uses: vmactions/freebsd-vm@v1 | ||
with: | ||
usesh: true | ||
run: | | ||
mkdir -p pkg/pkg/work-dir/usr/local/lib/peerbanhelper | ||
cp target/PeerBanHelper.jar pkg/pkg/work-dir/usr/local/lib/peerbanhelper/ | ||
pkg create -M pkg/pkg/MANIFEST -r pkg/pkg/work-dir -p pkg/pkg/pkg-plist -o pkg/ | ||
pkg info -F pkg/peerbanhelper-${{ env.PBH_VERSION }}.pkg | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pkg-dist | ||
path: | | ||
pkg/*.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,11 +67,15 @@ jobs: | |
with: | ||
name: deb-dist | ||
path: target/media | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: pkg-dist | ||
path: target/media | ||
- uses: alexellis/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
asset_paths: '["target/PeerBanHelper.jar", "target/media/PeerBanHelper_*", "target/media/peerbanhelper_*", "target/media/*.spk"]' | ||
asset_paths: '["target/PeerBanHelper.jar", "target/media/PeerBanHelper_*", "target/media/peerbanhelper_*", "target/media/peerbanhelper-*"' | ||
Build_Docker: | ||
permissions: | ||
contents: write | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "peerbanhelper", | ||
"version": "<version>", | ||
"origin": "net/peerbanhelper", | ||
"comment": "Tool to auto ban peers on the bittorrent network", | ||
"desc": "PeerBanHelper is a tool to auto ban peers on the bittorrent network", | ||
"maintainer": "[email protected]", | ||
"www": "https://github.com/PBH-BTN/PeerBanHelper", | ||
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace version placeholder and verify maintainer email
Apply this diff to fix the version placeholder (replace X.Y.Z with the actual version number): - "version": "<version>",
+ "version": "X.Y.Z",
|
||
"deps": { | ||
"openjdk21": { | ||
"origin": "java/openjdk21", | ||
"version": "21.0" | ||
} | ||
}, | ||
"categories": ["net"], | ||
"prefix":"/usr/local", | ||
"licenselogic": "single", | ||
"licenses": [ | ||
"BSD" | ||
], | ||
"scripts": { | ||
"post-install": "post-install" | ||
} | ||
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Post-install script requires enhancements The 🔗 Analysis chainVerify post-install script A post-install script is specified, but its contents are not visible in this manifest. Please ensure that:
Run the following script to check for the existence of the post-install script: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for the existence of the post-install script
# Test: Search for the post-install script. Expect: File exists and is not empty.
fd -t f 'post-install' | xargs -I {} sh -c 'if [ -s "{}" ]; then echo "Found non-empty post-install script: {}"; else echo "Error: post-install script not found or empty: {}"; fi'
Length of output: 239 Script: #!/bin/bash
# Description: Display the contents of the post-install script
# Test: Output the contents of pkg/pkg/post-install
cat pkg/pkg/post-install
Length of output: 218 |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/usr/local/lib/peerbanhelper/PeerBanHelper.jar | ||
/usr/local/etc/rc.d/peerbanhelper | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Issues Detected: Missing Files and Dependencies
These issues indicate that the pkg-plist references files that are missing and necessary dependencies are not specified. 🔗 Analysis chainLGTM! Consider adding configuration and specifying dependencies. The pkg-plist file correctly lists the JAR file and the rc script for the PeerBanHelper. However, there are a few suggestions to improve the package:
You might want to add the following lines to the pkg-plist:
This will add a sample configuration file and set appropriate permissions for the rc script. To ensure the package is set up correctly, you can run the following script: This script will help verify the presence and permissions of the package files, as well as check for Java installation. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Verify the PeerBanHelper package setup
# Check if the JAR file exists
if [ -f /usr/local/lib/peerbanhelper/PeerBanHelper.jar ]; then
echo "PeerBanHelper.jar found"
else
echo "PeerBanHelper.jar not found"
fi
# Check if the rc script exists and has correct permissions
if [ -f /usr/local/etc/rc.d/peerbanhelper ]; then
echo "peerbanhelper rc script found"
ls -l /usr/local/etc/rc.d/peerbanhelper
else
echo "peerbanhelper rc script not found"
fi
# Check for a configuration file
if [ -f /usr/local/etc/peerbanhelper.conf ]; then
echo "Configuration file found"
else
echo "Configuration file not found"
fi
# Check if Java is installed
if command -v java >/dev/null 2>&1; then
echo "Java is installed"
else
echo "Java is not installed"
fi
Length of output: 433 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,4 @@ | ||||||
#!/bin/sh | ||||||
echo "Thansk for using peerbanhelper. Your config file will be placed at /usr/local/etc/peerbanhelper" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo in the echo statement There's a typo in the word "Thanks" at the beginning of the echo statement. Please apply the following correction: -echo "Thansk for using peerbanhelper. Your config file will be placed at /usr/local/etc/peerbanhelper"
+echo "Thanks for using peerbanhelper. Your config file will be placed at /usr/local/etc/peerbanhelper" 📝 Committable suggestion
Suggested change
|
||||||
echo "To auto start peerbanhelper, please run: sysrc peerbanhelper_enable=YES" | ||||||
mkdir -p /usr/local/var/db/peerbanhelper |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
# | ||
# PROVIDE: peerbanhelper | ||
# REQUIRE: LOGIN | ||
# KEYWORD: shutdown | ||
|
||
. /etc/rc.subr | ||
|
||
name="peerbanhelper" | ||
rcvar=peerbanhelper_enable | ||
|
||
load_rc_config $name | ||
|
||
: ${peerbanhelper_enable:=NO} | ||
: ${peerbanhelper_user:="root"} | ||
: ${peerbanhelper_dir:="/usr/local/var/db/peerbanhelper"} | ||
: ${peerbanhelper_classpath:="/usr/local/lib/peerbanhelper/PeerBanHelper.jar"} | ||
: ${peerbanhelper_jvm_flags:="-Dpbh.datadir=${peerbanhelper_dir} -Xmx386M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps"} | ||
: ${peerbanhelper_command:="/usr/local/bin/java ${peerbanhelper_jvm_flags} -jar ${peerbanhelper_classpath}"} | ||
|
||
command="/usr/sbin/daemon" | ||
command_args="-f -p /var/run/${name}.pid -u ${peerbanhelper_user} ${peerbanhelper_command}" | ||
run_rc_command "$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Pin the Java info action to a specific version.
While using the latest version of
actions/checkout
is good practice, it's recommended to pin theYunaBraska/java-info-action
to a specific version to ensure reproducibility and prevent unexpected changes in your workflow.Consider updating the Java info action step as follows:
Replace
v1.12.0
with the latest stable version available at the time of implementation.📝 Committable suggestion