bootscript

package
v0.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 1 Imported by: 0

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
	UpdateLogPath  string // e.g. /var/log/dddns.log
	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 production defaults for a UniFi install.

Jump to

Keyboard shortcuts

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