Add new os-release module
This commit is contained in:
34
modules/os-release/os-release.nu
Normal file
34
modules/os-release/os-release.nu
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
def main [config: string]: nothing -> nothing {
|
||||
let config = $config
|
||||
| from json
|
||||
| default {} properties
|
||||
mut os_release = open --raw /etc/os-release
|
||||
| lines
|
||||
| parse '{key}={value}'
|
||||
| transpose --ignore-titles -dr
|
||||
| str trim -c '"'
|
||||
| str trim -c "'"
|
||||
print $'(ansi green)Original release:(ansi reset)'
|
||||
print $os_release
|
||||
|
||||
for $item in ($config.properties | transpose key value) {
|
||||
if $item.key in $os_release {
|
||||
print $'(ansi green)Updating (ansi cyan)($item.key)(ansi green) with value (ansi yellow)($item.value)(ansi reset)'
|
||||
$os_release = $os_release | update $item.key $item.value
|
||||
} else {
|
||||
print $'(ansi green)Adding (ansi cyan)($item.key)(ansi green) with value (ansi yellow)($item.value)(ansi reset)'
|
||||
$os_release = $os_release | insert $item.key $item.value
|
||||
}
|
||||
}
|
||||
|
||||
print $'(ansi green)New release:(ansi reset)'
|
||||
print $os_release
|
||||
|
||||
$os_release
|
||||
| transpose key value
|
||||
| each { $'($in.key)="($in.value)"' }
|
||||
| str join "\n"
|
||||
| save --force /etc/os-release
|
||||
}
|
||||
@@ -5,6 +5,12 @@ base-image: ghcr.io/ublue-os/kinoite-main
|
||||
image-version: 42
|
||||
description: The image of Wunker OS for CP's laptop.
|
||||
modules:
|
||||
- type: os-release
|
||||
source: local
|
||||
properties:
|
||||
NAME: WunkerOS
|
||||
ID: wunker_os
|
||||
PRETTY_NAME: Wunker OS for Framework 13
|
||||
- type: dnf
|
||||
repos:
|
||||
copr:
|
||||
|
||||
@@ -19,6 +19,12 @@ nushell-version: none
|
||||
# # ref: db13eea91c15ca57d76454432d1fb9c09c51ba8c # Last known working commit
|
||||
# ref: 605bb63a4de640b77f6d3017238ece48cb286933 # supposed fix
|
||||
modules:
|
||||
- type: os-release
|
||||
source: local
|
||||
properties:
|
||||
NAME: WunkerOS
|
||||
ID: wunker_os
|
||||
PRETTY_NAME: Wunker OS for Nvidia
|
||||
- from-file: common/jp-desktop.yml
|
||||
# - from-file: common/cosmic.yml
|
||||
# - from-file: common/helix.yml
|
||||
|
||||
@@ -8,6 +8,12 @@ description: The image of Wunker OS for JP's Laptop.
|
||||
# stages:
|
||||
# - from-file: common/helix.yml
|
||||
modules:
|
||||
- type: os-release
|
||||
source: local
|
||||
properties:
|
||||
NAME: WunkerOS
|
||||
ID: wunker_os
|
||||
PRETTY_NAME: Wunker OS for Framework 16
|
||||
- from-file: common/jp-laptop.yml
|
||||
- from-file: common/cosmic.yml
|
||||
# - from-file: common/helix.yml
|
||||
|
||||
@@ -4,8 +4,14 @@ name: jp-minis-server
|
||||
# base-image: ghcr.io/ublue-os/kinoite-nvidia
|
||||
base-image: ghcr.io/ublue-os/base-main
|
||||
image-version: 42
|
||||
description: The image of Wunker OS for JP's Minisforum PCs.
|
||||
description: The image of Wunker OS for RKE2 Server
|
||||
modules:
|
||||
- type: os-release
|
||||
source: local
|
||||
properties:
|
||||
NAME: WunkerOS
|
||||
ID: wunker_os
|
||||
PRETTY_NAME: Wunker OS RKE2 Server
|
||||
- from-file: common/jp-minis.yml
|
||||
- type: files
|
||||
files:
|
||||
|
||||
@@ -4,8 +4,14 @@ name: jp-minis-worker
|
||||
# base-image: ghcr.io/ublue-os/kinoite-nvidia
|
||||
base-image: ghcr.io/ublue-os/base-main
|
||||
image-version: 42
|
||||
description: The image of Wunker OS for JP's Minisforum PCs.
|
||||
description: The image of Wunker OS for RKE2 Worker
|
||||
modules:
|
||||
- type: os-release
|
||||
source: local
|
||||
properties:
|
||||
NAME: WunkerOS
|
||||
ID: wunker_os
|
||||
PRETTY_NAME: Wunker OS RKE2 Worker
|
||||
- from-file: common/jp-minis.yml
|
||||
- type: script
|
||||
snippets:
|
||||
|
||||
Reference in New Issue
Block a user