feat: Add var_gpu flag for GPU passthrough configuration (#9764)
* feat: Add var_gpu flag for GPU passthrough configuration Changes: - Add var_gpu variable to CT scripts for explicit GPU control - Remove hardcoded GPU_APPS list - GPU detection now uses var_gpu flag - Add var_gpu to VAR_WHITELIST for persistence in default.vars and app.vars - Add GPU Passthrough option (Step 19) to advanced_settings wizard (now 20 steps) - Update documentation Apps with var_gpu=yes (GPU enabled by default): - Media: jellyfin, plex, emby, channels, ersatztv, tunarr - Transcoding: tdarr, unmanic, fileflows - AI/ML: ollama, openwebui - NVR: frigate, immich Usage: - Disable GPU: var_gpu=no bash -c '$(curl -fsSL ...jellyfin.sh)' - Enable GPU: var_gpu=yes bash -c '$(curl -fsSL ...debian.sh)' - Via default.vars: echo 'var_gpu=yes' >> /usr/local/community-scripts/default.vars - Via advanced settings wizard (Step 19) * fix: tput rmcup timing, GPU line indentation, echo_default GPU display * style: add GPU icon variable for consistent formatting
This commit is contained in:
parent
a5d017c83b
commit
4d4ced6b63
@ -13,6 +13,7 @@ var_disk="${var_disk:-8}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-0}"
|
var_unprivileged="${var_unprivileged:-0}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-8}"
|
|||||||
var_os="${var_os:-ubuntu}"
|
var_os="${var_os:-ubuntu}"
|
||||||
var_version="${var_version:-24.04}"
|
var_version="${var_version:-24.04}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-5}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-8}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-20}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-11}"
|
var_version="${var_version:-11}"
|
||||||
var_unprivileged="${var_unprivileged:-0}"
|
var_unprivileged="${var_unprivileged:-0}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_ram="${var_ram:-4096}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-16}"
|
|||||||
var_os="${var_os:-ubuntu}"
|
var_os="${var_os:-ubuntu}"
|
||||||
var_version="${var_version:-24.04}"
|
var_version="${var_version:-24.04}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -12,6 +12,7 @@ var_ram="${var_ram:-4096}"
|
|||||||
var_disk="${var_disk:-35}"
|
var_disk="${var_disk:-35}"
|
||||||
var_os="${var_os:-ubuntu}"
|
var_os="${var_os:-ubuntu}"
|
||||||
var_version="${var_version:-24.04}"
|
var_version="${var_version:-24.04}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-25}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-8}"
|
|||||||
var_os="${var_os:-ubuntu}"
|
var_os="${var_os:-ubuntu}"
|
||||||
var_version="${var_version:-24.04}"
|
var_version="${var_version:-24.04}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
@ -23,8 +24,8 @@ function update_script() {
|
|||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] \
|
if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] &&
|
||||||
&& [[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then
|
[[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-4}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-5}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -13,6 +13,7 @@ var_disk="${var_disk:-4}"
|
|||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-13}"
|
var_version="${var_version:-13}"
|
||||||
var_unprivileged="${var_unprivileged:-0}"
|
var_unprivileged="${var_unprivileged:-0}"
|
||||||
|
var_gpu="${var_gpu:-yes}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> **For Developers and Advanced Users**
|
> **For Developers and Advanced Users**
|
||||||
>
|
>
|
||||||
> *Deep dive into how the defaults and configuration system works*
|
> _Deep dive into how the defaults and configuration system works_
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ VAR_VALUE := [^\n]* # Any printable characters except newline
|
|||||||
**Constraints**:
|
**Constraints**:
|
||||||
|
|
||||||
| Constraint | Value |
|
| Constraint | Value |
|
||||||
|-----------|-------|
|
| ----------------- | ------------------------ |
|
||||||
| Max file size | 64 KB |
|
| Max file size | 64 KB |
|
||||||
| Max line length | 1024 bytes |
|
| Max line length | 1024 bytes |
|
||||||
| Max variables | 100 |
|
| Max variables | 100 |
|
||||||
@ -206,6 +206,7 @@ var_tags=dns,pihole
|
|||||||
**Purpose**: Safely load variables from .vars files without using `source` or `eval`
|
**Purpose**: Safely load variables from .vars files without using `source` or `eval`
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
load_vars_file(filepath)
|
load_vars_file(filepath)
|
||||||
```
|
```
|
||||||
@ -213,14 +214,16 @@ load_vars_file(filepath)
|
|||||||
**Parameters**:
|
**Parameters**:
|
||||||
|
|
||||||
| Param | Type | Required | Example |
|
| Param | Type | Required | Example |
|
||||||
|-------|------|----------|---------|
|
| -------- | ------ | -------- | ------------------------------------------- |
|
||||||
| filepath | String | Yes | `/usr/local/community-scripts/default.vars` |
|
| filepath | String | Yes | `/usr/local/community-scripts/default.vars` |
|
||||||
|
|
||||||
**Returns**:
|
**Returns**:
|
||||||
|
|
||||||
- `0` on success
|
- `0` on success
|
||||||
- `1` on error (file missing, parse error, etc.)
|
- `1` on error (file missing, parse error, etc.)
|
||||||
|
|
||||||
**Environment Side Effects**:
|
**Environment Side Effects**:
|
||||||
|
|
||||||
- Sets all parsed `var_*` variables as shell variables
|
- Sets all parsed `var_*` variables as shell variables
|
||||||
- Does NOT unset variables if file missing (safe)
|
- Does NOT unset variables if file missing (safe)
|
||||||
- Does NOT affect other variables
|
- Does NOT affect other variables
|
||||||
@ -281,6 +284,7 @@ echo "Allocating ${var_ram} MB RAM"
|
|||||||
**Purpose**: Get the full path for app-specific defaults file
|
**Purpose**: Get the full path for app-specific defaults file
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
get_app_defaults_path()
|
get_app_defaults_path()
|
||||||
```
|
```
|
||||||
@ -288,6 +292,7 @@ get_app_defaults_path()
|
|||||||
**Parameters**: None
|
**Parameters**: None
|
||||||
|
|
||||||
**Returns**:
|
**Returns**:
|
||||||
|
|
||||||
- String: Full path to app defaults file
|
- String: Full path to app defaults file
|
||||||
|
|
||||||
**Implementation**:
|
**Implementation**:
|
||||||
@ -322,6 +327,7 @@ load_vars_file "$(get_app_defaults_path)"
|
|||||||
**Purpose**: Load and display user global defaults
|
**Purpose**: Load and display user global defaults
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
default_var_settings()
|
default_var_settings()
|
||||||
```
|
```
|
||||||
@ -329,6 +335,7 @@ default_var_settings()
|
|||||||
**Parameters**: None
|
**Parameters**: None
|
||||||
|
|
||||||
**Returns**:
|
**Returns**:
|
||||||
|
|
||||||
- `0` on success
|
- `0` on success
|
||||||
- `1` on error
|
- `1` on error
|
||||||
|
|
||||||
@ -354,7 +361,7 @@ default_var_settings()
|
|||||||
```bash
|
```bash
|
||||||
default_var_settings() {
|
default_var_settings() {
|
||||||
local VAR_WHITELIST=(
|
local VAR_WHITELIST=(
|
||||||
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse
|
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_gpu
|
||||||
var_gateway var_hostname var_ipv6_method var_mac var_mtu
|
var_gateway var_hostname var_ipv6_method var_mac var_mtu
|
||||||
var_net var_ns var_pw var_ram var_tags var_tun var_unprivileged
|
var_net var_ns var_pw var_ram var_tags var_tun var_unprivileged
|
||||||
var_verbose var_vlan var_ssh var_ssh_authorized_key
|
var_verbose var_vlan var_ssh var_ssh_authorized_key
|
||||||
@ -389,6 +396,7 @@ default_var_settings() {
|
|||||||
**Purpose**: Offer to save current settings as app-specific defaults
|
**Purpose**: Offer to save current settings as app-specific defaults
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
maybe_offer_save_app_defaults()
|
maybe_offer_save_app_defaults()
|
||||||
```
|
```
|
||||||
@ -438,6 +446,7 @@ maybe_offer_save_app_defaults() {
|
|||||||
**Purpose**: Remove dangerous characters/patterns from configuration values
|
**Purpose**: Remove dangerous characters/patterns from configuration values
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
_sanitize_value(value)
|
_sanitize_value(value)
|
||||||
```
|
```
|
||||||
@ -445,17 +454,18 @@ _sanitize_value(value)
|
|||||||
**Parameters**:
|
**Parameters**:
|
||||||
|
|
||||||
| Param | Type | Required |
|
| Param | Type | Required |
|
||||||
|-------|------|----------|
|
| ----- | ------ | -------- |
|
||||||
| value | String | Yes |
|
| value | String | Yes |
|
||||||
|
|
||||||
**Returns**:
|
**Returns**:
|
||||||
|
|
||||||
- `0` (success) + sanitized value on stdout
|
- `0` (success) + sanitized value on stdout
|
||||||
- `1` (failure) + nothing if dangerous
|
- `1` (failure) + nothing if dangerous
|
||||||
|
|
||||||
**Dangerous Patterns**:
|
**Dangerous Patterns**:
|
||||||
|
|
||||||
| Pattern | Threat | Example |
|
| Pattern | Threat | Example |
|
||||||
|---------|--------|---------|
|
| --------- | -------------------- | -------------------- |
|
||||||
| `$(...)` | Command substitution | `$(rm -rf /)` |
|
| `$(...)` | Command substitution | `$(rm -rf /)` |
|
||||||
| `` ` ` `` | Command substitution | `` `whoami` `` |
|
| `` ` ` `` | Command substitution | `` `whoami` `` |
|
||||||
| `;` | Command separator | `value; rm -rf /` |
|
| `;` | Command separator | `value; rm -rf /` |
|
||||||
@ -501,6 +511,7 @@ fi
|
|||||||
**Purpose**: Check if variable name is in allowed whitelist
|
**Purpose**: Check if variable name is in allowed whitelist
|
||||||
|
|
||||||
**Signature**:
|
**Signature**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
_is_whitelisted_key(key)
|
_is_whitelisted_key(key)
|
||||||
```
|
```
|
||||||
@ -508,10 +519,11 @@ _is_whitelisted_key(key)
|
|||||||
**Parameters**:
|
**Parameters**:
|
||||||
|
|
||||||
| Param | Type | Required | Example |
|
| Param | Type | Required | Example |
|
||||||
|-------|------|----------|---------|
|
| ----- | ------ | -------- | --------- |
|
||||||
| key | String | Yes | `var_cpu` |
|
| key | String | Yes | `var_cpu` |
|
||||||
|
|
||||||
**Returns**:
|
**Returns**:
|
||||||
|
|
||||||
- `0` if key is whitelisted
|
- `0` if key is whitelisted
|
||||||
- `1` if key is NOT whitelisted
|
- `1` if key is NOT whitelisted
|
||||||
|
|
||||||
@ -573,6 +585,7 @@ Step 4: Use BUILT-IN DEFAULTS
|
|||||||
### Precedence Examples
|
### Precedence Examples
|
||||||
|
|
||||||
**Example 1: Environment Variable Wins**
|
**Example 1: Environment Variable Wins**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Shell environment has highest priority
|
# Shell environment has highest priority
|
||||||
$ export var_cpu=16
|
$ export var_cpu=16
|
||||||
@ -583,6 +596,7 @@ $ bash pihole-install.sh
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Example 2: App Defaults Override User Defaults**
|
**Example 2: App Defaults Override User Defaults**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# User Defaults: var_cpu=4
|
# User Defaults: var_cpu=4
|
||||||
# App Defaults: var_cpu=2
|
# App Defaults: var_cpu=2
|
||||||
@ -593,6 +607,7 @@ $ bash pihole-install.sh
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Example 3: All Defaults Missing (Built-ins Used)**
|
**Example 3: All Defaults Missing (Built-ins Used)**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# No environment variables set
|
# No environment variables set
|
||||||
# No app defaults file
|
# No app defaults file
|
||||||
@ -735,7 +750,7 @@ CONTAINER CREATION STARTED
|
|||||||
### Threat Model
|
### Threat Model
|
||||||
|
|
||||||
| Threat | Mitigation |
|
| Threat | Mitigation |
|
||||||
|--------|-----------|
|
| ---------------------------- | ------------------------------------------------- |
|
||||||
| **Arbitrary Code Execution** | No `source` or `eval`; manual parsing only |
|
| **Arbitrary Code Execution** | No `source` or `eval`; manual parsing only |
|
||||||
| **Variable Injection** | Whitelist of allowed variable names |
|
| **Variable Injection** | Whitelist of allowed variable names |
|
||||||
| **Command Substitution** | `_sanitize_value()` blocks `$()`, backticks, etc. |
|
| **Command Substitution** | `_sanitize_value()` blocks `$()`, backticks, etc. |
|
||||||
@ -798,6 +813,7 @@ fi
|
|||||||
### Module: `build.func`
|
### Module: `build.func`
|
||||||
|
|
||||||
**Load Order** (in actual scripts):
|
**Load Order** (in actual scripts):
|
||||||
|
|
||||||
1. `#!/usr/bin/env bash` - Shebang
|
1. `#!/usr/bin/env bash` - Shebang
|
||||||
2. `source /dev/stdin <<<$(curl ... api.func)` - API functions
|
2. `source /dev/stdin <<<$(curl ... api.func)` - API functions
|
||||||
3. `source /dev/stdin <<<$(curl ... build.func)` - Build functions
|
3. `source /dev/stdin <<<$(curl ... build.func)` - Build functions
|
||||||
@ -832,17 +848,17 @@ fi
|
|||||||
|
|
||||||
# Section 6: Installation Flow
|
# Section 6: Installation Flow
|
||||||
- install_script() # Main entry point
|
- install_script() # Main entry point
|
||||||
- advanced_settings() # 19-step wizard
|
- advanced_settings() # 20-step wizard
|
||||||
```
|
```
|
||||||
|
|
||||||
### Regex Patterns Used
|
### Regex Patterns Used
|
||||||
|
|
||||||
| Pattern | Purpose | Example Match |
|
| Pattern | Purpose | Example Match |
|
||||||
|---------|---------|---|
|
| ---------------------- | --------------------- | ----------------------- |
|
||||||
| `^[0-9]+([.][0-9]+)?$` | Integer validation | `4`, `192.168` |
|
| `^[0-9]+([.][0-9]+)?$` | Integer validation | `4`, `192.168` |
|
||||||
| `^var_[a-z_]+$` | Variable name | `var_cpu`, `var_ssh` |
|
| `^var_[a-z_]+$` | Variable name | `var_cpu`, `var_ssh` |
|
||||||
| `*'$('*` | Command substitution | `$(whoami)` |
|
| `*'$('*` | Command substitution | `$(whoami)` |
|
||||||
| `*\`*` | Backtick substitution | `` `cat /etc/passwd` `` |
|
| `*\`\*` | Backtick substitution | `` `cat /etc/passwd` `` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -870,7 +886,7 @@ fi
|
|||||||
### Function Mapping
|
### Function Mapping
|
||||||
|
|
||||||
| Old | New | Location |
|
| Old | New | Location |
|
||||||
|-----|-----|----------|
|
| ---------------- | --------------------------------- | ---------- |
|
||||||
| `read_config()` | `load_vars_file()` | build.func |
|
| `read_config()` | `load_vars_file()` | build.func |
|
||||||
| `write_config()` | `_build_current_app_vars_tmp()` | build.func |
|
| `write_config()` | `_build_current_app_vars_tmp()` | build.func |
|
||||||
| None | `maybe_offer_save_app_defaults()` | build.func |
|
| None | `maybe_offer_save_app_defaults()` | build.func |
|
||||||
|
|||||||
@ -9,7 +9,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Core Container Variables
|
### Core Container Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| --------- | -------------------------------------------- | --------- | ----------- | ------------------ |
|
||||||
| `APP` | Application name (e.g., "plex", "nextcloud") | - | Environment | Throughout |
|
| `APP` | Application name (e.g., "plex", "nextcloud") | - | Environment | Throughout |
|
||||||
| `NSAPP` | Namespace application name | `$APP` | Environment | Throughout |
|
| `NSAPP` | Namespace application name | `$APP` | Environment | Throughout |
|
||||||
| `CTID` | Container ID | - | Environment | Container creation |
|
| `CTID` | Container ID | - | Environment | Container creation |
|
||||||
@ -19,7 +19,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Operating System Variables
|
### Operating System Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| -------------- | -------------------------- | -------------- | --------------- | ------------------ |
|
||||||
| `var_os` | Operating system selection | "debian" | base_settings() | OS selection |
|
| `var_os` | Operating system selection | "debian" | base_settings() | OS selection |
|
||||||
| `var_version` | OS version | "12" | base_settings() | Template selection |
|
| `var_version` | OS version | "12" | base_settings() | Template selection |
|
||||||
| `var_template` | Template name | Auto-generated | base_settings() | Template download |
|
| `var_template` | Template name | Auto-generated | base_settings() | Template download |
|
||||||
@ -27,7 +27,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Resource Configuration Variables
|
### Resource Configuration Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ------------ | ----------------------- | ----------- | --------------- | ------------------ |
|
||||||
| `var_cpu` | CPU cores | "2" | base_settings() | Container creation |
|
| `var_cpu` | CPU cores | "2" | base_settings() | Container creation |
|
||||||
| `var_ram` | RAM in MB | "2048" | base_settings() | Container creation |
|
| `var_ram` | RAM in MB | "2048" | base_settings() | Container creation |
|
||||||
| `var_disk` | Disk size in GB | "8" | base_settings() | Container creation |
|
| `var_disk` | Disk size in GB | "8" | base_settings() | Container creation |
|
||||||
@ -38,7 +38,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Network Configuration Variables
|
### Network Configuration Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ------------- | ------------------------------- | -------------- | --------------- | -------------- |
|
||||||
| `var_net` | Network interface | "vmbr0" | base_settings() | Network config |
|
| `var_net` | Network interface | "vmbr0" | base_settings() | Network config |
|
||||||
| `var_bridge` | Bridge interface | "vmbr0" | base_settings() | Network config |
|
| `var_bridge` | Bridge interface | "vmbr0" | base_settings() | Network config |
|
||||||
| `var_gateway` | Gateway IP | "192.168.1.1" | base_settings() | Network config |
|
| `var_gateway` | Gateway IP | "192.168.1.1" | base_settings() | Network config |
|
||||||
@ -58,7 +58,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Storage Configuration Variables
|
### Storage Configuration Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ----------------------- | ------------------------------- | ------------------------ | ---------------- | ----------------- |
|
||||||
| `var_template_storage` | Storage for templates | - | select_storage() | Template storage |
|
| `var_template_storage` | Storage for templates | - | select_storage() | Template storage |
|
||||||
| `var_container_storage` | Storage for container disks | - | select_storage() | Container storage |
|
| `var_container_storage` | Storage for container disks | - | select_storage() | Container storage |
|
||||||
| `TEMPLATE_STORAGE` | Template storage (alternative) | `$var_template_storage` | Environment | Template storage |
|
| `TEMPLATE_STORAGE` | Template storage (alternative) | `$var_template_storage` | Environment | Template storage |
|
||||||
@ -67,7 +67,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Feature Flags
|
### Feature Flags
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| --------------------- | --------------------------- | ------- | --------------- | ------------------ |
|
||||||
| `ENABLE_FUSE` | Enable FUSE support | "true" | base_settings() | Container features |
|
| `ENABLE_FUSE` | Enable FUSE support | "true" | base_settings() | Container features |
|
||||||
| `ENABLE_TUN` | Enable TUN/TAP support | "true" | base_settings() | Container features |
|
| `ENABLE_TUN` | Enable TUN/TAP support | "true" | base_settings() | Container features |
|
||||||
| `ENABLE_KEYCTL` | Enable keyctl support | "true" | base_settings() | Container features |
|
| `ENABLE_KEYCTL` | Enable keyctl support | "true" | base_settings() | Container features |
|
||||||
@ -81,16 +81,36 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### GPU Passthrough Variables
|
### GPU Passthrough Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ------------ | ------------------------------- | ------- | ------------------------------------------- | ------------------ |
|
||||||
| `GPU_APPS` | List of apps that support GPU | - | Environment | GPU detection |
|
| `var_gpu` | Enable GPU passthrough | "no" | CT script / Environment / Advanced Settings | GPU passthrough |
|
||||||
| `var_gpu` | GPU selection | - | User input | GPU passthrough |
|
| `ENABLE_GPU` | GPU passthrough flag (internal) | "no" | Advanced Settings | Container creation |
|
||||||
| `var_gpu_type` | GPU type (intel/amd/nvidia) | - | detect_gpu_devices() | GPU passthrough |
|
|
||||||
| `var_gpu_devices` | GPU device list | - | detect_gpu_devices() | GPU passthrough |
|
**Note**: GPU passthrough is controlled via `var_gpu`. Apps that benefit from GPU acceleration (media servers, AI/ML, transcoding) have `var_gpu=yes` as default in their CT scripts.
|
||||||
|
|
||||||
|
**Apps with GPU enabled by default**:
|
||||||
|
|
||||||
|
- Media: jellyfin, plex, emby, channels, ersatztv, tunarr, immich
|
||||||
|
- Transcoding: tdarr, unmanic, fileflows
|
||||||
|
- AI/ML: ollama, openwebui
|
||||||
|
- NVR: frigate
|
||||||
|
|
||||||
|
**Usage Examples**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Disable GPU for a specific installation
|
||||||
|
var_gpu=no bash -c "$(curl -fsSL https://...jellyfin.sh)"
|
||||||
|
|
||||||
|
# Enable GPU for apps without default GPU support
|
||||||
|
var_gpu=yes bash -c "$(curl -fsSL https://...debian.sh)"
|
||||||
|
|
||||||
|
# Set in default.vars for all apps
|
||||||
|
echo "var_gpu=yes" >> /usr/local/community-scripts/default.vars
|
||||||
|
```
|
||||||
|
|
||||||
### API and Diagnostics Variables
|
### API and Diagnostics Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ------------- | ------------------------ | --------- | ----------- | ----------------- |
|
||||||
| `DIAGNOSTICS` | Enable diagnostics mode | "false" | Environment | Diagnostics |
|
| `DIAGNOSTICS` | Enable diagnostics mode | "false" | Environment | Diagnostics |
|
||||||
| `METHOD` | Installation method | "install" | Environment | Installation flow |
|
| `METHOD` | Installation method | "install" | Environment | Installation flow |
|
||||||
| `RANDOM_UUID` | Random UUID for tracking | - | Environment | Logging |
|
| `RANDOM_UUID` | Random UUID for tracking | - | Environment | Logging |
|
||||||
@ -100,7 +120,7 @@ This document provides a comprehensive reference of all environment variables us
|
|||||||
### Settings Persistence Variables
|
### Settings Persistence Variables
|
||||||
|
|
||||||
| Variable | Description | Default | Set In | Used In |
|
| Variable | Description | Default | Set In | Used In |
|
||||||
|----------|-------------|---------|---------|---------|
|
| ------------------- | -------------------------- | ------------------------------------------------- | ----------- | -------------------- |
|
||||||
| `SAVE_DEFAULTS` | Save settings as defaults | "false" | User input | Settings persistence |
|
| `SAVE_DEFAULTS` | Save settings as defaults | "false" | User input | Settings persistence |
|
||||||
| `SAVE_APP_DEFAULTS` | Save app-specific defaults | "false" | User input | Settings persistence |
|
| `SAVE_APP_DEFAULTS` | Save app-specific defaults | "false" | User input | Settings persistence |
|
||||||
| `DEFAULT_VARS_FILE` | Path to default.vars | "/usr/local/community-scripts/default.vars" | Environment | Settings persistence |
|
| `DEFAULT_VARS_FILE` | Path to default.vars | "/usr/local/community-scripts/default.vars" | Environment | Settings persistence |
|
||||||
@ -152,6 +172,7 @@ export SSH="true"
|
|||||||
## Environment Variable Usage Patterns
|
## Environment Variable Usage Patterns
|
||||||
|
|
||||||
### 1. Container Creation
|
### 1. Container Creation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Basic container creation
|
# Basic container creation
|
||||||
export APP="nextcloud"
|
export APP="nextcloud"
|
||||||
@ -170,6 +191,7 @@ export var_container_storage="local"
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. GPU Passthrough
|
### 2. GPU Passthrough
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Enable GPU passthrough
|
# Enable GPU passthrough
|
||||||
export GPU_APPS="plex,jellyfin,emby"
|
export GPU_APPS="plex,jellyfin,emby"
|
||||||
@ -178,6 +200,7 @@ export ENABLE_PRIVILEGED="true"
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 3. Advanced Network Configuration
|
### 3. Advanced Network Configuration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# VLAN and IPv6 configuration
|
# VLAN and IPv6 configuration
|
||||||
export var_vlan="100"
|
export var_vlan="100"
|
||||||
@ -187,6 +210,7 @@ export var_mtu="9000"
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 4. Storage Configuration
|
### 4. Storage Configuration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Custom storage locations
|
# Custom storage locations
|
||||||
export var_template_storage="nfs-storage"
|
export var_template_storage="nfs-storage"
|
||||||
@ -206,6 +230,7 @@ The script validates variables at several points:
|
|||||||
## Common Variable Combinations
|
## Common Variable Combinations
|
||||||
|
|
||||||
### Development Container
|
### Development Container
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export APP="dev-container"
|
export APP="dev-container"
|
||||||
export CTID="200"
|
export CTID="200"
|
||||||
@ -220,6 +245,7 @@ export ENABLE_PRIVILEGED="true"
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Media Server with GPU
|
### Media Server with GPU
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export APP="plex"
|
export APP="plex"
|
||||||
export CTID="300"
|
export CTID="300"
|
||||||
@ -235,6 +261,7 @@ export ENABLE_PRIVILEGED="true"
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Lightweight Service
|
### Lightweight Service
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export APP="nginx"
|
export APP="nginx"
|
||||||
export CTID="400"
|
export CTID="400"
|
||||||
|
|||||||
@ -453,7 +453,7 @@ load_vars_file() {
|
|||||||
|
|
||||||
# Allowed var_* keys
|
# Allowed var_* keys
|
||||||
local VAR_WHITELIST=(
|
local VAR_WHITELIST=(
|
||||||
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_keyctl
|
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_gpu var_keyctl
|
||||||
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
||||||
var_net var_nesting var_ns var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
var_net var_nesting var_ns var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
||||||
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
||||||
@ -505,7 +505,7 @@ default_var_settings() {
|
|||||||
# Allowed var_* keys (alphabetically sorted)
|
# Allowed var_* keys (alphabetically sorted)
|
||||||
# Note: Removed var_ctid (can only exist once), var_ipv6_static (static IPs are unique)
|
# Note: Removed var_ctid (can only exist once), var_ipv6_static (static IPs are unique)
|
||||||
local VAR_WHITELIST=(
|
local VAR_WHITELIST=(
|
||||||
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_keyctl
|
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_gpu var_keyctl
|
||||||
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
||||||
var_net var_nesting var_ns var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
var_net var_nesting var_ns var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
||||||
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
||||||
@ -667,7 +667,7 @@ get_app_defaults_path() {
|
|||||||
if ! declare -p VAR_WHITELIST >/dev/null 2>&1; then
|
if ! declare -p VAR_WHITELIST >/dev/null 2>&1; then
|
||||||
# Note: Removed var_ctid (can only exist once), var_ipv6_static (static IPs are unique)
|
# Note: Removed var_ctid (can only exist once), var_ipv6_static (static IPs are unique)
|
||||||
declare -ag VAR_WHITELIST=(
|
declare -ag VAR_WHITELIST=(
|
||||||
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse
|
var_apt_cacher var_apt_cacher_ip var_brg var_cpu var_disk var_fuse var_gpu
|
||||||
var_gateway var_hostname var_ipv6_method var_mac var_mtu
|
var_gateway var_hostname var_ipv6_method var_mac var_mtu
|
||||||
var_net var_ns var_pw var_ram var_tags var_tun var_unprivileged
|
var_net var_ns var_pw var_ram var_tags var_tun var_unprivileged
|
||||||
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
var_verbose var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
||||||
@ -1011,7 +1011,7 @@ advanced_settings() {
|
|||||||
# Initialize defaults
|
# Initialize defaults
|
||||||
TAGS="community-script;${var_tags:-}"
|
TAGS="community-script;${var_tags:-}"
|
||||||
local STEP=1
|
local STEP=1
|
||||||
local MAX_STEP=19
|
local MAX_STEP=20
|
||||||
|
|
||||||
# Store values for back navigation
|
# Store values for back navigation
|
||||||
local _ct_type="${CT_TYPE:-1}"
|
local _ct_type="${CT_TYPE:-1}"
|
||||||
@ -1036,6 +1036,7 @@ advanced_settings() {
|
|||||||
local _vlan=""
|
local _vlan=""
|
||||||
local _tags="$TAGS"
|
local _tags="$TAGS"
|
||||||
local _enable_fuse="no"
|
local _enable_fuse="no"
|
||||||
|
local _enable_gpu="${var_gpu:-no}"
|
||||||
local _verbose="no"
|
local _verbose="no"
|
||||||
local _enable_keyctl="0"
|
local _enable_keyctl="0"
|
||||||
local _enable_mknod="0"
|
local _enable_mknod="0"
|
||||||
@ -1527,9 +1528,33 @@ advanced_settings() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# STEP 19: Confirmation
|
# STEP 19: GPU Passthrough
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
19)
|
19)
|
||||||
|
local gpu_default="OFF"
|
||||||
|
[[ "$_enable_gpu" == "yes" ]] && gpu_default="ON"
|
||||||
|
|
||||||
|
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
|
||||||
|
--title "GPU PASSTHROUGH" \
|
||||||
|
--ok-button "Next" --cancel-button "Back" \
|
||||||
|
--defaultno \
|
||||||
|
--yesno "\nEnable GPU Passthrough?\n\nAutomatically detects and passes through available GPUs\n(Intel/AMD/NVIDIA) for hardware acceleration.\n\nRecommended for: Media servers, AI/ML, Transcoding" 14 62; then
|
||||||
|
_enable_gpu="yes"
|
||||||
|
else
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
_enable_gpu="no"
|
||||||
|
else
|
||||||
|
((STEP--))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
((STEP++))
|
||||||
|
;;
|
||||||
|
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
# STEP 20: Confirmation
|
||||||
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
20)
|
||||||
# Build summary
|
# Build summary
|
||||||
local ct_type_desc="Unprivileged"
|
local ct_type_desc="Unprivileged"
|
||||||
[[ "$_ct_type" == "0" ]] && ct_type_desc="Privileged"
|
[[ "$_ct_type" == "0" ]] && ct_type_desc="Privileged"
|
||||||
@ -1550,12 +1575,13 @@ Network:
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
FUSE: $_enable_fuse
|
FUSE: $_enable_fuse
|
||||||
|
GPU Passthrough: $_enable_gpu
|
||||||
Verbose: $_verbose"
|
Verbose: $_verbose"
|
||||||
|
|
||||||
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
|
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
|
||||||
--title "CONFIRM SETTINGS" \
|
--title "CONFIRM SETTINGS" \
|
||||||
--ok-button "Create LXC" --cancel-button "Back" \
|
--ok-button "Create LXC" --cancel-button "Back" \
|
||||||
--yesno "$summary\n\nCreate ${APP} LXC with these settings?" 26 58; then
|
--yesno "$summary\n\nCreate ${APP} LXC with these settings?" 28 58; then
|
||||||
((STEP++))
|
((STEP++))
|
||||||
else
|
else
|
||||||
((STEP--))
|
((STEP--))
|
||||||
@ -1582,8 +1608,12 @@ Options:
|
|||||||
IPV6_GATE="$_ipv6_gate"
|
IPV6_GATE="$_ipv6_gate"
|
||||||
TAGS="$_tags"
|
TAGS="$_tags"
|
||||||
ENABLE_FUSE="$_enable_fuse"
|
ENABLE_FUSE="$_enable_fuse"
|
||||||
|
ENABLE_GPU="$_enable_gpu"
|
||||||
VERBOSE="$_verbose"
|
VERBOSE="$_verbose"
|
||||||
|
|
||||||
|
# Update var_gpu based on user choice (for is_gpu_app function)
|
||||||
|
var_gpu="$_enable_gpu"
|
||||||
|
|
||||||
# Format optional values
|
# Format optional values
|
||||||
[[ -n "$_mtu" ]] && MTU=",mtu=$_mtu" || MTU=""
|
[[ -n "$_mtu" ]] && MTU=",mtu=$_mtu" || MTU=""
|
||||||
[[ -n "$_sd" ]] && SD="-searchdomain=$_sd" || SD=""
|
[[ -n "$_sd" ]] && SD="-searchdomain=$_sd" || SD=""
|
||||||
@ -1600,6 +1630,10 @@ Options:
|
|||||||
export UDHCPC_FIX
|
export UDHCPC_FIX
|
||||||
export SSH_KEYS_FILE
|
export SSH_KEYS_FILE
|
||||||
|
|
||||||
|
# Exit alternate screen buffer before showing summary (so output remains visible)
|
||||||
|
tput rmcup 2>/dev/null || true
|
||||||
|
trap - RETURN
|
||||||
|
|
||||||
# Display final summary
|
# Display final summary
|
||||||
echo -e "\n${INFO}${BOLD}${DGN}PVE Version ${PVEVERSION} (Kernel: ${KERNEL_VERSION})${CL}"
|
echo -e "\n${INFO}${BOLD}${DGN}PVE Version ${PVEVERSION} (Kernel: ${KERNEL_VERSION})${CL}"
|
||||||
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}$var_os${CL}"
|
||||||
@ -1614,6 +1648,7 @@ Options:
|
|||||||
echo -e "${NETWORK}${BOLD}${DGN}IPv4: ${BGN}$NET${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}IPv4: ${BGN}$NET${CL}"
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}$IPV6_METHOD${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}$IPV6_METHOD${CL}"
|
||||||
echo -e "${FUSE}${BOLD}${DGN}FUSE Support: ${BGN}$ENABLE_FUSE${CL}"
|
echo -e "${FUSE}${BOLD}${DGN}FUSE Support: ${BGN}$ENABLE_FUSE${CL}"
|
||||||
|
echo -e "${GPU}${BOLD}${DGN}GPU Passthrough: ${BGN}$ENABLE_GPU${CL}"
|
||||||
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERBOSE${CL}"
|
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERBOSE${CL}"
|
||||||
echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
}
|
}
|
||||||
@ -1736,6 +1771,9 @@ echo_default() {
|
|||||||
echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}"
|
echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}${DISK_SIZE} GB${CL}"
|
||||||
echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}"
|
echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}"
|
||||||
echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}"
|
echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}"
|
||||||
|
if [[ -n "${var_gpu:-}" && "${var_gpu}" == "yes" ]]; then
|
||||||
|
echo -e "${GPU}${BOLD}${DGN}GPU Passthrough: ${BGN}Enabled${CL}"
|
||||||
|
fi
|
||||||
if [ "$VERBOSE" == "yes" ]; then
|
if [ "$VERBOSE" == "yes" ]; then
|
||||||
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}Enabled${CL}"
|
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}Enabled${CL}"
|
||||||
fi
|
fi
|
||||||
@ -2387,21 +2425,15 @@ build_container() {
|
|||||||
# GPU/USB PASSTHROUGH CONFIGURATION
|
# GPU/USB PASSTHROUGH CONFIGURATION
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
# List of applications that benefit from GPU acceleration
|
# Check if GPU passthrough is enabled
|
||||||
GPU_APPS=(
|
# Returns true only if var_gpu is explicitly set to "yes"
|
||||||
"immich" "channels" "emby" "ersatztv" "frigate"
|
# Can be set via:
|
||||||
"jellyfin" "plex" "scrypted" "tdarr" "unmanic"
|
# - Environment variable: var_gpu=yes bash -c "..."
|
||||||
"ollama" "fileflows" "open-webui" "tunarr"
|
# - CT script default: var_gpu="${var_gpu:-no}"
|
||||||
"handbrake" "sunshine" "moonlight" "kodi" "stremio"
|
# - Advanced settings wizard
|
||||||
"viseron"
|
# - App defaults file: /usr/local/community-scripts/defaults/<app>.vars
|
||||||
)
|
|
||||||
|
|
||||||
# Check if app needs GPU
|
|
||||||
is_gpu_app() {
|
is_gpu_app() {
|
||||||
local app="${1,,}"
|
[[ "${var_gpu:-no}" == "yes" ]] && return 0
|
||||||
for gpu_app in "${GPU_APPS[@]}"; do
|
|
||||||
[[ "$app" == "${gpu_app,,}" ]] && return 0
|
|
||||||
done
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2491,8 +2523,13 @@ EOF
|
|||||||
|
|
||||||
# Configure GPU passthrough
|
# Configure GPU passthrough
|
||||||
configure_gpu_passthrough() {
|
configure_gpu_passthrough() {
|
||||||
# Skip if not a GPU app and not privileged
|
# Skip if:
|
||||||
if [[ "$CT_TYPE" != "0" ]] && ! is_gpu_app "$APP"; then
|
# GPU passthrough is enabled when var_gpu="yes":
|
||||||
|
# - Set via environment variable: var_gpu=yes bash -c "..."
|
||||||
|
# - Set in CT script: var_gpu="${var_gpu:-no}"
|
||||||
|
# - Enabled in advanced_settings wizard
|
||||||
|
# - Configured in app defaults file
|
||||||
|
if ! is_gpu_app "$APP"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -123,6 +123,7 @@ icons() {
|
|||||||
CREATING="${TAB}🚀${TAB}${CL}"
|
CREATING="${TAB}🚀${TAB}${CL}"
|
||||||
ADVANCED="${TAB}🧩${TAB}${CL}"
|
ADVANCED="${TAB}🧩${TAB}${CL}"
|
||||||
FUSE="${TAB}🗂️${TAB}${CL}"
|
FUSE="${TAB}🗂️${TAB}${CL}"
|
||||||
|
GPU="${TAB}🎮${TAB}${CL}"
|
||||||
HOURGLASS="${TAB}⏳${TAB}"
|
HOURGLASS="${TAB}⏳${TAB}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user