added t:new and --patches flag
This commit is contained in:
parent
2fad12ea91
commit
0b44140463
17 changed files with 227 additions and 59 deletions
62
README.md
62
README.md
|
@ -7,7 +7,7 @@
|
|||
</p>
|
||||
|
||||
<p align="center">
|
||||
This is a custom patcher for applying modifications to firefox source code. It processes patch files located in the `./patches` directory and applies them to files in a specified root path.
|
||||
This is a custom patcher for applying modifications to Firefox source code. It processes patch files located in the `./patches` directory and applies them to files in a specified root path.
|
||||
</p>
|
||||
|
||||
## How to Use
|
||||
|
@ -21,13 +21,14 @@ This is a custom patcher for applying modifications to firefox source code. It p
|
|||
-MOZ_APP_DISPLAYNAME=Firefox
|
||||
+MOZ_APP_DISPLAYNAME=Spitfire
|
||||
```
|
||||
2. Run the patcher with the `--path` flag:
|
||||
2. Run the patcher with the `--path` and `--patches` flags:
|
||||
|
||||
```sh
|
||||
./run.sh --path ./mozilla-central
|
||||
./run.sh --path ./mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin --patches ./mozilla-central/patcher/post-compile-patches
|
||||
```
|
||||
|
||||
*Root path will be resolved to an absolute path, and patches will be applied relative to this path.*
|
||||
- --path *Will be resolved to an absolute path, and patches will be applied relative to this path.*
|
||||
- --patches *Specifies a path to a `.patch` file or a folder containing patches to be applied by this script*
|
||||
|
||||
## Parameters Explained
|
||||
|
||||
|
@ -39,7 +40,7 @@ Here are the details of each parameter used in the patching system:
|
|||
- This is the file that will be read and modified based on the patch instructions.
|
||||
- **Example:**
|
||||
|
||||
```
|
||||
```patch
|
||||
i:/browser/branding/official/configure.sh
|
||||
```
|
||||
|
||||
|
@ -51,7 +52,7 @@ Here are the details of each parameter used in the patching system:
|
|||
- If the input and output paths are the same, the original file will be overwritten.
|
||||
- **Example:**
|
||||
|
||||
```
|
||||
```patch
|
||||
o:/browser/branding/official/configure.sh
|
||||
```
|
||||
|
||||
|
@ -61,34 +62,42 @@ Here are the details of each parameter used in the patching system:
|
|||
|
||||
- Defines the type of patch being applied. This parameter can be skipped if not applicable.
|
||||
- Common types:
|
||||
1. **`pref`:** Indicates that the patch is modifying preference settings (e.g., Firefox `prefs.js`).
|
||||
- When `t:pref` is specified, the script will search for existing preferences in the input file and replace them with the new ones provided in the patch. If not found, it will add the new preference.
|
||||
- **Example:**
|
||||
```
|
||||
t:pref
|
||||
+pref("extensions.getAddons.showPane", false); // HIDDEN
|
||||
```
|
||||
2. **`standard`:** Standard patching type that follows the `+` (add) and `-` (remove) syntax.
|
||||
1. **`standard`:** Standard patching type that follows the `+` (add) and `-` (remove) syntax.
|
||||
- Used for general file modifications.
|
||||
- **Example:**
|
||||
```
|
||||
```patch
|
||||
-MOZ_APP_DISPLAYNAME=Firefox
|
||||
+MOZ_APP_DISPLAYNAME=Spitfire
|
||||
```
|
||||
- **When to Use:**
|
||||
- **Required for specialized processing:** If the patch involves specific logic, like handling `pref` files, include this parameter.
|
||||
- **Optional for standard patches:** For simple addition or removal of lines, you can skip this parameter.
|
||||
2. **`pref`:** Indicates that the patch is modifying preference settings (e.g., Firefox `prefs.js`).
|
||||
- When `t:pref` is specified, the script will search for existing preferences in the input file and replace them with the new ones provided in the patch. If not found, it will add the new preference.
|
||||
- **Example:**
|
||||
```patch
|
||||
t:pref
|
||||
+pref("extensions.getAddons.showPane", false); // HIDDEN
|
||||
```
|
||||
3. **`new`:** Used for creating new files or overwriting existing files with specified content.
|
||||
- Creates a new file at the `o:` location.
|
||||
- **Example:**
|
||||
```patch
|
||||
t:new
|
||||
o:/browser/branding/official/newfile.txt
|
||||
|
||||
### Example Patch File
|
||||
+This is a new file created by Spitfire Patcher.
|
||||
```
|
||||
|
||||
```
|
||||
### Example Patch Files
|
||||
|
||||
```patch
|
||||
t:pref
|
||||
i:/browser/branding/official/configure.sh
|
||||
o:/browser/branding/official/configure.sh
|
||||
i:/browser/firefox.js
|
||||
o:/browser/spitfire.js
|
||||
|
||||
-pref("browser.privatebrowsing.autostart", false);
|
||||
+pref("browser.privatebrowsing.autostart", true);
|
||||
```
|
||||
|
||||
```patch
|
||||
t:standard
|
||||
i:/browser/app/profile/firefox.js
|
||||
o:/browser/app/profile/firefox.js
|
||||
|
@ -97,13 +106,20 @@ o:/browser/app/profile/firefox.js
|
|||
+MOZ_APP_DISPLAYNAME=Spitfire
|
||||
```
|
||||
|
||||
```patch
|
||||
t:new
|
||||
o:/browser/branding/official/new-file.txt
|
||||
|
||||
+Welcome to Spitfire Browser Branding.
|
||||
```
|
||||
|
||||
### Summary of Parameters
|
||||
|
||||
| Parameter | Required | Purpose | Example |
|
||||
| ----------- | ---------- | ------------------------------------- | ------------------------------------- |
|
||||
| `i:` | Yes | Specifies the input file path. | `i:/browser/app/profile/firefox.js` |
|
||||
| `o:` | Yes | Specifies the output file path. | `o:/browser/app/profile/firefox.js` |
|
||||
| `t:` | No | Defines the type of patch. | `t:pref` or `t:standard` |
|
||||
| `t:` | No | Defines the type of patch. | `t:pref`, `t:standard`, or `t:new` |
|
||||
| `+` | Yes | Adds a line to the output file. | `+MOZ_APP_DISPLAYNAME=Spitfire` |
|
||||
| `-` | Yes | Removes a line from the input file. | `-MOZ_APP_DISPLAYNAME=Firefox` |
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue