init: first commit

This commit is contained in:
2026-01-09 23:34:33 +08:00
commit 708f2dc4f2
6 changed files with 360 additions and 0 deletions

194
.github/workflows/build_rpm.yml vendored Normal file
View File

@@ -0,0 +1,194 @@
name: build rpm packages
on:
schedule:
- cron: '0 0 * * *' # Run daily
workflow_dispatch:
permissions:
contents: write
jobs:
check_version:
runs-on: ubuntu-latest
outputs:
build: ${{ steps.check.outputs.build }}
version: ${{ steps.check.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for updates
id: check
run: |
LATEST_TAG=$(curl -s https://api.github.com/repos/fatedier/frp/releases/latest | jq -r .tag_name)
LATEST_VERSION=${LATEST_TAG#v}
echo "Latest version: $LATEST_VERSION"
CURRENT_VERSION=$(cat latest_version.txt 2>/dev/null || echo "0.0.0")
echo "Current version: $CURRENT_VERSION"
if [ "$LATEST_VERSION" == "$CURRENT_VERSION" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "Already up to date."
echo "build=false" >> $GITHUB_OUTPUT
else
echo "New version available."
echo "build=true" >> $GITHUB_OUTPUT
echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
fi
build:
needs: check_version
if: needs.check_version.outputs.build == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, aarch64]
container:
image: fedora:latest # Build on latest Fedora as base for universal package
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: dnf install -y rpm-build rpmdevtools wget git systemd-rpm-macros
- name: Download sources
run: |
VERSION=${{ needs.check_version.outputs.version }}
ARCH=${{ matrix.arch }}
if [ "$ARCH" == "x86_64" ]; then
GOARCH="amd64"
elif [ "$ARCH" == "aarch64" ]; then
GOARCH="arm64"
fi
mkdir -p ~/rpmbuild/SOURCES
# Download FRP binary
wget https://github.com/fatedier/frp/releases/download/v${VERSION}/frp_${VERSION}_linux_${GOARCH}.tar.gz -O ~/rpmbuild/SOURCES/frp_${VERSION}_linux_${GOARCH}.tar.gz
# Copy service files to SOURCES
cp frpc@.service ~/rpmbuild/SOURCES/
cp frps@.service ~/rpmbuild/SOURCES/
- name: Build RPM
run: |
VERSION=${{ needs.check_version.outputs.version }}
rpmbuild -bb \
--define "_version ${VERSION}" \
--define "_release 1" \
--target ${{ matrix.arch }} \
frp.spec
# Rename artifacts to include version if not already obvious, but rpmbuild naming is standard.
# Standard: name-ver-rel.dist.arch.rpm
# We'll just list them to be sure
ls -l ~/rpmbuild/RPMS/${{ matrix.arch }}/
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: frp-rpm-${{ matrix.arch }}
path: /github/home/rpmbuild/RPMS/${{ matrix.arch }}/*.rpm
release:
needs: [check_version, build]
if: needs.check_version.outputs.build == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.check_version.outputs.version }}
name: FRP v${{ needs.check_version.outputs.version }}
body: |
Auto RPM build for frp v${{ needs.check_version.outputs.version }}
Universal RPM packages for x86_64 and aarch64.
files: |
artifacts/**/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo:
needs: [check_version, build]
if: needs.check_version.outputs.build == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Setup Repo Structure
run: |
mkdir -p repo
# Artifacts are named frp-rpm-{arch}
# We want structure: repo/{arch}/
for dir in artifacts/*; do
dirname=$(basename "$dir")
# Extract arch from frp-rpm-<arch>
# dirname format: frp-rpm-<arch>
arch=$(echo $dirname | sed -E 's/frp-rpm-//')
mkdir -p repo/$arch
cp $dir/*.rpm repo/$arch/
done
# Generate frp.repo
echo "[frp]
name=FRP Packages for Fedora - \$basearch
baseurl=https://awfufu.github.io/frp-pkgs/\$basearch/
enabled=1
gpgcheck=0" > repo/frp.repo
# Generate index.html
echo "<html><body><h1>FRP RPM Repository</h1><p>Use the following command to configure this repository:</p><pre>sudo dnf config-manager --add-repo https://awfufu.github.io/frp-pkgs/frp.repo</pre></body></html>" > repo/index.html
# Generate index.html
echo "<html><body><h1>FRP RPM Repository</h1><p>Use the following command to configure this repository:</p><pre>sudo dnf config-manager --add-repo https://awfufu.github.io/frp-pkgs/frp.repo</pre></body></html>" > repo/index.html
- name: Generate Repodata
run: |
sudo apt-get update
sudo apt-get install -y createrepo-c
for dir in repo/fc*/*; do
echo "Processing $dir..."
createrepo_c "$dir"
done
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./repo
keep_files: true
commit_message: "Update repo for v${{ needs.check_version.outputs.version }}"
- name: Update version record
run: |
echo "${{ needs.check_version.outputs.version }}" > latest_version.txt
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git config --global --add safe.directory '*'
git add latest_version.txt
git commit -m "Update to v${{ needs.check_version.outputs.version }}"
git push

59
README.md Normal file
View File

@@ -0,0 +1,59 @@
# FRP RPM Packages for Fedora
Auto RPM build for [frp](https://github.com/fatedier/frp) (Fast Reverse Proxy), tracking the official releases.
**Features:**
- **Automated**: Builds are triggered daily to check for new upstream releases.
- **Native**: Built natively for **Fedora 41, 42, 43**.
- **Multi-Arch**: Supports both **x86_64** (AMD64) and **aarch64** (ARM64).
- **Split Packages**: Separate `frpc` and `frps` packages.
- **Systemd Integration**: Includes `frpc@.service` and `frps@.service` templates.
### Installation
Add the repository to your system to receive automatic updates.
```bash
sudo dnf config-manager --add-repo https://awfufu.github.io/frp-pkgs/frp.repo
sudo dnf install frpc frps
```
### Usage
#### Client (frpc)
1. **Configuration**: Edit the configuration file:
```bash
sudo vim /etc/frpc/frpc.toml
```
*For multiple instances, you can create separate config files like `/etc/frpc/my-proxy.toml`.*
2. **Start Service**:
```bash
# If using default /etc/frpc/frpc.toml:
sudo systemctl enable --now frpc@frpc
# If using /etc/frpc/my-proxy.toml:
sudo systemctl enable --now frpc@my-proxy
```
3. **Check Status**:
```bash
systemctl status frpc@frpc
```
#### Server (frps)
1. **Configuration**: Edit `/etc/frpc/frps.toml`.
2. **Start Service**:
```bash
sudo systemctl enable --now frps@frps
```
#### Build Status
| Fedora Version | Status |
|----------------|--------|
| Fedora 41 | ![Build Status](https://github.com/awfufu/frp-pkgs/actions/workflows/build_rpm.yml/badge.svg) |
| Fedora 42 | ![Build Status](https://github.com/awfufu/frp-pkgs/actions/workflows/build_rpm.yml/badge.svg) |
| Fedora 43 | ![Build Status](https://github.com/awfufu/frp-pkgs/actions/workflows/build_rpm.yml/badge.svg) |

78
frp.spec Normal file
View File

@@ -0,0 +1,78 @@
%global debug_package %{nil}
%global __os_install_post %{nil}
%if "%{_target_cpu}" == "x86_64"
%global goarch amd64
%endif
%if "%{_target_cpu}" == "aarch64"
%global goarch arm64
%endif
Name: frp
Version: %{_version}
Release: %{_release}
Summary: A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
License: Apache-2.0
URL: https://github.com/fatedier/frp
Source0: https://github.com/fatedier/frp/releases/download/v%{version}/frp_%{version}_linux_%{goarch}.tar.gz
Source1: frpc@.service
Source2: frps@.service
BuildRequires: systemd-rpm-macros
%description
frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
%package -n frpc
Summary: Client for frp
Requires: systemd
%description -n frpc
Client for frp (Fast Reverse Proxy).
%package -n frps
Summary: Server for frp
Requires: systemd
%description -n frps
Server for frp (Fast Reverse Proxy).
%prep
%setup -q -n frp_%{version}_linux_%{goarch}
%build
# Binaries are already compiled in the release tarball
%install
install -d -m 755 %{buildroot}%{_bindir}
install -d -m 755 %{buildroot}%{_sysconfdir}/frpc
install -d -m 755 %{buildroot}%{_sysconfdir}/frps
install -d -m 755 %{buildroot}%{_unitdir}
install -m 755 frpc %{buildroot}%{_bindir}/frpc
install -m 755 frps %{buildroot}%{_bindir}/frps
install -m 644 frpc.toml %{buildroot}%{_sysconfdir}/frpc/frpc.toml
install -m 644 frps.toml %{buildroot}%{_sysconfdir}/frps/frps.toml
# Install systemd service templates
install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/frpc@.service
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/frps@.service
%files -n frpc
%license LICENSE
%{_bindir}/frpc
%dir %{_sysconfdir}/frpc
%config(noreplace) %{_sysconfdir}/frpc/frpc.toml
%{_unitdir}/frpc@.service
%files -n frps
%license LICENSE
%{_bindir}/frps
%dir %{_sysconfdir}/frps
%config(noreplace) %{_sysconfdir}/frps/frps.toml
%{_unitdir}/frps@.service
%changelog
* Fri Jan 09 2026 awfufu <awfufu@example.com> - %{version}-%{release}
- Automated build

14
frpc@.service Normal file
View File

@@ -0,0 +1,14 @@
[Unit]
Description=FRP Client (%i)
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
WorkingDirectory=/etc/frpc
ExecStart=/usr/bin/frpc -c /etc/frpc/%i.toml
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=default.target

14
frps@.service Normal file
View File

@@ -0,0 +1,14 @@
[Unit]
Description=FRP Server (%i)
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
WorkingDirectory=/etc/frps
ExecStart=/usr/bin/frps -c /etc/frps/%i.toml
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=default.target

1
latest_version.txt Normal file
View File

@@ -0,0 +1 @@
0.0.0