Skip to content

Commit 2caa3a3

Browse files
author
Palace Automation Bot
committed
Add documentation for patch generator tool
1 parent 7a91842 commit 2caa3a3

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

PATCH_GENERATOR.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# MooseFS Patch Generator
2+
3+
Automated tool to generate the pve-moosefs UI patch for Proxmox VE.
4+
5+
## Purpose
6+
7+
This Rust tool automatically generates `pve-moosefs.patch` by:
8+
1. Downloading the clean pve-manager package from apt
9+
2. Extracting `pvemanagerlib.js`
10+
3. Applying MooseFS UI changes programmatically
11+
4. Creating a unified diff patch
12+
5. Validating the patch applies cleanly
13+
14+
## Why Rust?
15+
16+
- Reliable: Type-safe, no manual string manipulation errors
17+
- Fast: Generates patch in seconds
18+
- Maintainable: UI changes defined in code constants
19+
- Testable: Validates patch before saving
20+
21+
## Usage
22+
23+
```bash
24+
# Build the tool
25+
cargo build --release
26+
27+
# Generate patch
28+
./target/release/generate-patch
29+
```
30+
31+
The tool will:
32+
- Check pve-manager is installed
33+
- Download the clean package
34+
- Generate `pve-moosefs.patch`
35+
- Verify it applies cleanly
36+
37+
## UI Changes Included
38+
39+
The generated patch adds MooseFS storage support to Proxmox:
40+
41+
### Storage Type Registration
42+
- Adds `moosefs` storage type
43+
- Enables backups
44+
- Uses building icon
45+
46+
### Input Panel Fields
47+
48+
**Main Section:**
49+
- Mount Point
50+
- MooseFS Master (default: mfsmaster)
51+
- Master Port (default: 9421)
52+
- Content Types
53+
- Shared checkbox
54+
- Use Block Device checkbox
55+
56+
**Advanced Section:**
57+
- Subfolder (optional)
58+
- Password (optional)
59+
- **NBD Socket** (NEW - for multiple cluster support)
60+
61+
## Modifying the UI
62+
63+
To add or change UI fields:
64+
65+
1. Edit the constants in `src/main.rs`:
66+
- `MOOSEFS_UI_PANEL` - The full UI panel definition
67+
- `STORAGE_TYPES_ADDITION` - Storage type registration
68+
69+
2. Rebuild and run:
70+
```bash
71+
cargo build --release
72+
./target/release/generate-patch
73+
```
74+
75+
3. The new `pve-moosefs.patch` will be generated
76+
77+
4. Test it:
78+
```bash
79+
# Apply to test file
80+
patch --dry-run pvemanagerlib.js < pve-moosefs.patch
81+
```
82+
83+
## Integration
84+
85+
The patch is applied during package installation by `postinst`:
86+
- Checks if MooseFS support already exists
87+
- Creates backup: `pvemanagerlib.js.dpkg-backup`
88+
- Applies patch using `patch -p1`
89+
- Restarts `pveproxy` service
90+
91+
## Troubleshooting
92+
93+
If the patch doesn't apply:
94+
1. Check pve-manager version changed
95+
2. Re-run generate-patch to create new patch
96+
3. Check for Proxmox UI changes in conflicting areas
97+
98+
If UI changes don't appear:
99+
1. Clear browser cache
100+
2. Restart pveproxy: `systemctl restart pveproxy`
101+
3. Check browser console for JS errors

0 commit comments

Comments
 (0)