/ linuxy / scripts / build-rpm.sh
Swadhin Biswas Ci/improve release notes (#41) · 8/28/2026
04d550f
81 lines · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Build RPM package from DEB for Linuxy
# Requires: fpm (gem install fpm)
# Run scripts/build.sh first to generate DEB

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
TAURI_TARGET="$PROJECT_ROOT/src-tauri/target"

echo "=== Building RPM from DEB package ==="

# Check if fpm is installed and usable
if ! command -v fpm &> /dev/null; then
    echo "Error: fpm is not installed."
    echo "To build RPM, install fpm with: gem install fpm"
    echo "Or on Arch Linux: sudo pacman -S ruby base-devel && gem install fpm"
    exit 1
fi

# Check if rpmbuild is available
if ! command -v rpmbuild &> /dev/null; then
    echo "Error: rpmbuild is not installed."
    echo "Install it with:"
    echo "  Debian/Ubuntu: sudo apt install rpm"
    echo "  Fedora: sudo dnf install rpm-build"
    echo "  Arch: sudo pacman -S rpm-tools"
    echo "  Alpine: sudo apk add rpm-build"
    exit 1
fi

if ! fpm --version &> /dev/null; then
    echo "Error: fpm is present in PATH but unusable."
    echo "The Ruby environment cannot load the fpm gem for this executable."
    echo "In CI, install it system-wide with: sudo gem install --no-document fpm"
    exit 1
fi

# Find the latest DEB package
DEB_PACKAGE=$(ls -t "$TAURI_TARGET/release/bundle/deb/"*.deb 2>/dev/null | head -n1)

if [ -z "$DEB_PACKAGE" ]; then
    echo "Error: No DEB package found. Run 'bun run tauri build' first."
    exit 1
fi

echo "Found DEB package: $DEB_PACKAGE"

# Create RPM output directory
RPM_OUTPUT="$TAURI_TARGET/release/bundle/rpm"
mkdir -p "$RPM_OUTPUT"

# Extract version from DEB filename (supports linuxy_X.Y.Z_amd64.deb and Linuxy_X.Y.Z_amd64.deb)
VERSION=$(basename "$DEB_PACKAGE" | sed 's/[Ll]inuxy_\([0-9.]*\)_amd64.deb/\1/')
echo "Version: $VERSION"

# Convert DEB to RPM using fpm
echo "Converting DEB to RPM..."
fpm --input-type deb \
    --output-type rpm \
    --no-auto-depends \
    --name linuxy \
    --version "$VERSION" \
    --architecture x86_64 \
    --url "https://github.com/swadhinbiswas/linuxy" \
    --description "One-click Linux Application Manager with Firejail sandboxing" \
    --maintainer "Swadhin Biswas" \
    --license MIT \
    --depends firejail \
    --depends xdg-utils \
    --depends gtk3 \
    --depends webkit2gtk4.1 \
    --depends libappindicator-gtk3 \
    --package "$RPM_OUTPUT/linuxy-${VERSION}-1.x86_64.rpm" \
    "$DEB_PACKAGE"

echo "=== RPM build complete ==="
echo "RPM package: $RPM_OUTPUT/linuxy-${VERSION}-1.x86_64.rpm"
ls -la "$RPM_OUTPUT/"*.rpm