Add missing webroot user
This commit is contained in:
15
installJRMC
15
installJRMC
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user