|
| 1 | +# Desktopus Image File Specification |
| 2 | + |
| 3 | +This document provides a detailed description of the Desktopus configuration file format to define a Desktopus image. This is used to specify the software modules to be installed, files to be created or modified, and startup scripts to be executed. |
| 4 | + |
| 5 | +Startup scripts, file content and parameters are always interpreted when running the Desktopus image, to allow for dynamic and sensitive information to be used. |
| 6 | + |
| 7 | +## File Structure |
| 8 | + |
| 9 | +### Header |
| 10 | + |
| 11 | +- **desktopusVersion**: Specifies the version of the Desktopus version used to build the Desktopus image. |
| 12 | + - Example: `v0.1.0` |
| 13 | + |
| 14 | +- **os**: Indicates the target operating system for the desktopus image. |
| 15 | + - Example: `ubuntu-jammy` |
| 16 | + |
| 17 | +### Parameters |
| 18 | + |
| 19 | +The `parameters` section defines a list of configurable parameters that can be used throughout the configuration file. Each parameter includes: |
| 20 | + |
| 21 | +- **name**: The name of the parameter. |
| 22 | +- **type**: The data type of the parameter (e.g., `string`, `number`). |
| 23 | +- **default**: The default value for the parameter. |
| 24 | +- **description**: A description of the parameter (optional). |
| 25 | +- **required**: Indicates whether the parameter is required (default is `false`). |
| 26 | +- **RegExp**: A regular expression to validate the parameter value (optional). |
| 27 | + |
| 28 | +#### Example Parameters: |
| 29 | + |
| 30 | +```yaml |
| 31 | +parameters: |
| 32 | + - name: username |
| 33 | + type: string |
| 34 | + description: The username for the user account. |
| 35 | + default: user |
| 36 | + - name: password |
| 37 | + type: string |
| 38 | + description: The password for the user account. |
| 39 | + default: password |
| 40 | + - name: font |
| 41 | + type: string |
| 42 | + description: The font family to use in the VS Code editor. |
| 43 | + default: Fira Code |
| 44 | + - name: fontSize |
| 45 | + type: number |
| 46 | + description: The font size to use in the VS Code editor. |
| 47 | + required: true |
| 48 | +``` |
| 49 | +
|
| 50 | +### Modules |
| 51 | +
|
| 52 | +The `modules` section lists the software modules to be installed. Each module is specified by its name. |
| 53 | + |
| 54 | +#### Example Modules: |
| 55 | + |
| 56 | +```yaml |
| 57 | +modules: |
| 58 | + - chrome |
| 59 | + - firefox |
| 60 | + - vscode |
| 61 | +``` |
| 62 | + |
| 63 | +### Meta |
| 64 | + |
| 65 | +The `meta` section contains metadata and file configuration details. |
| 66 | + |
| 67 | +#### Files |
| 68 | + |
| 69 | +The `files` subsection specifies files to be created or modified. Each file entry includes: |
| 70 | + |
| 71 | +- **content**: The content to be written to the file, which can include placeholders for parameters. |
| 72 | +- **mode**: File permissions (e.g., `0644`). |
| 73 | +- **owner**: Owner of the file. |
| 74 | +- **group**: Group of the file. |
| 75 | + |
| 76 | +##### Example File Entries: |
| 77 | + |
| 78 | +```yaml |
| 79 | +files: |
| 80 | + '/home/user/.config/Code/User/settings.json': |
| 81 | + content: | |
| 82 | + { |
| 83 | + "editor.fontSize": ${fontSize}, |
| 84 | + "editor.fontFamily": ${font}, |
| 85 | + } |
| 86 | + mode: '0644' |
| 87 | + owner: ${username} |
| 88 | + group: ${username} |
| 89 | +
|
| 90 | + '/home/user/.config/Code/User/keybindings.json': |
| 91 | + content: | |
| 92 | + [ |
| 93 | + { |
| 94 | + "key": "ctrl+shift+alt+down", |
| 95 | + "command": "editor.action.copyLinesDownAction", |
| 96 | + "when": "editorTextFocus && !editorReadonly" |
| 97 | + } |
| 98 | + ] |
| 99 | + mode: '0644' |
| 100 | + owner: ${username} |
| 101 | + group: ${username} |
| 102 | +``` |
| 103 | + |
| 104 | +#### Startup Script |
| 105 | + |
| 106 | +The `startup_script` subsection specifies a script to be executed at startup. The script can include commands to install software or configure the environment. |
| 107 | + |
| 108 | +- **content**: The script content. |
| 109 | +- **mode**: File permissions (e.g., `0755`). |
| 110 | +- **owner**: Owner of the script file. |
| 111 | +- **group**: Group of the script file. |
| 112 | + |
| 113 | +##### Example Startup Script: |
| 114 | + |
| 115 | +```yaml |
| 116 | +startup_script: |
| 117 | + content: | |
| 118 | + #!/bin/sh |
| 119 | +
|
| 120 | + # Install vscode extensions |
| 121 | + code --install-extension ms-python.python |
| 122 | + code --install-extension ms-vscode.cpptools |
| 123 | + mode: '0755' |
| 124 | + owner: ${username} |
| 125 | + group: ${username} |
| 126 | +``` |
| 127 | + |
| 128 | +## Example Desktopus Image file |
| 129 | + |
| 130 | +Below is a complete example of a Desktopus configuration file: |
| 131 | + |
| 132 | +```yaml |
| 133 | +# Desktopus file YAML spec |
| 134 | +
|
| 135 | +desktopusVersion: v0.1.0 |
| 136 | +os: ubuntu-jammy |
| 137 | +parameters: |
| 138 | + - name: username |
| 139 | + type: string |
| 140 | + default: user |
| 141 | + - name: password |
| 142 | + type: string |
| 143 | + default: password |
| 144 | + - name: font |
| 145 | + type: string |
| 146 | + default: Fira Code |
| 147 | + - name: fontSize |
| 148 | + type: number |
| 149 | + default: 14 |
| 150 | +modules: |
| 151 | + - chrome |
| 152 | + - firefox |
| 153 | + - vscode |
| 154 | +meta: |
| 155 | + files: |
| 156 | + '/home/user/.config/Code/User/settings.json': |
| 157 | + content: | |
| 158 | + { |
| 159 | + "editor.fontSize": ${fontSize}, |
| 160 | + "editor.fontFamily": ${font}, |
| 161 | + } |
| 162 | + mode: '0644' |
| 163 | + owner: ${username} |
| 164 | + group: ${username} |
| 165 | + '/home/user/.config/Code/User/keybindings.json': |
| 166 | + content: | |
| 167 | + [ |
| 168 | + { |
| 169 | + "key": "ctrl+shift+alt+down", |
| 170 | + "command": "editor.action.copyLinesDownAction", |
| 171 | + "when": "editorTextFocus && !editorReadonly" |
| 172 | + } |
| 173 | + ] |
| 174 | + mode: '0644' |
| 175 | + owner: ${username} |
| 176 | + group: ${username} |
| 177 | + startup_script: |
| 178 | + content: | |
| 179 | + #!/bin/sh |
| 180 | +
|
| 181 | + # Install vscode extensions |
| 182 | + code --install-extension ms-python.python |
| 183 | + code --install-extension ms-vscode.cpptools |
| 184 | + mode: '0755' |
| 185 | + owner: ${username} |
| 186 | + group: ${username} |
| 187 | +``` |
0 commit comments