Compare commits
2 Commits
22a74aa793
...
eb4e2281fa
Author | SHA1 | Date | |
---|---|---|---|
eb4e2281fa | |||
c9bc1e7fc3 |
@ -38,7 +38,12 @@ nfpms:
|
||||
provides:
|
||||
- lure
|
||||
conflicts:
|
||||
- lure
|
||||
- lure
|
||||
contents:
|
||||
- src: scripts/completion/bash
|
||||
dst: /usr/share/bash-completion/completions/lure
|
||||
- src: scripts/completion/zsh
|
||||
dst: /usr/share/zsh/site-functions/_lure
|
||||
aurs:
|
||||
- name: lure-bin
|
||||
homepage: 'https://gitea.arsenm.dev/Arsen6331/lure'
|
||||
@ -57,7 +62,11 @@ aurs:
|
||||
- pacman
|
||||
package: |-
|
||||
# binaries
|
||||
install -Dm755 "./lure" "${pkgdir}/usr/bin/lure"
|
||||
install -Dm755 ./lure "${pkgdir}/usr/bin/lure"
|
||||
|
||||
# completions
|
||||
install -Dm755 ./scripts/completion/bash /usr/share/bash-completion/completions/lure
|
||||
install -Dm755 ./scripts/completion/zsh /usr/share/zsh/site-functions/_lure
|
||||
release:
|
||||
gitea:
|
||||
owner: Arsen6331
|
||||
|
8
Makefile
8
Makefile
@ -1,3 +1,5 @@
|
||||
PREFIX ?= /usr/local
|
||||
|
||||
lure: version.txt
|
||||
go build
|
||||
|
||||
@ -5,12 +7,14 @@ clean:
|
||||
rm -f lure
|
||||
|
||||
install: lure
|
||||
sudo install -Dm755 lure /usr/local/bin/lure
|
||||
install -Dm755 lure $(DESTDIR)$(PREFIX)/bin/lure
|
||||
install -Dm755 scripts/completion/bash $(DESTDIR)$(PREFIX)/share/bash-completion/completions/lure
|
||||
install -Dm755 scripts/completion/zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_lure
|
||||
|
||||
uninstall:
|
||||
rm -f /usr/local/bin/lure
|
||||
|
||||
version.txt:
|
||||
go generate
|
||||
go generate ./...
|
||||
|
||||
.PHONY: install clean uninstall
|
41
build.go
41
build.go
@ -609,47 +609,6 @@ func setScripts(vars *BuildVars, info *nfpm.Info, scriptDir string) {
|
||||
}
|
||||
}
|
||||
|
||||
// getBuildVars only gets the build variables, while disabling exec, stat, open, and readdir
|
||||
func getBuildVars(ctx context.Context, script string, info *distro.OSRelease) (*BuildVars, error) {
|
||||
fl, err := os.Open(script)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file, err := syntax.NewParser().Parse(fl, "lure.sh")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fl.Close()
|
||||
|
||||
runner, err := interp.New(
|
||||
interp.Env(expand.ListEnviron()),
|
||||
interp.ExecHandler(shutils.NopExec),
|
||||
interp.StatHandler(shutils.NopStat),
|
||||
interp.OpenHandler(shutils.NopOpen),
|
||||
interp.ReadDirHandler(shutils.NopReadDir),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = runner.Run(ctx, file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dec := decoder.New(info, runner)
|
||||
|
||||
var vars BuildVars
|
||||
err = dec.DecodeVars(&vars)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &vars, nil
|
||||
}
|
||||
|
||||
// archMatches checks if your system architecture matches
|
||||
// one of the provided architectures
|
||||
func archMatches(architectures []string) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user