Add missing webroot user

This commit is contained in:
2026-04-13 21:56:29 -04:00
parent 6e54c92103
commit 05c5a5299e

View File

@@ -281,6 +281,7 @@ init() {
# Default signing context to the account currently running installJRMC.
SIGN_USER="${SIGN_USER:-$(id -un)}"
# Run the self-updater if enabled
((SELF_UPDATE_SWITCH)) && ((! SCRIPT_IS_PIPED)) && update "$@"
@@ -1157,6 +1158,20 @@ run_createrepo() {
install_package createrepo_c
# Ensure WEBROOT_USER exists or offer to create it
if ! id "$WEBROOT_USER" &>/dev/null; then
err "Specified --webroot-user '$WEBROOT_USER' does not exist"
if ask_ok "Create local user '$WEBROOT_USER'?"; then
if ! execute sudo useradd "$WEBROOT_USER"; then
err "Failed to create user '$WEBROOT_USER'"
return 1
fi
else
err "Cannot continue without a valid --webroot-user"
return 1
fi
fi
# Ensure the webroot exists
if [[ ! -d $CREATEREPO_WEBROOT ]]; then
if ! execute sudo -u "$WEBROOT_USER" mkdir -p "$CREATEREPO_WEBROOT"; then