PortValhalla/scripts/Common/Scripts/software.fish

48 lines
1.4 KiB
Fish
Raw Normal View History

#!/bin/env fish
begin
set -l dir (status dirname)
functions -e installSW
functions -e configureSW
functions -e userConfig
function runInstaller -V dir -a action
set -l path (status stack-trace | head -n4 | tail -n1 | string replace --regex -- '^\s*called on line \d+ of file (.*)$' '$1')
set -l name (basename (dirname $path))
runInstallerAction $name $argv
end
function runInstallerAction -V dir -a name action
2024-09-13 12:47:07 +00:00
source "$dir/config.fish"
if [ -z "$action" ] || [ "$action" = "install" ]
if functions -q installSW
echo "Installing `$name`..."
installSW $argv[3..]
end
runInstallerAction $name "configure"
if not isConfigured || [ "$USER" != (getConfig "valhalla.setupUser.name") ]
runInstallerAction $name userConfig
end
2024-09-13 12:47:07 +00:00
else if [ "$action" = "configure" ]
if functions -q configureSW
echo "Configuring `$name`..."
configureSW $argv[3..]
end
else if [ "$action" = "userConfig" ]
set -l user $argv[3]
if [ -z "$user" ]
set user "$USER"
end
if functions -q userConfig
echo "Configuring `$name` for `$user`..."
userConfig "$user" $argv[4..]
end
end
end
end