All checks were successful
CI/CD Pipeline / Code Format (push) Successful in 1s
CI/CD Pipeline / Clippy Lints (push) Successful in 44s
CI/CD Pipeline / All Unit Tests (push) Successful in 1m13s
CI/CD Pipeline / Security Audit (push) Successful in 4s
CI/CD Pipeline / Enrollment Tests (push) Successful in 1m48s
CI/CD Pipeline / Verify Enrollment CLI Flag (push) Successful in 1m22s
CI/CD Pipeline / Build Debian Package (Ubuntu 22.04) (push) Successful in 2m32s
CI/CD Pipeline / Build Arch Package (push) Successful in 2m51s
CI/CD Pipeline / Build Alpine Package (push) Successful in 3m55s
CI/CD Pipeline / Build Debian Package (push) Successful in 2m8s
CI/CD Pipeline / Build RPM Package (push) Successful in 4m13s
34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/bin/sh
|
|
# Alpine Linux pre-install script for linux-patch-api
|
|
# Runs before package files are laid down
|
|
# Matches Debian preinst behavior: create directories, set permissions
|
|
|
|
# Create required directories
|
|
mkdir -p /etc/linux_patch_api/certs
|
|
mkdir -p /var/lib/linux_patch_api
|
|
mkdir -p /var/log/linux_patch_api
|
|
|
|
# Generate machine-id if not present (required for enrollment)
|
|
# Alpine Linux does not include /etc/machine-id by default
|
|
if [ ! -f /etc/machine-id ] || [ ! -s /etc/machine-id ]; then
|
|
if command -v uuidgen > /dev/null 2>&1; then
|
|
uuidgen | tr -d '-' > /etc/machine-id
|
|
elif [ -f /proc/sys/kernel/random/uuid ]; then
|
|
cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id
|
|
else
|
|
# Fallback: generate from /dev/urandom
|
|
od -x -N4 /dev/urandom | head -1 | awk '{print $2$3}' > /etc/machine-id
|
|
fi
|
|
chmod 444 /etc/machine-id
|
|
fi
|
|
|
|
# Set proper ownership (service runs as root)
|
|
chown -R root:root /var/lib/linux_patch_api
|
|
chown -R root:root /var/log/linux_patch_api
|
|
|
|
# Set secure permissions
|
|
chmod 750 /etc/linux_patch_api
|
|
chmod 750 /etc/linux_patch_api/certs
|
|
chmod 755 /var/lib/linux_patch_api
|
|
chmod 755 /var/log/linux_patch_api
|