Private
Public Access
1
0
Files
linux_patch_api/configs/linux-patch-api-openrc
Echo 603c974116
All checks were successful
CI/CD Pipeline / Code Format (push) Successful in 2s
CI/CD Pipeline / Clippy Lints (push) Successful in 1m9s
CI/CD Pipeline / All Unit Tests (push) Successful in 1m32s
CI/CD Pipeline / Security Audit (push) Successful in 5s
CI/CD Pipeline / Enrollment Tests (push) Successful in 1m13s
CI/CD Pipeline / Verify Enrollment CLI Flag (push) Successful in 1m19s
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Successful in 2m38s
CI/CD Pipeline / Build Arch Package (push) Successful in 2m53s
CI/CD Pipeline / Build Debian Package (push) Successful in 2m36s
CI/CD Pipeline / Build Alpine Package (push) Successful in 4m8s
CI/CD Pipeline / Build RPM Package (push) Successful in 4m22s
fix: OpenRC init script - change ownership from linux-patch-api:linux-patch-api to root:root
The system user was removed from all install scripts but the OpenRC init script
still referenced linux-patch-api:linux-patch-api in checkpath. This would cause
the service to fail on Alpine because the user does not exist.
2026-05-20 14:57:53 +00:00

73 lines
2.0 KiB
Plaintext

#!/sbin/openrc-run
# OpenRC init script for linux-patch-api
# Used on Alpine Linux and other OpenRC-based systems
name="linux_patch_api"
command="/usr/bin/linux-patch-api"
command_args="--config /etc/linux_patch_api/config.yaml"
command_background=true
pidfile="/run/linux-patch-api/linux-patch-api.pid"
output_log="/var/log/linux_patch_api/linux-patch-api.log"
error_log="/var/log/linux_patch_api/linux-patch-api.err"
# Required dependencies
depend() {
use net logger
}
# Create required directories before starting
start_pre() {
checkpath --directory --owner root:root --mode 0755 \
/run/linux-patch-api \
/var/log/linux_patch_api \
/var/lib/linux_patch_api \
/etc/linux_patch_api/certs
# Ensure config files exist
if [ ! -f "/etc/linux_patch_api/config.yaml" ]; then
eerror "Configuration file missing: /etc/linux_patch_api/config.yaml"
eerror "Please create config.yaml before starting the service"
return 1
fi
if [ ! -f "/etc/linux_patch_api/whitelist.yaml" ]; then
eerror "Whitelist file missing: /etc/linux_patch_api/whitelist.yaml"
eerror "Please create whitelist.yaml before starting the service"
return 1
fi
}
# Verify service started successfully
start_post() {
sleep 2
if [ -f "$pidfile" ]; then
einfo "linux-patch-api started successfully (PID: $(cat $pidfile))"
else
ewarn "linux-patch-api may not have started correctly - pidfile not found"
fi
}
# Clean shutdown
stop_pre() {
einfo "Stopping linux-patch-api service..."
}
# Verify service stopped
stop_post() {
if [ -f "$pidfile" ]; then
rm -f "$pidfile"
fi
einfo "linux-patch-api stopped"
}
# Service status
status() {
if [ -f "$pidfile" ] && kill -0 $(cat "$pidfile") 2>/dev/null; then
einfo "linux-patch-api is running (PID: $(cat $pidfile))"
return 0
else
eerror "linux-patch-api is not running"
return 1
fi
}