Show detailed software install progress

This commit is contained in:
Manuel Thalmann 2024-09-21 17:32:49 +02:00
parent d1557590ae
commit 5ad037504a

View file

@ -2,35 +2,46 @@
begin
set -l dir (status dirname)
function installSW
end
function configureSW
end
function userConfig -a user
end
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
source "$dir/config.fish"
if [ -z "$action" ] || [ "$action" = "install" ]
installSW $argv[2..]
runInstaller "configure"
if functions -q installSW
echo "Installing `$name`..."
installSW $argv[3..]
end
runInstallerAction $name "configure"
if not isConfigured || [ "$USER" != (getConfig "valhalla.setupUser.name") ]
runInstaller userConfig
runInstallerAction $name userConfig
end
else if [ "$action" = "configure" ]
configureSW $argv[2..]
if functions -q configureSW
echo "Configuring `$name`..."
configureSW $argv[3..]
end
else if [ "$action" = "userConfig" ]
set -l name $argv[2]
set -l user $argv[3]
if [ -z "$name" ]
set name "$USER"
if [ -z "$user" ]
set user "$USER"
end
userConfig "$name" $argv[3..]
if functions -q userConfig
echo "Configuring `$name` for `$user`..."
userConfig "$user" $argv[4..]
end
end
end
end