runtime/activate_tech.fish
Adam Štrauch ed6ea70fa5
Some checks failed
Test build / build (push) Failing after 35m53s
A lot of new stuff
2024-08-13 19:59:45 +02:00

25 lines
756 B
Fish
Executable File

#!/usr/bin/fish
for techline in (ls /opt/techs | fzf --layout reverse)
set tech (echo $techline | string split -f 1 - )
set ver (echo $techline | string split -f 2 - )
test -e /srv/bin/active_$tech && unlink /srv/bin/active_$tech
set primary_tech (readlink /srv/bin/primary_tech | string split -f 4 / | string split -f 1 "-")
if test $primary_tech = $tech
set_color -b red
echo "Technology $tech is already activated as primary tech, you can't activate it as secondary."
set_color normal
continue
end
set_color yellow
echo "Activating $tech-$ver"
set_color normal
ln -s /opt/techs/$tech-$ver/bin /srv/bin/active_$tech
set_color green
echo "Done."
set_color normal
end