bootscript

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bootscript generates the on_boot.d script for UniFi Dream devices. A single script file at /data/on_boot.d/20-dddns.sh selects between the two run modes (cron, serve); `dddns config set-mode` writes the output of Generate into that path.

Serve mode uses a systemd unit (standard on UniFi OS 2.x+) for supervision; cron mode installs an /etc/cron.d entry. Both artefacts live outside /data (they're on the wiped-by-firmware root FS), so the boot script re-installs them on every boot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(p Params) (string, error)

Generate returns the full text of the on_boot.d script for the given parameters. The output is idempotent — running it repeatedly leaves the system in the same state.

Types

type Params

type Params struct {
	Mode           string // "cron" or "serve"
	BinaryPath     string // e.g. /data/dddns/dddns
	ConfigDir      string // e.g. /data/.dddns
	CronEntryPath  string // e.g. /etc/cron.d/dddns
	UpdateInterval string // crontab schedule; e.g. "*/30 * * * *"
}

Params carries the paths embedded into the generated script. Callers typically pass DefaultUnifiParams; tests exercise alternative values.

func DefaultUnifiParams

func DefaultUnifiParams(mode string) Params

DefaultUnifiParams returns the path defaults for a UniFi install. UpdateInterval is intentionally left blank — the caller is responsible for populating it (typically via config.UpdateIntervalOrDefault). This keeps the cron schedule's source of truth in the config package rather than duplicating the string literal here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL