Separate global and OS-specific config
This commit is contained in:
parent
4fe88bba12
commit
d0b055140e
15 changed files with 101 additions and 61 deletions
scripts/Common/OS
|
@ -4,7 +4,7 @@ source "$dir/../Scripts/config.fish"
|
|||
source "$dir/../Scripts/hooks.fish"
|
||||
|
||||
if [ (id -u) -eq 0 ]
|
||||
set -l name (getConfig valhalla.setupUser.name)
|
||||
set -l name (getOSConfig setupUser.name)
|
||||
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
||||
rm ~/.bash_profile
|
||||
|
||||
|
@ -16,7 +16,7 @@ if [ (id -u) -eq 0 ]
|
|||
--no-user-group \
|
||||
--groups nix-users \
|
||||
--create-home \
|
||||
--uid (getConfig valhalla.setupUser.id --json) \
|
||||
--uid (getOSConfig setupUser.id --json) \
|
||||
"$name"
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ function runSetup
|
|||
set -l dir (status dirname)
|
||||
source "$dir/../Scripts/config.fish"
|
||||
source "$dir/../Scripts/hooks.fish"
|
||||
set -l mountDir (getConfig valhalla.partition.rootDir)
|
||||
set -l mountDir (getOSConfig partition.rootDir)
|
||||
set -l projectRoot (realpath "$dir/../../..")
|
||||
set -l projectName (basename "$projectRoot")
|
||||
set -l PROJECT_CLONE_ROOT "/opt/$(basename "$projectName")"
|
||||
|
@ -43,7 +43,7 @@ function runSetup
|
|||
"$argv"
|
||||
end
|
||||
|
||||
getConfig valhalla.partition.script > "$script"
|
||||
getOSConfig partition.script > "$script"
|
||||
and "$script"
|
||||
and rm "$script"
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ set -l users (getUsers)
|
|||
|
||||
|
||||
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||
function getUserConfig -V name -a config
|
||||
getConfig "valhalla.linux.users.$name.$config" $argv[2..]
|
||||
function getUserInfo -V name -a config
|
||||
getUserConfig "$name" "$config" $argv[2..]
|
||||
end
|
||||
|
||||
set -l groups (getUserConfig groups --apply 'builtins.concatStringsSep ","');
|
||||
set -l displayName (getUserConfig displayName --json)
|
||||
set -l shell (getUserConfig defaultShell --json)
|
||||
set -l groups (getUserInfo groups --apply 'builtins.concatStringsSep ","');
|
||||
set -l displayName (getUserInfo displayName --json)
|
||||
set -l shell (getUserInfo defaultShell --json)
|
||||
|
||||
sudo useradd --create-home (
|
||||
if echo "$displayName" | jq --exit-status > /dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue