-
Notifications
You must be signed in to change notification settings - Fork 0
Add Fedora/RPM packaging support #101
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
Changes from all commits
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,4 @@ | ||
| # Ignore all build artifacts in this directory | ||
| * | ||
| # But keep this .gitignore file | ||
| !.gitignore |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,54 @@ | ||||||
| # SPDX-FileCopyrightText: 2025 Project516 <[email protected]> | ||||||
| # | ||||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|
|
||||||
| Name: numberguessinggame | ||||||
| Version: 1.0.0 | ||||||
| Release: 1%{?dist} | ||||||
| Summary: A simple number guessing game | ||||||
|
|
||||||
| License: GPL-3.0-or-later | ||||||
| URL: https://github.com/Project516/NumberGuessingGame | ||||||
| Source0: game.jar | ||||||
|
|
||||||
| BuildArch: noarch | ||||||
| Requires: java-1.8.0-openjdk-headless | ||||||
|
||||||
| Requires: java-1.8.0-openjdk-headless | |
| Requires: java-headless >= 1:1.8.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| #!/bin/sh | ||
|
|
||
| # SPDX-FileCopyrightText: 2025 Project516 <[email protected]> | ||
| # | ||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
| # Script to create a Fedora/RPM package (.rpm) for Number Guessing Game | ||
| # This package can be installed on Fedora, RHEL, CentOS, and other RPM-based distributions | ||
| # Usage: ./package-rpm.sh | ||
| # Output: numberguessinggame-1.0.0-1.noarch.rpm | ||
|
|
||
| # Exit immediately if any command fails | ||
| set -e | ||
|
|
||
| echo "Building Number Guessing Game RPM package..." | ||
|
|
||
| # Check if rpmbuild is installed | ||
| if ! command -v rpmbuild >/dev/null 2>&1; then | ||
| echo "Error: rpmbuild not found. Please install rpm-build:" | ||
| echo " Fedora/RHEL: sudo dnf install rpm-build" | ||
| echo " Ubuntu/Debian: sudo apt install rpm" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Clean up any previous build artifacts | ||
| echo "Cleaning up previous builds..." | ||
| rm -rf ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm | ||
| rm -rf ~/rpmbuild/BUILD/numberguessinggame-* | ||
| rm -rf ~/rpmbuild/BUILDROOT/numberguessinggame-* | ||
| rm -f numberguessinggame-*.rpm | ||
|
|
||
| # Build the application using Gradle | ||
| echo "Building application..." | ||
| ./gradlew build | ||
|
|
||
| # Create RPM build directory structure | ||
| echo "Setting up RPM build environment..." | ||
| mkdir -p ~/rpmbuild/BUILD | ||
| mkdir -p ~/rpmbuild/RPMS | ||
| mkdir -p ~/rpmbuild/SOURCES | ||
| mkdir -p ~/rpmbuild/SPECS | ||
| mkdir -p ~/rpmbuild/SRPMS | ||
|
|
||
| # Copy the spec file to the SPECS directory | ||
| echo "Copying spec file..." | ||
| cp fedora-package/SPECS/numberguessinggame.spec ~/rpmbuild/SPECS/numberguessinggame.spec | ||
|
|
||
| # Copy the JAR file to the SOURCES directory | ||
| echo "Copying JAR file..." | ||
| cp app/build/libs/app-all.jar ~/rpmbuild/SOURCES/game.jar | ||
|
|
||
| # Build the RPM package | ||
| echo "Building RPM package..." | ||
| rpmbuild -bb ~/rpmbuild/SPECS/numberguessinggame.spec | ||
|
|
||
| # Copy the built RPM to the current directory | ||
| echo "Copying RPM package to current directory..." | ||
| cp ~/rpmbuild/RPMS/noarch/numberguessinggame-*.rpm . | ||
|
|
||
| # Display success message with installation instructions | ||
| echo "" | ||
| echo "✓ RPM package created: $(ls numberguessinggame-*.rpm)" | ||
| echo "" | ||
| echo "To install on Fedora/RHEL/CentOS, run:" | ||
| echo " sudo dnf install ./numberguessinggame-*.rpm" | ||
| echo "" | ||
| echo "Or on older systems:" | ||
| echo " sudo yum install ./numberguessinggame-*.rpm" | ||
| echo "" | ||
| echo "After installation, run the game with:" | ||
| echo " numberguessinggame" | ||
| echo "" |
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.
The download URL includes a hardcoded version "1.0.0-1" in the filename (
numberguessinggame-1.0.0-1.noarch.rpm), but uses a placeholder0.x.yfor the release tag. This is inconsistent with the DEB instructions (line 22) which only use placeholders. For consistency and to avoid confusion, consider using a placeholder pattern likenumberguessinggame-*.rpmornumberguessinggame-1.0.0-1.noarch.rpmwith a matching release tag placeholder.