25 lines
756 B
Fish
25 lines
756 B
Fish
|
#!/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
|