Show detailed software install progress

This commit is contained in:
Manuel Thalmann 2024-09-21 17:32:49 +02:00
parent 002fb520ff
commit c4267e14d4

View file

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