Separate global and OS-specific config

This commit is contained in:
Manuel Thalmann 2024-09-22 17:50:05 +02:00
parent 4fe88bba12
commit d0b055140e
15 changed files with 101 additions and 61 deletions
scripts/Common/Software

View file

@ -5,13 +5,13 @@ begin
source "$dir/../../Scripts/software.fish"
function configureSW
set -l efiDir (getConfig valhalla.boot.efiMountPoint)
set -l efiDir (getOSConfig boot.efiMountPoint)
sudo sed -i \
-e "s/#\(GRUB_DISABLE_OS_PROBER\)/\1/" \
/etc/default/grub
sudo grub-install --target=x86_64-efi --efi-directory="$efiDir" --bootloader-id="$(getConfig valhalla.boot.label)"
sudo grub-install --target=x86_64-efi --efi-directory="$efiDir" --bootloader-id="$(getOSConfig boot.label)"
sudo grub-mkconfig -o "$efiDir/grub/grub.cfg"
end

View file

@ -17,18 +17,19 @@ param (
[string] $User
)
$root = "valhalla";
$getConfig = $null;
if ($User) {
$root = "$root$($IsWindows ? ".windows" : '').users.$User";
$getConfig = { Get-UserConfig -UserName $User @args };
$sudoArgs = @("-u", $User);
$configArgs = @("--global");
} else {
$getConfig = { Get-OSConfig @args };
$sudoArgs = @();
$configArgs = @("--system");
}
$config = Get-Config "$root.git";
$config = & $getConfig "git";
<#
.SYNOPSIS

View file

@ -9,8 +9,8 @@ begin
function userConfig -V dir -a name
source "$dir/../../Scripts/config.fish"
set -l key "valhalla.linux.users.$name.rclone.configurations"
set -l configs (getConfig "$key" --apply "builtins.attrNames" --json)
set -l key "rclone.configurations"
set -l configs (getUserConfig "$name" "$key" --apply "builtins.attrNames" --json)
if [ (echo "$configs" | jq "length") -gt 0 ]
if [ "$XDG_SESSION_TYPE" = "tty" ]
@ -89,10 +89,10 @@ begin
set -l configKey "$key.$config"
set -l duration "$configKey.cacheDuration"
set -l serviceName "rclone@$config:$(getConfig "$configKey.dirName")"
set -l serviceName "rclone@$config:$(getUserConfig "$name" "$configKey.dirName")"
if isSet "$duration"
set serviceName "$serviceName:$(getConfig "$duration")"
if isUserSet "$name" "$duration"
set serviceName "$serviceName:$(getUserConfig "$name" "$duration")"
end
echo "Please create a remote called `$config`."