No description
Find a file
2025-09-04 21:46:54 +02:00
cmd Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
.gitignore Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
appindex.go clean up 2025-03-01 17:59:26 +01:00
auto.go .xz support 2025-08-30 11:19:09 +02:00
decompress.go Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
decompress_unix.go Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
decompress_win.go Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
dirs.go Init 2025-02-25 20:15:39 +01:00
download.go .xz support 2025-08-30 11:19:09 +02:00
go.mod .xz support 2025-08-30 11:19:09 +02:00
go.sum .xz support 2025-08-30 11:19:09 +02:00
install.go clean up 2025-03-01 17:59:26 +01:00
installed_pacakges.go Updated saveInstalledPackages func 2025-02-25 21:30:39 +01:00
progress.go Init 2025-02-25 20:15:39 +01:00
README.md Updated decompression + added CLI tool for testing 2025-09-04 21:46:54 +02:00
register_unix.go Reverted changes bcs of './installer.go:115:13: spm.RegisterApp() (no value) used as value' 2025-03-02 10:09:18 +01:00
register_win.go Windows install registry changes 2025-09-03 14:58:35 +02:00
run_unix.go Windows install registry changes 2025-09-03 14:58:35 +02:00
run_win.go Windows install registry changes 2025-09-03 14:58:35 +02:00
utils.go Init 2025-02-25 20:15:39 +01:00

Logo

Spitfire Package Manager (SPM)

A package management library designed to handle automatic updates for Spitfire browser and all of its components.

SPM is currently used in:

📦 Library usage:

To use SPM for downloading, decompressing, and installing updates, implement the following example in your Go application:

package main

import (
	"fmt"
	"runtime"

	spm "weforge.xyz/Spitfire/SPM"
)

func main() {
	// Define the packages to download
	specs := []spm.AppIndexEntry{
		{
			Name:    "spitfire-launcher",
			Release: "nightly",
			OS:      runtime.GOOS,
			Arch:    runtime.GOARCH,
			Type:    "launcher",
		},
		{
			Name:    "spitfire-browser",
			Release: "nightly",
			OS:      runtime.GOOS,
			Arch:    runtime.GOARCH,
			Type:    "browser",
		},
	}

	// -- Download --
    // spm.DownloadSpecified(specs) downloads specified packages to temp dir and decompresses them, making them ready for install by running "spm.InstallUpdates()".
	fmt.Println("Starting download and decompression...")
	if err := spm.DownloadSpecified(specs); err != nil {
		fmt.Println("Error downloading packages:", err)
		return
	}

	fmt.Println("Download complete. Proceeding with installation...")

	// -- Install --
    // Install and Download are separate as you cannot replace running binaries on Windows. So the final move to the correct folder is done by "spm.InstallUpdates()".
	if err := spm.InstallUpdates(); err != nil {
		fmt.Println("Error during installation:", err)
		return
	}

	// -- Register --
	// spm.RegisterApp() is primarily used to modify the Windows registry so it recognizes Spitfire Browser as an installed program.
	// You shouldn't need to run it more than once during installation. Also this function requires administrative privileges on Windows to work correctly.
	if err := spm.RegisterApp(); err != nil {
		fmt.Println("Error registering app:", err)
		return
	}

	fmt.Println("Installation completed successfully!")

    // -- Run --
    // This function detects the browser binary and runs it. Alternatively, you can also use spm.RunAndWait()
    spm.Run()
}

CLI usage (spm binary)

SPM also ships with a standalone CLI tool located in cmd/main.go

It's useful for testing, scripting, or when you want to update Spitfire components manually.

Build:

go build -o spm ./cmd/main.go

Usage:

spm <download|install|register|run|all> [flags]

Flags (for download/all):
-pkg name:type:release[:os[:arch]] repeatable

Examples:
spm download -pkg spitfire-browser:browser:nightly
spm all -pkg spitfire-launcher:launcher:nightly -pkg spitfire-browser:browser:nightly

⚙ Environment variables

SPM respects the following environment variables:

Var Values Desc
SPM_PREFERRED_DECOMPRESS "7zip", "7zr", "tar", "purego" Choose preferred decompression method.

License

AGPLv3 License