Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 34 additions & 7 deletions .github/workflows/apt-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Consumes the .deb produced by the `release` workflow and publishes it to a
# signed apt repo hosted on GitHub Pages (https://UserJoo9.github.io/Netrex/)
# so Linux users can `apt-get install quota-manager` and upgrade via
# so Linux users can `apt-get install netrex` and upgrade via
# `apt-get update && apt-get upgrade`.
#
# Triggered:
Expand All @@ -11,6 +11,11 @@
# * workflow_dispatch with a `version` input — used once to backfill the
# already-released v0.1.2 .deb.
#
# Two packages are published per release: the real `netrex` package and a tiny
# transitional `quota-manager` (no files, Depends: netrex) so boxes that installed
# the old name move over on a plain `apt upgrade`. Older quota-manager versions
# stay in the pool untouched.
#
# The signing key is the armored PRIVATE key in the APT_REPO_GPG_KEY secret
# (user-generated, empty passphrase). The matching PUBLIC key is committed at
# the repo root as quota-manager.gpg and copied into the published repo so
Expand Down Expand Up @@ -85,14 +90,35 @@ jobs:
echo "tag=$TAG" >> "$GITHUB_OUTPUT"

- name: Download the .deb from GitHub Releases
id: debs
run: |
set -euo pipefail
VER="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
mkdir -p "$RUNNER_TEMP/deb"
gh release download "$TAG" --pattern "quota-manager_${VER}_all.deb" \
--dir "$RUNNER_TEMP/deb" --clobber
test -f "$RUNNER_TEMP/deb/quota-manager_${VER}_all.deb" # fail loudly if absent
if gh release download "$TAG" --pattern "netrex_${VER}_all.deb" \
--dir "$RUNNER_TEMP/deb" --clobber 2>/dev/null; then
test -f "$RUNNER_TEMP/deb/netrex_${VER}_all.deb"
echo "name=netrex" >> "$GITHUB_OUTPUT"
else
# A backfill of a release from before the rename (<= 0.5.x) ships the
# old name; publish it as it was, with no transitional package.
gh release download "$TAG" --pattern "quota-manager_${VER}_all.deb" \
--dir "$RUNNER_TEMP/deb" --clobber
test -f "$RUNNER_TEMP/deb/quota-manager_${VER}_all.deb" # fail loudly if absent
echo "name=quota-manager" >> "$GITHUB_OUTPUT"
fi

- name: Build the transitional quota-manager package
if: steps.debs.outputs.name == 'netrex'
run: |
set -euo pipefail
VER="${{ steps.version.outputs.version }}"
T="$RUNNER_TEMP/transitional"
rm -rf "$T"; mkdir -p "$T/DEBIAN"
sed -e "s/__VERSION__/${VER}/g" -e '/^#/d' packaging/DEBIAN/transitional.control.template > "$T/DEBIAN/control"
dpkg-deb --build --root-owner-group "$T" "$RUNNER_TEMP/deb/quota-manager_${VER}_all.deb"
dpkg-deb --info "$RUNNER_TEMP/deb/quota-manager_${VER}_all.deb"

- name: Install repo tooling (apt-ftparchive + gpg)
run: |
Expand Down Expand Up @@ -135,13 +161,14 @@ jobs:
cp "$RUNNER_TEMP/quota-manager.gpg" ./quota-manager.gpg
test -s quota-manager.gpg
touch .nojekyll # REQUIRED: else Jekyll strips pool/ and dists/
mkdir -p "pool/main/q/quota-manager" "dists/stable/main/binary-all"
mkdir -p "pool/main/q/quota-manager" "pool/main/n/netrex" "dists/stable/main/binary-all"
[ -f "$RUNNER_TEMP/deb/netrex_${VER}_all.deb" ] && cp "$RUNNER_TEMP/deb/netrex_${VER}_all.deb" "pool/main/n/netrex/"
cp "$RUNNER_TEMP/deb/quota-manager_${VER}_all.deb" "pool/main/q/quota-manager/"

- name: Generate Packages + Release
run: |
set -euo pipefail
# From the repo root so Filename: is pool/main/q/quota-manager/...
# From the repo root so Filename: is pool/main/<x>/<package>/...
apt-ftparchive packages pool > "dists/stable/main/binary-all/Packages"
gzip -9n -c "dists/stable/main/binary-all/Packages" > "dists/stable/main/binary-all/Packages.gz"
apt-ftparchive release \
Expand Down Expand Up @@ -174,7 +201,7 @@ jobs:
else
git -c user.name="github-actions[bot]" \
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -m "apt repo: publish quota-manager ${VER}"
commit -m "apt repo: publish netrex ${VER}"
git push origin gh-pages
fi

Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ jobs:

- name: Inspect the artifact (sanity)
run: |
dpkg-deb --info "dist/quota-manager_${{ steps.version.outputs.version }}_all.deb"
dpkg-deb --contents "dist/quota-manager_${{ steps.version.outputs.version }}_all.deb" | head -40
dpkg-deb --info "dist/netrex_${{ steps.version.outputs.version }}_all.deb"
dpkg-deb --contents "dist/netrex_${{ steps.version.outputs.version }}_all.deb" | head -40
V="${{ steps.version.outputs.version }}"
tar -tzf "dist/quota-manager-${V}.tar.gz" | head -8
rpm -qpl "dist/quota-manager-${V}-1.noarch.rpm" | head -8
tar --zstd -tf "dist/quota-manager-${V}-1-any.pkg.tar.zst" | head -8
tar -tzf "dist/netrex-${V}.tar.gz" | head -8
rpm -qpl "dist/netrex-${V}-1.noarch.rpm" | head -8
tar --zstd -tf "dist/netrex-${V}-1-any.pkg.tar.zst" | head -8
ls -l dist

# The release description = a short install note + this version's
Expand All @@ -88,13 +88,13 @@ jobs:
VER="${{ steps.version.outputs.version }}"
{ printf 'Netrex **v%s**.\n\n' "${VER}"
printf 'Install on the gateway laptop:\n\n'
printf '```bash\nsudo apt install ./quota-manager_%s_all.deb\n```\n\n' "${VER}"
printf '```bash\nsudo apt install ./netrex_%s_all.deb\n```\n\n' "${VER}"
printf 'Or, with the apt repository configured (see README):\n'
printf '```bash\nsudo apt-get update && sudo apt-get install quota-manager\n```\n\n'
printf '```bash\nsudo apt-get update && sudo apt-get install netrex\n```\n\n'
printf 'Other distros:\n\n'
printf '```bash\n# Fedora / RHEL family\nsudo dnf install ./quota-manager-%s-1.noarch.rpm\n\n' "${VER}"
printf '# Arch / Manjaro\nsudo pacman -U quota-manager-%s-1-any.pkg.tar.zst\n\n' "${VER}"
printf '# Any other systemd distro\ntar xzf quota-manager-%s.tar.gz && cd quota-manager-%s && sudo ./install.sh\n```\n\n' "${VER}" "${VER}"
printf '```bash\n# Fedora / RHEL family\nsudo dnf install ./netrex-%s-1.noarch.rpm\n\n' "${VER}"
printf '# Arch / Manjaro\nsudo pacman -U netrex-%s-1-any.pkg.tar.zst\n\n' "${VER}"
printf '# Any other systemd distro\ntar xzf netrex-%s.tar.gz && cd netrex-%s && sudo ./install.sh\n```\n\n' "${VER}" "${VER}"
printf 'The package configures the network stack, installs the Python\n'
printf 'dependencies into `/opt/quota-manager/.venv`, wires the\n'
printf '`quota-gateway` systemd service and starts it. See the README for\n'
Expand Down Expand Up @@ -137,8 +137,8 @@ jobs:
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
files: |
release-assets/dist/quota-manager_*.deb
release-assets/dist/quota-manager-*.tar.gz
release-assets/dist/quota-manager-*.rpm
release-assets/dist/quota-manager-*.pkg.tar.zst
release-assets/dist/netrex_*.deb
release-assets/dist/netrex-*.tar.gz
release-assets/dist/netrex-*.rpm
release-assets/dist/netrex-*.pkg.tar.zst
body_path: release-assets/release_body.md
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Added:
- **Internet schedule** (new page). Turn the internet off at set times of the week for chosen people (all their devices) or single devices: bedtime on school nights, study time, meal times. One click starts from a ready plan ("School nights", "Every night", "Study time", "Meal times"); a schedule can have several times, a time can run past midnight, and dates can be marked as days off (holidays, Eid). **Bonus time** gives a few extra minutes without changing the schedule. **Always allowed** sites (a school platform, a study site) keep working during every schedule. While a schedule is on, the device's card shows when the internet comes back, the home network (printer, shared drives, the dashboard) keeps working, and the cut is done by the gateway itself, so it works on any phone, tablet, TV or console with no app. Each device gets its end time in the system kernel, so it comes back online on time even if the gateway service restarts or stops. Sites on the "always allowed" list only open on devices that look names up through the gateway; a phone with Private DNS (or a browser with secure DNS) turned on keeps them blocked during a schedule. Contributed by @amr-elgharip2006. Closes #32.

Changed:
- **The packages are now named Netrex.** The files are `netrex_<version>_all.deb`, `netrex-<version>-1.noarch.rpm`, `netrex-<version>-1-any.pkg.tar.zst` and `netrex-<version>.tar.gz`, and the apt command is `sudo apt-get install netrex`. If you installed it as `quota-manager`, the dashboard updater, `apt-get install netrex` and `dnf install` move you over by themselves: the old package is replaced, and your settings, data and users stay where they were. Nothing else was renamed (service, folders and database are unchanged).
- A new version is now published only after all the tests and the install checks on Debian, Ubuntu, Fedora and Arch pass on exactly that version. Contributed by @compnew2006.

Fixed:
Expand Down
12 changes: 8 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ belongs, and which mistakes already cost a real outage. Deep technical detail li

The user-facing name is **Netrex** (UI, titles, READMEs, release notes, TOTP issuer,
passkey display name). Internal identifiers deliberately KEEP the old name so
existing installs, packages and the apt repo keep working: package `quota-manager`,
`/opt/quota-manager`, services `quota-gateway`/`quota-wan-ppp`, `/etc/quota-gateway`,
`/var/lib/quota-gateway`, nft tables `quota_*`, release asset names
`quota-manager_*`, the apt key `quota-manager.gpg`, apt `Origin`/`Label: Quota Manager`
existing installs and the apt repo keep working: `/opt/quota-manager`, services
`quota-gateway`/`quota-wan-ppp`, `/etc/quota-gateway`, `/var/lib/quota-gateway`, nft
tables `quota_*`, the apt key `quota-manager.gpg`, apt `Origin`/`Label: Quota Manager`
(changing them makes apt refuse the repo), and the passkey `USER_ID`. Don't rename those.
**Packages and release assets ARE named `netrex`** since 0.6.0 (`netrex_<v>_all.deb`, ...);
the deb/rpm metadata declares `quota-manager` as replaced (Breaks/Replaces, Obsoletes; the
Arch pacman package keeps the name `quota-manager`, only its file is `netrex-*`) and the apt repo also carries a tiny transitional `quota-manager`
(`Depends: netrex`, built by `apt-repo.yml`, never a release asset). Updaters find assets by
SUFFIX (every version since 0.2), so the file names can change; keep it that way.

## 1. What this is

Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,22 @@ curl -fsSL https://UserJoo9.github.io/Netrex/quota-manager.gpg | \
echo "deb [signed-by=/etc/apt/keyrings/quota-manager.gpg] https://UserJoo9.github.io/Netrex stable main" | \
sudo tee /etc/apt/sources.list.d/quota-manager.list
sudo apt-get update
sudo apt-get install quota-manager
sudo apt-get install netrex
```

Prefer a single file? Download `quota-manager_<version>_all.deb` from [Releases](https://github.com/UserJoo9/Netrex/releases) and run `sudo apt install ./quota-manager_*_all.deb`.
Prefer a single file? Download `netrex_<version>_all.deb` from [Releases](https://github.com/UserJoo9/Netrex/releases) and run `sudo apt install ./netrex_*_all.deb`.

**Other distros** - download the matching file from [Releases](https://github.com/UserJoo9/Netrex/releases):

```bash
# Fedora / RHEL family
sudo dnf install ./quota-manager-<version>-1.noarch.rpm
sudo dnf install ./netrex-<version>-1.noarch.rpm

# Arch / Manjaro
sudo pacman -U quota-manager-<version>-1-any.pkg.tar.zst
sudo pacman -U netrex-<version>-1-any.pkg.tar.zst

# Any other systemd distro
tar xzf quota-manager-<version>.tar.gz && cd quota-manager-<version> && sudo ./install.sh
tar xzf netrex-<version>.tar.gz && cd netrex-<version> && sudo ./install.sh
```

The in-app updater picks the right file for how you installed. Fedora and Arch support is new: if your box runs SELinux or firewalld and forwarded traffic is blocked, set `QUOTA_DISABLE_FIREWALLD=1` before installing, or open an issue with the output.
Expand Down Expand Up @@ -243,11 +243,14 @@ Handy to know:
The dashboard checks for updates itself (**System → Updates**) and can install them in one click. Your settings and data are kept.

```bash
sudo apt-get update && sudo apt-get install --only-upgrade quota-manager # update
sudo apt remove quota-manager # remove, keep data
sudo apt purge quota-manager # remove everything
sudo apt-get update && sudo apt-get install --only-upgrade netrex # update
sudo apt remove netrex # remove, keep data
sudo apt purge netrex # remove everything
```

> Installed it earlier as `quota-manager`? Run `sudo apt-get update && sudo apt-get install netrex` once (or update from the dashboard). The old package is removed automatically; your settings and data stay. Use `apt-get install`, not `apt-get upgrade`: `upgrade` skips packages it has to newly install.


Your data lives in `/var/lib/quota-gateway/quota.db`. To back it up (safe while the gateway is running):

```bash
Expand Down
17 changes: 12 additions & 5 deletions README_AR.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ curl -fsSL https://UserJoo9.github.io/Netrex/quota-manager.gpg | \
echo "deb [signed-by=/etc/apt/keyrings/quota-manager.gpg] https://UserJoo9.github.io/Netrex stable main" | \
sudo tee /etc/apt/sources.list.d/quota-manager.list
sudo apt-get update
sudo apt-get install quota-manager
sudo apt-get install netrex
```

<div dir="rtl">

تفضّل ملف واحد؟ نزّل `quota-manager_<version>_all.deb` من [الإصدارات](https://github.com/UserJoo9/Netrex/releases) ونفّذ `sudo apt install ./quota-manager_*_all.deb`.
تفضّل ملف واحد؟ نزّل `netrex_<version>_all.deb` من [الإصدارات](https://github.com/UserJoo9/Netrex/releases) ونفّذ `sudo apt install ./netrex_*_all.deb`.

بعدها كمّل على [الإعداد الأول](#الإعداد-الأول).

Expand Down Expand Up @@ -250,11 +250,18 @@ http://192.168.2.1:8080
</div>

```bash
sudo apt-get update && sudo apt-get install --only-upgrade quota-manager # تحديث
sudo apt remove quota-manager # إزالة مع الاحتفاظ بالبيانات
sudo apt purge quota-manager # إزالة كاملة
sudo apt-get update && sudo apt-get install --only-upgrade netrex # تحديث
sudo apt remove netrex # إزالة مع الاحتفاظ بالبيانات
sudo apt purge netrex # إزالة كاملة
```

<div dir="rtl">

> لو كنت مثبّت النسخة القديمة باسم `quota-manager`، نفّذ `sudo apt-get update && sudo apt-get install netrex` مرة واحدة (أو حدّث من اللوحة). الحزمة القديمة بتتشال لوحدها وإعداداتك وبياناتك بتفضل زي ما هي. استخدم `apt-get install` مش `apt-get upgrade` لأن `upgrade` بيتجاهل الحزم الجديدة.

</div>


<div dir="rtl">

بياناتك موجودة في `/var/lib/quota-gateway/quota.db`. عشان تاخد نسخة احتياطية منها (آمن والبوابة شغالة):
Expand Down
Loading
Loading