[fix] default parameter run records parameters in session for replay[fix] remove default parameters for several cubes
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Cube: admin/locale
|
||||
|
||||
Configures system keyboard layout permanently by updating `/etc/default/keyboard` and using `localectl`.
|
||||
|
||||
## Configuration
|
||||
|
||||
- `LAYOUT` (string): Keyboard layout (e.g. "ch", "us", "de"). Default: "ch".
|
||||
- `MODEL` (string): Keyboard model. Default: "pc105".
|
||||
- `VARIANT` (string): Keyboard variant. Default: "".
|
||||
- `OPTIONS` (string): Keyboard options (comma separated). Default: "".
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
import { Manifest } from '@bitsquare/nopy-cube';
|
||||
|
||||
export default Manifest({
|
||||
name: 'My Host Setup',
|
||||
dependencies: () => [
|
||||
['admin:locale', { LAYOUT: 'de' }]
|
||||
]
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,55 @@
|
||||
from pyinfra import host
|
||||
from pyinfra.operations import server, files
|
||||
|
||||
LAYOUT = host.data.LAYOUT
|
||||
MODEL = host.data.MODEL
|
||||
VARIANT = host.data.VARIANT
|
||||
OPTIONS = host.data.OPTIONS
|
||||
|
||||
# Update /etc/default/keyboard
|
||||
files.line(
|
||||
name="Update XKBMODEL in /etc/default/keyboard",
|
||||
path="/etc/default/keyboard",
|
||||
line=r'^XKBMODEL=.*',
|
||||
replace=f'XKBMODEL="{MODEL}"',
|
||||
_sudo=True,
|
||||
)
|
||||
|
||||
files.line(
|
||||
name="Update XKBLAYOUT in /etc/default/keyboard",
|
||||
path="/etc/default/keyboard",
|
||||
line=r'^XKBLAYOUT=.*',
|
||||
replace=f'XKBLAYOUT="{LAYOUT}"',
|
||||
_sudo=True,
|
||||
)
|
||||
|
||||
files.line(
|
||||
name="Update XKBVARIANT in /etc/default/keyboard",
|
||||
path="/etc/default/keyboard",
|
||||
line=r'^XKBVARIANT=.*',
|
||||
replace=f'XKBVARIANT="{VARIANT}"',
|
||||
_sudo=True,
|
||||
)
|
||||
|
||||
files.line(
|
||||
name="Update XKBOPTIONS in /etc/default/keyboard",
|
||||
path="/etc/default/keyboard",
|
||||
line=r'^XKBOPTIONS=.*',
|
||||
replace=f'XKBOPTIONS="{OPTIONS}"',
|
||||
_sudo=True,
|
||||
)
|
||||
|
||||
# Apply keyboard configuration
|
||||
server.shell(
|
||||
name="Apply keyboard setup",
|
||||
commands=["setupcon", "service keyboard-setup restart"],
|
||||
_sudo=True,
|
||||
)
|
||||
|
||||
# Set X11 keyboard layout using localectl if available
|
||||
server.shell(
|
||||
name="Set X11 keyboard layout using localectl",
|
||||
commands=[f"localectl set-x11-keymap {LAYOUT} {MODEL} '{VARIANT}' '{OPTIONS}'"],
|
||||
_sudo=True,
|
||||
_ignore_errors=True,
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Manifest } from '@bitsquare/nopy-cube';
|
||||
import { z } from 'zod';
|
||||
|
||||
export default Manifest({
|
||||
id: 'admin:locale',
|
||||
name: 'Configure system locale and keyboard layout',
|
||||
dependencies: () => [],
|
||||
schema: z.object({
|
||||
LAYOUT: z.string().describe('Keyboard layout (e.g. "ch", "us", "de")').default('ch'),
|
||||
MODEL: z.string().describe('Keyboard model').default('pc105'),
|
||||
VARIANT: z.string().describe('Keyboard variant').default(''),
|
||||
OPTIONS: z.string().describe('Keyboard options (comma separated)').default(''),
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user