#!/usr/bin/env bash # systemd_local_enable — Habilita un servicio systemd local (arranque automático). set -euo pipefail systemd_local_enable() { local name="$1" if [[ -z "$name" ]]; then echo "systemd_local_enable: se requiere name" >&2 return 1 fi # systemctl enable imprime "Created symlink ..." en stdout — redirigir a stderr # para que $(systemd_local_enable ...) capture sólo el JSON final. if ! sudo systemctl enable "${name}.service" >&2; then echo "systemd_local_enable: enable falló para '$name'" >&2 return 1 fi printf '{"name":"%s","enabled":true}\n' "$name" }