|
| 1 | +# Puter Mods |
| 2 | + |
| 3 | +## What is a Puter Mod? |
| 4 | + |
| 5 | +Currently, the definition of a Puter mod is: |
| 6 | + |
| 7 | +> A [Module](../../packages/backend/doc/contributors/modules.md) |
| 8 | +> which is exported by a package directory which itself exists |
| 9 | +> within a directory specified in the `mod_directories` array |
| 10 | +> in `config.json`. |
| 11 | +
|
| 12 | +## Enabling Puter Mods |
| 13 | + |
| 14 | +### Step 1: Update Configuration |
| 15 | + |
| 16 | +First update the configuration (usually at `./volatile/config.json` |
| 17 | +or `/var/puter/config.json`) to specify mod directories. |
| 18 | + |
| 19 | +```json |
| 20 | +{ |
| 21 | + "config_name": "example config", |
| 22 | + |
| 23 | + "mod_directories": [ |
| 24 | + "{source}/mods/mods_enabled" |
| 25 | + ] |
| 26 | + |
| 27 | + // ... other config options |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +The first path you'll want to add is |
| 32 | +`"{source}/mods/mods_enabled"` |
| 33 | +which adds all the mods included in Puter's official repository. |
| 34 | +You don't need to change `{source}` unless your entry javascript |
| 35 | +file is in a different location than the default. |
| 36 | + |
| 37 | +If you want to enable all the mods, you can change the path above |
| 38 | +to `mods_available` instead and skip step 2 below. |
| 39 | + |
| 40 | +### Step 2: Select Mods |
| 41 | + |
| 42 | +To enable a Puter mod, create a symbolic link (AKA symlink) in |
| 43 | +`mods/mods_enabled`, pointing to |
| 44 | +a directory in `mods/mods_available`. This follows the same convention |
| 45 | +as managing sites/mods in Apache or Nginx servers. |
| 46 | + |
| 47 | +For example to enable KDMOD (which you can read as "Kernel Dev" mod, |
| 48 | +or "the mod that GitHub user KernelDeimos created to help with testing") |
| 49 | +you would run this command: |
| 50 | +```sh |
| 51 | +ln -rs ./mods/mods_available/kdmod ./mods/mods_enabled/ |
| 52 | +``` |
| 53 | + |
| 54 | +This will create a symlink at `./mods/mods_enabled/kdmod` pointing |
| 55 | +to the directory `./mods/mods_available/kdmod`. |
| 56 | + |
| 57 | +> **note:** here are some helpful tips for the `ln` command: |
| 58 | +> - You can remember `ln`'s first argument is the unaffected |
| 59 | +> source file by remembering `cp` and `mv` are the same in |
| 60 | +> this way. |
| 61 | +> - If you don't add `-s` you get a hard link. You will rarely |
| 62 | +> find yourself needing to do that. |
| 63 | +> - The `-r` flag allows you to write both paths relative to |
| 64 | +> the directory from which you are calling the command, which |
| 65 | +> is sometimes more intuitive. |
| 66 | +
|
0 commit comments