From bc109a60622e3a56857243167bf2d906292c012a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 5 Nov 2024 17:45:13 +0100 Subject: [PATCH] Add a function for declaring software dependencies --- scripts/Arch/Drivers/SurfaceBook2/main.fish | 5 ++++- scripts/lib/software.fish | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/Arch/Drivers/SurfaceBook2/main.fish b/scripts/Arch/Drivers/SurfaceBook2/main.fish index c873786a..595d2f40 100755 --- a/scripts/Arch/Drivers/SurfaceBook2/main.fish +++ b/scripts/Arch/Drivers/SurfaceBook2/main.fish @@ -21,6 +21,9 @@ begin sudo systemctl enable --global surface-dtx-userd.service end + function installSWDependencies + fish "$dir/../Surface/main.fish" $argv + end + runInstaller --force $argv - fish "$dir/../Surface/main.fish" $argv end diff --git a/scripts/lib/software.fish b/scripts/lib/software.fish index d1b28fb6..aa1a5be5 100755 --- a/scripts/lib/software.fish +++ b/scripts/lib/software.fish @@ -9,7 +9,8 @@ begin set -l actions \ install installSW \ configure configureSW \ - userConfig userConfig + userConfig userConfig \ + dependencies installSWDependencies set -a actions $backupActions @@ -113,6 +114,8 @@ begin set -l name $_flag_name set -l action $_flag_action set -l args $_flag_force --name "$name" + set -l dependencyFunction "installSWDependencies" + set -l installDependencies source "$dir/settings.fish" if [ -n "$_flag_force" ] @@ -121,6 +124,12 @@ begin set force false end + if functions -q "$dependencyFunction" + set installDependencies __runSosftwareDependencyInstaller + functions -c "$dependencyFunction" "$installDependencies" + functions -e "$dependencyFunction" + end + if isProgramEnabled $args || $force set install true else @@ -208,5 +217,11 @@ begin end end end + + if [ -n "$installDependencies" ] + "$installDependencies" --action "$action" $args $argv + functions -c "$installDependencies" "$dependencyFunction" + functions -e "$installDependencies" + end end end