Skip to content

postinstall is platform-specific (systemd) and runs sudo during install — make platform-agnostic / opt-in #3

Description

@Shinrai

Tracking issue — not urgent.

postinstall.js runs on every npm install. On a systemd Linux host it attempts sudo cp wol-proxy.service /etc/systemd/system/ + sudo systemctl daemon-reload. Problems:

  • Platform-specific: only handles systemd Linux. No macOS (launchd), Windows (services), or non-systemd Linux (OpenRC/runit/s6) — those users get nothing, and the "service" story is Linux-only.
  • Runs sudo from an install hook: privileged operations during npm install are surprising and fragile — they can prompt for a password, silently fail, or (on CI runners, where sudo is passwordless and /etc/systemd/system exists) actually mutate the host. It currently fires during CI npm ci.
  • Auto-installing a system service as an install side effect is unexpected behavior for a library/CLI.

Direction for a later pass (make it platform-agnostic):

  • Move service installation out of postinstall into an explicit, opt-in command (e.g. a wol-proxy install-service bin subcommand, or documented manual steps).
  • Detect the platform and either support the common init systems (systemd / launchd / Windows service) or clearly document manual setup per platform.
  • Never sudo from postinstall; skip entirely under CI (process.env.CI).

Surfaced during the @v4 onboarding (the onboarding installs devDeps with --ignore-scripts locally to avoid this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions