Compare commits
	
		
			21 Commits
		
	
	
		
			674cfe6b0d
			...
			v0.0.3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d78064179f | |||
| 2157d9ecce | |||
| b686f810fb | |||
| c856bf0686 | |||
| c650c1dae0 | |||
| b3b6612ef2 | |||
| baf4cca4fb | |||
| e604f61151 | |||
| 8e74e58cad | |||
| be48f26e75 | |||
| b6265f4b1d | |||
| c0e535c630 | |||
| 2b6815e287 | |||
| a42c9b27e7 | |||
| e2c8335381 | |||
| b56641c659 | |||
| 61ba975e21 | |||
| 75a60070ba | |||
| a02a009b63 | |||
| 74adb915fc | |||
| bdca0a5ffc | 
@@ -21,6 +21,7 @@ archives:
 | 
				
			|||||||
      arm64: aarch64
 | 
					      arm64: aarch64
 | 
				
			||||||
nfpms:
 | 
					nfpms:
 | 
				
			||||||
  - id: lure
 | 
					  - id: lure
 | 
				
			||||||
 | 
					    package_name: linux-user-repository
 | 
				
			||||||
    file_name_template: '{{.PackageName}}-{{.Version}}-{{.Os}}-{{.Arch}}'
 | 
					    file_name_template: '{{.PackageName}}-{{.Version}}-{{.Os}}-{{.Arch}}'
 | 
				
			||||||
    description: "Linux User REpository"
 | 
					    description: "Linux User REpository"
 | 
				
			||||||
    replacements:
 | 
					    replacements:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							@@ -1,6 +1,7 @@
 | 
				
			|||||||
# LURE (Linux User REpository)
 | 
					# LURE (Linux User REpository)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://goreportcard.com/report/go.arsenm.dev/lure)
 | 
					[](https://goreportcard.com/report/go.arsenm.dev/lure)
 | 
				
			||||||
 | 
					[](https://ci.appveyor.com/project/moussaelianarsen/lure)
 | 
				
			||||||
[](https://aur.archlinux.org/packages/lure-bin/)
 | 
					[](https://aur.archlinux.org/packages/lure-bin/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LURE is intended to bring the AUR to all distros. It is currently in an ***alpha*** state and may not be stable. It can download a repository, build packages in it using a bash script similar to [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD), and then install them using your system package manager.
 | 
					LURE is intended to bring the AUR to all distros. It is currently in an ***alpha*** state and may not be stable. It can download a repository, build packages in it using a bash script similar to [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD), and then install them using your system package manager.
 | 
				
			||||||
@@ -41,20 +42,6 @@ The documentation for LURE is in the [docs](docs) directory in this repo.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Cross-packaging for other Distributions
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can create packages for different distributions  
 | 
					 | 
				
			||||||
setting the environment variables `LURE_DISTRO` and `LURE_PKG_FORMAT`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
LURE_DISTRO=arch     LURE_PKG_FORMAT=archlinux lure build
 | 
					 | 
				
			||||||
LURE_DISTRO=alpine   LURE_PKG_FORMAT=apk       lure build
 | 
					 | 
				
			||||||
LURE_DISTRO=opensuse LURE_PKG_FORMAT=rpm       lure build
 | 
					 | 
				
			||||||
LURE_DISTRO=debian   LURE_PKG_FORMAT=deb       lure build
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
---
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Repositories
 | 
					## Repositories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Unlike the AUR, LURE supports using multiple repos. Also unlike the AUR, LURE's repos are a single git repo containing all the build scripts. Inside each LURE repo, there should be a separate directory for each package containing a `lure.sh` script, which is a PKGBUILD-like build script for LURE. The default repository is hosted on Github: https://github.com/Arsen6331/lure-repo.
 | 
					Unlike the AUR, LURE supports using multiple repos. Also unlike the AUR, LURE's repos are a single git repo containing all the build scripts. Inside each LURE repo, there should be a separate directory for each package containing a `lure.sh` script, which is a PKGBUILD-like build script for LURE. The default repository is hosted on Github: https://github.com/Arsen6331/lure-repo.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										54
									
								
								build.go
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								build.go
									
									
									
									
									
								
							@@ -19,6 +19,7 @@
 | 
				
			|||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"encoding/hex"
 | 
						"encoding/hex"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
@@ -76,7 +77,7 @@ type Scripts struct {
 | 
				
			|||||||
	PreInstall  string `sh:"preinstall"`
 | 
						PreInstall  string `sh:"preinstall"`
 | 
				
			||||||
	PostInstall string `sh:"postinstall"`
 | 
						PostInstall string `sh:"postinstall"`
 | 
				
			||||||
	PreRemove   string `sh:"preremove"`
 | 
						PreRemove   string `sh:"preremove"`
 | 
				
			||||||
	PostRemove  string `sh:"postinstall"`
 | 
						PostRemove  string `sh:"postremove"`
 | 
				
			||||||
	PreUpgrade  string `sh:"preupgrade"`
 | 
						PreUpgrade  string `sh:"preupgrade"`
 | 
				
			||||||
	PostUpgrade string `sh:"postupgrade"`
 | 
						PostUpgrade string `sh:"postupgrade"`
 | 
				
			||||||
	PreTrans    string `sh:"pretrans"`
 | 
						PreTrans    string `sh:"pretrans"`
 | 
				
			||||||
@@ -91,12 +92,23 @@ func buildCmd(c *cli.Context) error {
 | 
				
			|||||||
		log.Fatal("Unable to detect supported package manager on system").Send()
 | 
							log.Fatal("Unable to detect supported package manager on system").Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_, pkgNames, err := buildPackage(c.Context, script, mgr)
 | 
						pkgPaths, _, err := buildPackage(c.Context, script, mgr)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		log.Fatal("Error building package").Err(err).Send()
 | 
							log.Fatal("Error building package").Err(err).Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	log.Info("Package(s) built successfully").Any("names", pkgNames).Send()
 | 
						wd, err := os.Getwd()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Fatal("Error getting working directory").Err(err).Send()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for _, pkgPath := range pkgPaths {
 | 
				
			||||||
 | 
							name := filepath.Base(pkgPath)
 | 
				
			||||||
 | 
							err = os.Rename(pkgPath, filepath.Join(wd, name))
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								log.Fatal("Error moving the package").Err(err).Send()
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -107,8 +119,10 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
 | 
				
			|||||||
		return nil, nil, err
 | 
							return nil, nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var distroChanged bool
 | 
				
			||||||
	if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
 | 
						if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
 | 
				
			||||||
		info.ID = distID
 | 
							info.ID = distID
 | 
				
			||||||
 | 
							distroChanged = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fl, err := os.Open(script)
 | 
						fl, err := os.Open(script)
 | 
				
			||||||
@@ -140,6 +154,12 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	dec := decoder.New(info, runner)
 | 
						dec := decoder.New(info, runner)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// If distro was changed, the list of like distros
 | 
				
			||||||
 | 
						// no longer applies, so disable its use
 | 
				
			||||||
 | 
						if distroChanged {
 | 
				
			||||||
 | 
							dec.LikeDistros = false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var vars BuildVars
 | 
						var vars BuildVars
 | 
				
			||||||
	err = dec.DecodeVars(&vars)
 | 
						err = dec.DecodeVars(&vars)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -183,7 +203,7 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if len(vars.BuildDepends) > 0 {
 | 
						if len(vars.BuildDepends) > 0 {
 | 
				
			||||||
		log.Info("Installing build dependencies").Send()
 | 
							log.Info("Installing build dependencies").Send()
 | 
				
			||||||
		installPkgs(ctx, vars.BuildDepends, mgr)
 | 
							installPkgs(ctx, vars.BuildDepends, mgr, false)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var builtDeps, builtNames, repoDeps []string
 | 
						var builtDeps, builtNames, repoDeps []string
 | 
				
			||||||
@@ -219,17 +239,37 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
 | 
				
			|||||||
	if ok {
 | 
						if ok {
 | 
				
			||||||
		log.Info("Executing prepare()").Send()
 | 
							log.Info("Executing prepare()").Send()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = fn(ctx, srcdir)
 | 
							err = fn(ctx, interp.Dir(srcdir))
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, nil, err
 | 
								return nil, nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn, ok = dec.GetFunc("version")
 | 
				
			||||||
 | 
						if ok {
 | 
				
			||||||
 | 
							log.Info("Executing version()").Send()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							buf := &bytes.Buffer{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							err = fn(
 | 
				
			||||||
 | 
								ctx,
 | 
				
			||||||
 | 
								interp.Dir(srcdir),
 | 
				
			||||||
 | 
								interp.StdIO(os.Stdin, buf, os.Stderr),
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							vars.Version = strings.TrimSpace(buf.String())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							log.Info("Updating version").Str("new", vars.Version).Send()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn, ok = dec.GetFunc("build")
 | 
						fn, ok = dec.GetFunc("build")
 | 
				
			||||||
	if ok {
 | 
						if ok {
 | 
				
			||||||
		log.Info("Executing build()").Send()
 | 
							log.Info("Executing build()").Send()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = fn(ctx, srcdir)
 | 
							err = fn(ctx, interp.Dir(srcdir))
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, nil, err
 | 
								return nil, nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -239,7 +279,7 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
 | 
				
			|||||||
	if ok {
 | 
						if ok {
 | 
				
			||||||
		log.Info("Executing package()").Send()
 | 
							log.Info("Executing package()").Send()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = fn(ctx, srcdir)
 | 
							err = fn(ctx, interp.Dir(srcdir))
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, nil, err
 | 
								return nil, nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,3 +3,4 @@
 | 
				
			|||||||
- [Build Scripts](build-scripts.md)
 | 
					- [Build Scripts](build-scripts.md)
 | 
				
			||||||
- [Usage](usage.md)
 | 
					- [Usage](usage.md)
 | 
				
			||||||
- [Configuration](configuration.md)
 | 
					- [Configuration](configuration.md)
 | 
				
			||||||
 | 
					- [Adding Packages to LURE's repo](adding-packages.md)
 | 
				
			||||||
							
								
								
									
										23
									
								
								docs/adding-packages.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								docs/adding-packages.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					# Adding Packages to LURE's repo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Requirements
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- `go` (1.18+)
 | 
				
			||||||
 | 
					- `git`
 | 
				
			||||||
 | 
					- `lure-analyzer`
 | 
				
			||||||
 | 
					    - `go install go.arsenm.dev/lure-repo-bot/cmd/lure-analyzer@latest`
 | 
				
			||||||
 | 
					- `shfmt`
 | 
				
			||||||
 | 
					    - May be available in distro repos
 | 
				
			||||||
 | 
					    - `go install mvdan.cc/sh/v3/cmd/shfmt@latest`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## How to submit a package
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LURE's repo is hosted on Github at https://github.com/Arsen6331/lure-repo. In it, there are multiple directories each containing a `lure.sh` file. In order to add a package to LURE's repo, simply create a PR with a [build script](./build-scripts.md) and place it in a directory with the same name as the package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Upon submitting the PR, [lure-repo-bot](https://github.com/Arsen6331/lure-repo-bot) will pull your PR and analyze it, providing suggestions for fixes as review comments. If there are no problems, the bot will approve your changes. If there are issues, re-request review from the bot after you've finished applying the fixes and it will automatically review the PR again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					All scripts submitted to the LURE repo should be formatted with `shfmt`. If they are not properly formatted, Github Actions will add suggestions in the "Files Changed" tab of the PR.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Once your PR is merged, LURE will pull the changed repo and your package will be available for people to install.
 | 
				
			||||||
@@ -26,6 +26,11 @@ LURE uses build scripts similar to the AUR's PKGBUILDs. This is the documentatio
 | 
				
			|||||||
    - [checksums](#checksums)
 | 
					    - [checksums](#checksums)
 | 
				
			||||||
    - [backup](#backup)
 | 
					    - [backup](#backup)
 | 
				
			||||||
    - [scripts](#scripts)
 | 
					    - [scripts](#scripts)
 | 
				
			||||||
 | 
					- [Functions](#functions)
 | 
				
			||||||
 | 
					    - [prepare](#prepare)
 | 
				
			||||||
 | 
					    - [version](#version-1)
 | 
				
			||||||
 | 
					    - [build](#build)
 | 
				
			||||||
 | 
					    - [package](#package)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -50,6 +55,15 @@ Names are checked in the following order:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Distro detection is performed by reading the `/usr/lib/os-release` and `/etc/os-release` files.
 | 
					Distro detection is performed by reading the `/usr/lib/os-release` and `/etc/os-release` files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Like distros
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Inside the `os-release` file, there is a list of "like" distros. LURE takes this into account. For example, if a script contains `deps_debian` but not `deps_ubuntu`, Ubuntu builds will use `deps_debian` because Ubuntu is based on debian.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Most specificity is preferred, so if both `deps_debian` and `deps_ubuntu` is provided, Ubuntu and all Ubuntu-based distros will use `deps_ubuntu` while Debian and all Debian-based distros 
 | 
				
			||||||
 | 
					that are not Ubuntu-based will use `deps_debian`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Like distros are disabled when using the `LURE_DISTRO` environment variable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Variables
 | 
					## Variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Any variables marked with `(*)` are required
 | 
					Any variables marked with `(*)` are required
 | 
				
			||||||
@@ -110,7 +124,7 @@ LURE_ARM_VARIANT=arm5 lure install ...
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### licenses
 | 
					### licenses
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The `licenses` array contains the licenses used by this package. Some valid values include `GPLv3` and `MIT`.
 | 
					The `licenses` array contains the licenses used by this package. In order to standardize license names, values should be [SPDX Identifiers](https://spdx.org/licenses/) such as `Apache-2.0`, `MIT`, and `GPL-3.0-only`. If the project uses a license that is not standardized in SPDX, use the value `Custom`. If the project has multiple nonstandard licenses, include `Custom` as many times as there are nonstandard licenses.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### provides
 | 
					### provides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -154,6 +168,7 @@ If the URL scheme starts with `git+`, the source will be downloaded as a git rep
 | 
				
			|||||||
- `~branch`: Specify which branch of the repo to check out.
 | 
					- `~branch`: Specify which branch of the repo to check out.
 | 
				
			||||||
- `~commit`: Specify which commit of the repo to check out.
 | 
					- `~commit`: Specify which commit of the repo to check out.
 | 
				
			||||||
- `~depth`: Specify what depth should be used when cloning the repo. Must be an integer.
 | 
					- `~depth`: Specify what depth should be used when cloning the repo. Must be an integer.
 | 
				
			||||||
 | 
					- `~name`: Specify the name of the directory into which the git repo should be cloned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Examples:
 | 
					Examples:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -216,6 +231,21 @@ All functions start in the `$srcdir` directory
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The `prepare()` function runs first. It is meant to prepare the sources for building and packaging. This is the function in which patches should be applied, for example, by the `patch` command, and where tools like `go generate` should be executed.
 | 
					The `prepare()` function runs first. It is meant to prepare the sources for building and packaging. This is the function in which patches should be applied, for example, by the `patch` command, and where tools like `go generate` should be executed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `version()` function updates the `version` variable. This allows for automatically deriving the version from sources. This is most useful for git packages, which usually don't need to be changed, so their `version` variable stays the same.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					An example of using this for git:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					version() {
 | 
				
			||||||
 | 
						cd "$srcdir/itd"
 | 
				
			||||||
 | 
						printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The AUR equivalent is the [`pkgver()` function](https://wiki.archlinux.org/title/VCS_package_guidelines#The_pkgver()_function)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### build
 | 
					### build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The `build()` function is where the package is actually built. Use the same commands that would be used to manually compile the software. Often, this function is just one line:
 | 
					The `build()` function is where the package is actually built. Use the same commands that would be used to manually compile the software. Often, this function is just one line:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -111,6 +111,8 @@ Example:
 | 
				
			|||||||
lure ref
 | 
					lure ref
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Environment Variables
 | 
					## Environment Variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### LURE_DISTRO
 | 
					### LURE_DISTRO
 | 
				
			||||||
@@ -138,3 +140,21 @@ The `LURE_ARM_VARIANT` environment variable dictates which ARM variant to build
 | 
				
			|||||||
- `arm5`
 | 
					- `arm5`
 | 
				
			||||||
- `arm6`
 | 
					- `arm6`
 | 
				
			||||||
- `arm7`
 | 
					- `arm7`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Cross-packaging for other Distributions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can create packages for different distributions  
 | 
				
			||||||
 | 
					setting the environment variables `LURE_DISTRO` and `LURE_PKG_FORMAT` as mentioned above.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Examples:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					LURE_DISTRO=arch     LURE_PKG_FORMAT=archlinux lure build
 | 
				
			||||||
 | 
					LURE_DISTRO=alpine   LURE_PKG_FORMAT=apk       lure build
 | 
				
			||||||
 | 
					LURE_DISTRO=opensuse LURE_PKG_FORMAT=rpm       lure build
 | 
				
			||||||
 | 
					LURE_DISTRO=debian   LURE_PKG_FORMAT=deb       lure build
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
@@ -23,6 +23,7 @@ import (
 | 
				
			|||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"crypto/sha256"
 | 
						"crypto/sha256"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"hash"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
@@ -67,6 +68,22 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	query := src.Query()
 | 
						query := src.Query()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if strings.HasPrefix(src.Scheme, "git+") {
 | 
				
			||||||
 | 
							err = getGit(ctx, src, query, opts)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							err = getFile(ctx, src, query, opts)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func getGit(ctx context.Context, src *url.URL, query url.Values, opts GetOptions) (err error) {
 | 
				
			||||||
	tag := query.Get("~tag")
 | 
						tag := query.Get("~tag")
 | 
				
			||||||
	query.Del("~tag")
 | 
						query.Del("~tag")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -79,6 +96,9 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
	depthStr := query.Get("~depth")
 | 
						depthStr := query.Get("~depth")
 | 
				
			||||||
	query.Del("~depth")
 | 
						query.Del("~depth")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						name := query.Get("~name")
 | 
				
			||||||
 | 
						query.Del("~name")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var refName plumbing.ReferenceName
 | 
						var refName plumbing.ReferenceName
 | 
				
			||||||
	if tag != "" {
 | 
						if tag != "" {
 | 
				
			||||||
		refName = plumbing.NewTagReferenceName(tag)
 | 
							refName = plumbing.NewTagReferenceName(tag)
 | 
				
			||||||
@@ -86,12 +106,13 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
		refName = plumbing.NewBranchReferenceName(branch)
 | 
							refName = plumbing.NewBranchReferenceName(branch)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if strings.HasPrefix(src.Scheme, "git+") {
 | 
					 | 
				
			||||||
	src.Scheme = strings.TrimPrefix(src.Scheme, "git+")
 | 
						src.Scheme = strings.TrimPrefix(src.Scheme, "git+")
 | 
				
			||||||
	src.RawQuery = query.Encode()
 | 
						src.RawQuery = query.Encode()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		name := path.Base(src.Path)
 | 
						if name == "" {
 | 
				
			||||||
 | 
							name = path.Base(src.Path)
 | 
				
			||||||
		name = strings.TrimSuffix(name, ".git")
 | 
							name = strings.TrimSuffix(name, ".git")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dstDir := opts.Destination
 | 
						dstDir := opts.Destination
 | 
				
			||||||
	if opts.EncloseGit {
 | 
						if opts.EncloseGit {
 | 
				
			||||||
@@ -132,7 +153,9 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return w.Checkout(checkoutOpts)
 | 
						return w.Checkout(checkoutOpts)
 | 
				
			||||||
	} else {
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func getFile(ctx context.Context, src *url.URL, query url.Values, opts GetOptions) error {
 | 
				
			||||||
	name := query.Get("~name")
 | 
						name := query.Get("~name")
 | 
				
			||||||
	query.Del("~name")
 | 
						query.Del("~name")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -183,6 +206,16 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
	} else if err != nil {
 | 
						} else if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
 | 
							err = extractFile(ctx, input, hash, format, name, opts)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func extractFile(ctx context.Context, input io.Reader, hash hash.Hash, format archiver.Format, name string, opts GetOptions) (err error) {
 | 
				
			||||||
	r := io.TeeReader(input, hash)
 | 
						r := io.TeeReader(input, hash)
 | 
				
			||||||
	fname := format.Name()
 | 
						fname := format.Name()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -249,8 +282,6 @@ func Get(ctx context.Context, opts GetOptions) error {
 | 
				
			|||||||
			return ErrChecksumMismatch
 | 
								return ErrChecksumMismatch
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								go.mod
									
									
									
									
									
								
							@@ -2,12 +2,10 @@ module go.arsenm.dev/lure
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
go 1.18
 | 
					go 1.18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
replace github.com/goreleaser/nfpm/v2 => github.com/Arsen6331/nfpm/v2 v2.0.0-20220922210414-eae88e8ea4b5
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	github.com/AlecAivazis/survey/v2 v2.3.6
 | 
						github.com/AlecAivazis/survey/v2 v2.3.6
 | 
				
			||||||
	github.com/go-git/go-git/v5 v5.4.2
 | 
						github.com/go-git/go-git/v5 v5.4.2
 | 
				
			||||||
	github.com/goreleaser/nfpm/v2 v2.18.1
 | 
						github.com/goreleaser/nfpm/v2 v2.20.0
 | 
				
			||||||
	github.com/mholt/archiver/v4 v4.0.0-alpha.7
 | 
						github.com/mholt/archiver/v4 v4.0.0-alpha.7
 | 
				
			||||||
	github.com/mitchellh/mapstructure v1.5.0
 | 
						github.com/mitchellh/mapstructure v1.5.0
 | 
				
			||||||
	github.com/pelletier/go-toml/v2 v2.0.5
 | 
						github.com/pelletier/go-toml/v2 v2.0.5
 | 
				
			||||||
@@ -39,7 +37,6 @@ require (
 | 
				
			|||||||
	github.com/go-git/go-billy/v5 v5.3.1 // indirect
 | 
						github.com/go-git/go-billy/v5 v5.3.1 // indirect
 | 
				
			||||||
	github.com/gobwas/glob v0.2.3 // indirect
 | 
						github.com/gobwas/glob v0.2.3 // indirect
 | 
				
			||||||
	github.com/golang/snappy v0.0.4 // indirect
 | 
						github.com/golang/snappy v0.0.4 // indirect
 | 
				
			||||||
	github.com/google/rpmpack v0.0.0-20220314092521-38642b5e571e // indirect
 | 
					 | 
				
			||||||
	github.com/google/uuid v1.3.0 // indirect
 | 
						github.com/google/uuid v1.3.0 // indirect
 | 
				
			||||||
	github.com/gookit/color v1.5.1 // indirect
 | 
						github.com/gookit/color v1.5.1 // indirect
 | 
				
			||||||
	github.com/goreleaser/chglog v0.2.2 // indirect
 | 
						github.com/goreleaser/chglog v0.2.2 // indirect
 | 
				
			||||||
@@ -49,7 +46,7 @@ require (
 | 
				
			|||||||
	github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 | 
						github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 | 
				
			||||||
	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
 | 
						github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
 | 
				
			||||||
	github.com/kevinburke/ssh_config v1.1.0 // indirect
 | 
						github.com/kevinburke/ssh_config v1.1.0 // indirect
 | 
				
			||||||
	github.com/klauspost/compress v1.15.5 // indirect
 | 
						github.com/klauspost/compress v1.15.11 // indirect
 | 
				
			||||||
	github.com/klauspost/pgzip v1.2.5 // indirect
 | 
						github.com/klauspost/pgzip v1.2.5 // indirect
 | 
				
			||||||
	github.com/mattn/go-colorable v0.1.2 // indirect
 | 
						github.com/mattn/go-colorable v0.1.2 // indirect
 | 
				
			||||||
	github.com/mattn/go-isatty v0.0.14 // indirect
 | 
						github.com/mattn/go-isatty v0.0.14 // indirect
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								go.sum
									
									
									
									
									
								
							@@ -2,8 +2,6 @@ github.com/AlecAivazis/survey/v2 v2.3.6 h1:NvTuVHISgTHEHeBFqt6BHOe4Ny/NwGZr7w+F8
 | 
				
			|||||||
github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
 | 
					github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
 | 
				
			||||||
github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w=
 | 
					github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w=
 | 
				
			||||||
github.com/AlekSi/pointer v1.2.0/go.mod h1:gZGfd3dpW4vEc/UlyfKKi1roIqcCgwOIvb0tSNSBle0=
 | 
					github.com/AlekSi/pointer v1.2.0/go.mod h1:gZGfd3dpW4vEc/UlyfKKi1roIqcCgwOIvb0tSNSBle0=
 | 
				
			||||||
github.com/Arsen6331/nfpm/v2 v2.0.0-20220922210414-eae88e8ea4b5 h1:SFWe7Ho60w43hXEIxCdiAXZvUyM9GF/L90jMK42s8gU=
 | 
					 | 
				
			||||||
github.com/Arsen6331/nfpm/v2 v2.0.0-20220922210414-eae88e8ea4b5/go.mod h1:O4K1mvEORY78CSCInptGG5MWJ19yr9xFTgWWUtY1R7o=
 | 
					 | 
				
			||||||
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
 | 
					github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
 | 
				
			||||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
 | 
					github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
 | 
				
			||||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
 | 
					github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
 | 
				
			||||||
@@ -72,11 +70,8 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
 | 
				
			|||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
 | 
					github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
 | 
				
			||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
					github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
				
			||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 | 
					github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 | 
				
			||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 | 
					 | 
				
			||||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
 | 
					github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
 | 
				
			||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
 | 
					github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
 | 
				
			||||||
github.com/google/rpmpack v0.0.0-20220314092521-38642b5e571e h1:6Jn9JtfCn20uycra92LxTkq5yfBKNSFlRJPBk8/Cxhg=
 | 
					 | 
				
			||||||
github.com/google/rpmpack v0.0.0-20220314092521-38642b5e571e/go.mod h1:83rLnx5vhPyN/mDzBYJWtiPf+9xnSVQynTpqZWe7OnY=
 | 
					 | 
				
			||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
 | 
					github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
 | 
				
			||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 | 
					github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 | 
				
			||||||
github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ=
 | 
					github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ=
 | 
				
			||||||
@@ -86,6 +81,8 @@ github.com/goreleaser/chglog v0.2.2 h1:V7nf07baXtGAgGevvqgW2MM4kZ6gOr12vKNSAU3VI
 | 
				
			|||||||
github.com/goreleaser/chglog v0.2.2/go.mod h1:2s5JwtCOWjZa8AIneL+xdUl9SRuigCjRHNHsX30dupE=
 | 
					github.com/goreleaser/chglog v0.2.2/go.mod h1:2s5JwtCOWjZa8AIneL+xdUl9SRuigCjRHNHsX30dupE=
 | 
				
			||||||
github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+k+7I=
 | 
					github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+k+7I=
 | 
				
			||||||
github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU=
 | 
					github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU=
 | 
				
			||||||
 | 
					github.com/goreleaser/nfpm/v2 v2.20.0 h1:Q/CrX54KUMluz6+M/pjTbknFd5Dao8qXi0C6ZuFCtfY=
 | 
				
			||||||
 | 
					github.com/goreleaser/nfpm/v2 v2.20.0/go.mod h1:/Fh6XfwT/T+D4qtNC2iXmHSD/1UT20JkvBXyJ6nFmOY=
 | 
				
			||||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
 | 
					github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
 | 
				
			||||||
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
 | 
					github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
 | 
				
			||||||
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
 | 
					github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
 | 
				
			||||||
@@ -103,9 +100,8 @@ github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT
 | 
				
			|||||||
github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o=
 | 
					github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o=
 | 
				
			||||||
github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
 | 
					github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
 | 
				
			||||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
 | 
					github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
 | 
				
			||||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
 | 
					github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
 | 
				
			||||||
github.com/klauspost/compress v1.15.5 h1:qyCLMz2JCrKADihKOh9FxnW3houKeNsp2h5OEz0QSEA=
 | 
					github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
 | 
				
			||||||
github.com/klauspost/compress v1.15.5/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
 | 
					 | 
				
			||||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
 | 
					github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
 | 
				
			||||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
 | 
					github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
 | 
				
			||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
 | 
					github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,21 +36,23 @@ func installCmd(c *cli.Context) error {
 | 
				
			|||||||
		log.Fatal("Unable to detect supported package manager on system").Send()
 | 
							log.Fatal("Unable to detect supported package manager on system").Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	installPkgs(c.Context, args.Slice(), mgr)
 | 
						installPkgs(c.Context, args.Slice(), mgr, true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func installPkgs(ctx context.Context, pkgs []string, mgr manager.Manager) {
 | 
					func installPkgs(ctx context.Context, pkgs []string, mgr manager.Manager, pull bool) {
 | 
				
			||||||
 | 
						if pull {
 | 
				
			||||||
		err := pullRepos(ctx)
 | 
							err := pullRepos(ctx)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			log.Fatal("Error pulling repositories").Err(err).Send()
 | 
								log.Fatal("Error pulling repositories").Err(err).Send()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	scripts, notFound := findPkgs(pkgs)
 | 
						scripts, notFound := findPkgs(pkgs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(notFound) > 0 {
 | 
						if len(notFound) > 0 {
 | 
				
			||||||
		err = mgr.Install(nil, notFound...)
 | 
							err := mgr.Install(nil, notFound...)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			log.Fatal("Error installing native packages").Err(err).Send()
 | 
								log.Fatal("Error installing native packages").Err(err).Send()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,21 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * LURE - Linux User REpository
 | 
				
			||||||
 | 
					 * Copyright (C) 2022 Arsen Musayelyan
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package cpu
 | 
					package cpu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,12 +49,15 @@ func (nfe VarNotFoundError) Error() string {
 | 
				
			|||||||
type Decoder struct {
 | 
					type Decoder struct {
 | 
				
			||||||
	info   *distro.OSRelease
 | 
						info   *distro.OSRelease
 | 
				
			||||||
	runner *interp.Runner
 | 
						runner *interp.Runner
 | 
				
			||||||
 | 
						// Enable distro overrides (true by default)
 | 
				
			||||||
	Overrides bool
 | 
						Overrides bool
 | 
				
			||||||
 | 
						// Enable using like distros for overrides (true by default)
 | 
				
			||||||
 | 
						LikeDistros bool
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// New creates a new variable decoder
 | 
					// New creates a new variable decoder
 | 
				
			||||||
func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
 | 
					func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
 | 
				
			||||||
	return &Decoder{info, runner, true}
 | 
						return &Decoder{info, runner, true, true}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// DecodeVar decodes a variable to val using reflection.
 | 
					// DecodeVar decodes a variable to val using reflection.
 | 
				
			||||||
@@ -139,7 +142,7 @@ func (d *Decoder) DecodeVars(val any) error {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ScriptFunc func(ctx context.Context, sir string, args ...string) error
 | 
					type ScriptFunc func(ctx context.Context, opts ...interp.RunnerOption) error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// GetFunc returns a function corresponding to a bash function
 | 
					// GetFunc returns a function corresponding to a bash function
 | 
				
			||||||
// with the given name
 | 
					// with the given name
 | 
				
			||||||
@@ -149,10 +152,11 @@ func (d *Decoder) GetFunc(name string) (ScriptFunc, bool) {
 | 
				
			|||||||
		return nil, false
 | 
							return nil, false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return func(ctx context.Context, dir string, args ...string) error {
 | 
						return func(ctx context.Context, opts ...interp.RunnerOption) error {
 | 
				
			||||||
		sub := d.runner.Subshell()
 | 
							sub := d.runner.Subshell()
 | 
				
			||||||
		interp.Params(args...)(sub)
 | 
							for _, opt := range opts {
 | 
				
			||||||
		interp.Dir(dir)(sub)
 | 
								opt(sub)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return sub.Run(ctx, fn)
 | 
							return sub.Run(ctx, fn)
 | 
				
			||||||
	}, true
 | 
						}, true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -206,7 +210,9 @@ func (d *Decoder) genPossibleNames(name string) []string {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	distros := []string{d.info.ID}
 | 
						distros := []string{d.info.ID}
 | 
				
			||||||
 | 
						if d.LikeDistros {
 | 
				
			||||||
		distros = append(distros, d.info.Like...)
 | 
							distros = append(distros, d.info.Like...)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var out []string
 | 
						var out []string
 | 
				
			||||||
	for _, arch := range architectures {
 | 
						for _, arch := range architectures {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								list.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								list.go
									
									
									
									
									
								
							@@ -1,3 +1,21 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * LURE - Linux User REpository
 | 
				
			||||||
 | 
					 * Copyright (C) 2022 Arsen Musayelyan
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					 * it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					 * (at your option) any later version.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					 * GNU General Public License for more details.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ func (p *Pacman) Sync(opts *Opts) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (p *Pacman) Install(opts *Opts, pkgs ...string) error {
 | 
					func (p *Pacman) Install(opts *Opts, pkgs ...string) error {
 | 
				
			||||||
	opts = ensureOpts(opts)
 | 
						opts = ensureOpts(opts)
 | 
				
			||||||
	cmd := p.getCmd(opts, "pacman", "-S")
 | 
						cmd := p.getCmd(opts, "pacman", "-S", "--needed")
 | 
				
			||||||
	cmd.Args = append(cmd.Args, pkgs...)
 | 
						cmd.Args = append(cmd.Args, pkgs...)
 | 
				
			||||||
	setCmdEnv(cmd)
 | 
						setCmdEnv(cmd)
 | 
				
			||||||
	err := cmd.Run()
 | 
						err := cmd.Run()
 | 
				
			||||||
@@ -72,7 +72,7 @@ func (p *Pacman) Install(opts *Opts, pkgs ...string) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (p *Pacman) InstallLocal(opts *Opts, pkgs ...string) error {
 | 
					func (p *Pacman) InstallLocal(opts *Opts, pkgs ...string) error {
 | 
				
			||||||
	opts = ensureOpts(opts)
 | 
						opts = ensureOpts(opts)
 | 
				
			||||||
	cmd := p.getCmd(opts, "pacman", "-U")
 | 
						cmd := p.getCmd(opts, "pacman", "-U", "--needed")
 | 
				
			||||||
	cmd.Args = append(cmd.Args, pkgs...)
 | 
						cmd.Args = append(cmd.Args, pkgs...)
 | 
				
			||||||
	setCmdEnv(cmd)
 | 
						setCmdEnv(cmd)
 | 
				
			||||||
	err := cmd.Run()
 | 
						err := cmd.Run()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,13 +38,18 @@ func upgradeCmd(c *cli.Context) error {
 | 
				
			|||||||
		log.Fatal("Unable to detect supported package manager on system").Send()
 | 
							log.Fatal("Unable to detect supported package manager on system").Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err = pullRepos(c.Context)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Fatal("Error pulling repos").Err(err).Send()
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updates, err := checkForUpdates(c.Context, mgr, info)
 | 
						updates, err := checkForUpdates(c.Context, mgr, info)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		log.Fatal("Error checking for updates").Err(err).Send()
 | 
							log.Fatal("Error checking for updates").Err(err).Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(updates) > 0 {
 | 
						if len(updates) > 0 {
 | 
				
			||||||
		installPkgs(c.Context, updates, mgr)
 | 
							installPkgs(c.Context, updates, mgr, false)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		log.Info("There is nothing to do.").Send()
 | 
							log.Info("There is nothing to do.").Send()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user