Files
solspkg/solspkg
2026-01-28 19:04:16 +11:00

98 lines
2.0 KiB
Plaintext
Executable File

#!/usr/bin/env ground
fun !input -string -string &msg
set &tmp_0 ""
set &retval $tmp_0
drop &tmp_0
print $msg
input &retval
return $retval
endfun
fun !print -string -string &msg
print $msg
return $msg
endfun
fun !println -string -string &msg
println $msg
return $msg
endfun
fun !request_Get -string -string &url
endfun
fun !request_Post -string -string &url -string &data
endfun
extern "request"
fun !file_Read -string -string &file
endfun
fun !file_Write -void -string &file -string &content
endfun
extern "fileio"
set &tmp_1 "package to install: "
call !input $tmp_1 &tmp_2
set &thing $tmp_2
drop &tmp_2
set &tmp_3 "version number (default is latest): "
call !input $tmp_3 &tmp_4
set &version $tmp_4
drop &tmp_4
set &tmp_5 ""
equal $version $tmp_5 &tmp_6
drop &tmp_5
not $tmp_6 &tmp_7
if $tmp_7 %if_0
drop &tmp_7
drop &tmp_6
set &tmp_8 "https://sols.dev/pkgs/"
add $tmp_8 $thing &tmp_9
drop &tmp_8
set &tmp_10 "/latest"
add $tmp_9 $tmp_10 &tmp_11
drop &tmp_9
drop &tmp_10
call !request_Get $tmp_11 &tmp_12
set &version $tmp_12
drop &tmp_12
@if_0
set &tmp_13 "latest"
equal $version $tmp_13 &tmp_14
drop &tmp_13
not $tmp_14 &tmp_15
if $tmp_15 %if_1
drop &tmp_15
drop &tmp_14
set &tmp_16 "https://sols.dev/pkgs/"
add $tmp_16 $thing &tmp_17
drop &tmp_16
set &tmp_18 "/latest"
add $tmp_17 $tmp_18 &tmp_19
drop &tmp_17
drop &tmp_18
call !request_Get $tmp_19 &tmp_20
set &version $tmp_20
drop &tmp_20
@if_1
set &tmp_21 "https://sols.dev/pkgs/"
add $tmp_21 $thing &tmp_22
drop &tmp_21
set &tmp_23 "/"
add $tmp_22 $tmp_23 &tmp_24
drop &tmp_22
drop &tmp_23
add $tmp_24 $version &tmp_25
drop &tmp_24
set &tmp_26 ".sols"
add $tmp_25 $tmp_26 &tmp_27
drop &tmp_25
drop &tmp_26
call !request_Get $tmp_27 &tmp_28
set &file $tmp_28
drop &tmp_28
set &tmp_29 "/usr/lib/solstice/"
add $tmp_29 $thing &tmp_30
drop &tmp_29
set &tmp_31 ".sols"
add $tmp_30 $tmp_31 &tmp_32
drop &tmp_30
drop &tmp_31
call !file_Write $tmp_32 $file &tmp_33
set &tmp_34 "installed"
call !println $tmp_34 &tmp_35