changing shellscripts to lua scripts for safety and control

This commit is contained in:
2025-08-01 17:12:06 -03:00
parent 86a77dece4
commit 336303389a
4 changed files with 102 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ import (
"github.com/BurntSushi/toml"
"github.com/klauspost/compress/zstd"
"github.com/schollz/progressbar/v3"
lua "github.com/yuin/gopher-lua"
"golang.org/x/net/ipv4"
_ "modernc.org/sqlite"
)
@@ -534,6 +535,16 @@ func Install(packagepath string, serial uint) error {
// TODO LUA SCRIPT
L := lua.NewState()
defer L.Close()
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
if err := L.DoFile(manifest.Hooks.Install); err != nil {
log.Panic(err)
}
fmt.Printf("Package %s fully installed\n", name)
var insert = Installed{