Skip to content

Commit 1e9bb86

Browse files
committed
Initial
1 parent 31cd2b8 commit 1e9bb86

File tree

4 files changed

+137
-6
lines changed

4 files changed

+137
-6
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build DEB Package
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main, master ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: '1.21'
25+
26+
- name: Install nfpm
27+
run: |
28+
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
29+
30+
- name: Create output directory
31+
run: |
32+
rm -rf out
33+
mkdir -p out
34+
35+
- name: Update version in nfpm.yaml if tagged
36+
if: startsWith(github.ref, 'refs/tags/v')
37+
run: |
38+
VERSION=${GITHUB_REF#refs/tags/v}
39+
sed -i "s/version: \"[^\"]*\"/version: \"$VERSION\"/" nfpm.yaml
40+
41+
- name: Build DEB package
42+
run: |
43+
nfpm pkg --packager deb --target out
44+
45+
- name: Generate checksums
46+
run: |
47+
cd out
48+
sha256sum -b -- * > sha256sum.txt
49+
50+
- name: Upload artifacts
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: deb-package
54+
path: out/
55+
56+
- name: Create Release
57+
if: startsWith(github.ref, 'refs/tags/v')
58+
uses: softprops/action-gh-release@v1
59+
with:
60+
files: |
61+
out/*.deb
62+
out/sha256sum.txt
63+
draft: false
64+
prerelease: false
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,31 @@ This will revert your system to a "no subscription key" status.
5454

5555
### Building the Package
5656

57+
#### Automated Build (Recommended)
58+
59+
The package is automatically built using GitHub Actions on every push and release. Simply:
60+
61+
1. Push your changes to the repository
62+
2. For releases, create a git tag: `git tag v0.0.12 && git push origin v0.0.12`
63+
3. The DEB package will be available in the GitHub release or as an artifact
64+
65+
#### Manual Build
66+
5767
Install [nFPM](https://nfpm.goreleaser.com/install/), then:
5868

5969
```shell
6070
./package.sh
6171
```
6272

73+
Or use nfpm directly:
74+
75+
```shell
76+
rm -rf out
77+
mkdir -p out
78+
nfpm pkg --packager deb --target out
79+
cd out && sha256sum -b -- * > sha256sum.txt
80+
```
81+
6382
### Compatibility Information for Old Proxmox VE Versions
6483

6584
#### PVE 4.x

package.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/bin/bash
2+
# Local build script for testing
3+
# Production builds are handled by GitHub Actions (.github/workflows/build.yml)
4+
25
set -Eeuo pipefail
36
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1
47

58
OUT_DIR="out"
69

10+
echo "Building DEB package locally..."
11+
echo "For production builds, use GitHub Actions by pushing to the repository"
12+
echo ""
13+
714
rm -rf "${OUT_DIR}"
815
mkdir -p "${OUT_DIR}"
916

@@ -14,3 +21,5 @@ nfpm pkg --packager deb --target "${OUT_DIR}"
1421
pushd "${OUT_DIR}" >/dev/null
1522
sha256sum -b -- * > sha256sum.txt
1623
popd >/dev/null
24+
25+
echo "Build complete! Output in ${OUT_DIR}/"

usr/bin/pve-fake-subscription

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,59 @@ import time
1212
import re
1313
import sys
1414
import os
15+
import secrets
1516
from datetime import datetime, timedelta
1617

1718
# PVE & PMG: /usr/share/perl5/PVE/Subscription.pm
1819
# PBS: /usr/lib/x86_64-linux-gnu/proxmox-backup/* (source code at `https://git.proxmox.com/git/proxmox-backup.git`)
1920
shared_key_data = "kjfdlskfhiuewhfk947368"
2021
server_key_file = "/etc/ssh/ssh_host_rsa_key.pub"
2122

23+
def generate_license_suffix():
24+
"""Generate a 10-character hexadecimal suffix for license keys"""
25+
return secrets.token_hex(5)
26+
27+
# Generate fixed license keys (will be consistent across runs)
28+
def get_or_generate_license_key(key_type, cache_file="/tmp/pve-fake-subscription-keys.json"):
29+
"""Get or generate license keys, storing them for consistency"""
30+
keys = {}
31+
32+
# Try to load existing keys
33+
if os.path.exists(cache_file):
34+
try:
35+
with open(cache_file, 'r') as f:
36+
keys = json.load(f)
37+
except:
38+
pass
39+
40+
# Generate missing keys
41+
if key_type not in keys:
42+
suffix = generate_license_suffix()
43+
if key_type == "pve":
44+
keys[key_type] = f"pve8p-{suffix}"
45+
elif key_type == "pmg":
46+
keys[key_type] = f"pmgp-{suffix}"
47+
elif key_type == "pbs":
48+
keys[key_type] = f"pbst-{suffix}"
49+
50+
# Save keys
51+
try:
52+
with open(cache_file, 'w') as f:
53+
json.dump(keys, f)
54+
except:
55+
pass
56+
57+
return keys[key_type]
58+
2259
# Default license keys
23-
lic_pve = "pve8p-1145141919"
24-
lic_pmg = "pmgp-1145141919"
25-
lic_pbs = "pbst-1145141919"
60+
lic_pve = get_or_generate_license_key("pve")
61+
lic_pmg = get_or_generate_license_key("pmg")
62+
lic_pbs = get_or_generate_license_key("pbs")
2663

2764
# UI customization
28-
ui_product_name = "YajuuSenpai"
29-
ui_message = "Yajuu Senpai has got your back"
30-
ui_url = "https://github.com/Jamesits/pve-fake-subscription"
65+
ui_product_name = "Proxmox VE For Lirisia Networks"
66+
ui_message = "Proxmox VE For Lirisia Networks"
67+
ui_url = "https://www.proxmox.com"
3168

3269
def get_timestamp():
3370
return int(time.time())

0 commit comments

Comments
 (0)