diff --git a/ct/geopulse.sh b/ct/geopulse.sh index 22b989ba..ffd1803d 100644 --- a/ct/geopulse.sh +++ b/ct/geopulse.sh @@ -68,4 +68,4 @@ echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" echo -e "${INFO}${YW} To create an admin account, run:${CL}" -echo -e "${TAB}${BGN}echo 'GEOPULSE_ADMIN_EMAIL=you@example.com' >> /etc/geopulse/geopulse.env && systemctl restart geopulse-backend${CL}" +echo -e "${TAB}${BGN}/usr/local/bin/create-geopulse-admin${CL}" diff --git a/install/geopulse-install.sh b/install/geopulse-install.sh index bf2f9523..4a02f6ec 100644 --- a/install/geopulse-install.sh +++ b/install/geopulse-install.sh @@ -184,6 +184,22 @@ systemctl enable -q --now nginx systemctl reload nginx msg_ok "Configured Nginx" +msg_info "Creating Admin Helper" +cat <<'EOF' >/usr/local/bin/create-geopulse-admin +#!/usr/bin/env bash +read -rp "Enter admin email address: " ADMIN_EMAIL +if [[ -z "$ADMIN_EMAIL" ]]; then + echo "No email provided. Aborting." + exit 1 +fi +sed -i '/^GEOPULSE_ADMIN_EMAIL=/d' /etc/geopulse/geopulse.env +echo "GEOPULSE_ADMIN_EMAIL=${ADMIN_EMAIL}" >>/etc/geopulse/geopulse.env +systemctl restart geopulse-backend +echo "Admin email set to '${ADMIN_EMAIL}'. Register with this email in the GeoPulse UI to receive admin privileges." +EOF +chmod +x /usr/local/bin/create-geopulse-admin +msg_ok "Created Admin Helper" + motd_ssh customize cleanup_lxc diff --git a/json/geopulse.json b/json/geopulse.json index c378f7a9..4f7621aa 100644 --- a/json/geopulse.json +++ b/json/geopulse.json @@ -33,7 +33,7 @@ }, "notes": [ { - "text": "To create an admin account: `echo 'GEOPULSE_ADMIN_EMAIL=you@example.com' >> /etc/geopulse/geopulse.env && systemctl restart geopulse-backend` — then register with that email in the UI.", + "text": "To create an admin account, run `/usr/local/bin/create-geopulse-admin` inside the container, then register with that email in the GeoPulse UI.", "type": "info" } ]