diff --git a/install/ente-install.sh b/install/ente-install.sh index cf59ad1f..05cea509 100644 --- a/install/ente-install.sh +++ b/install/ente-install.sh @@ -309,7 +309,22 @@ if [ -z "$1" ]; then exit 1 fi EMAIL="$1" -echo "Upgrading subscription for: $EMAIL" +DB_NAME="$(grep -A1 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')" +DB_USER="$(grep -A2 '^db:' /opt/ente/server/museum.yaml | awk '/user:/{print $2}')" +USER_ID=$(psql -U "$DB_USER" -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;") +if [ -z "$USER_ID" ]; then + echo "Error: No user found with email $EMAIL" + exit 1 +fi +echo "Found user ID: $USER_ID for $EMAIL" +if ! grep -q "^internal:" /opt/ente/server/museum.yaml; then + printf '\ninternal:\n admin: %s\n' "$USER_ID" >> /opt/ente/server/museum.yaml + echo "Added admin entry to museum.yaml" + systemctl restart ente-museum + sleep 2 +else + echo "internal: section already exists in museum.yaml — verify admin is set" +fi ente admin update-subscription -a "$EMAIL" -u "$EMAIL" --no-limit True EOF chmod +x /usr/local/bin/ente-upgrade-subscription diff --git a/json/ente.json b/json/ente.json index 8b029c2e..bbf8f236 100644 --- a/json/ente.json +++ b/json/ente.json @@ -41,15 +41,11 @@ "type": "warning" }, { - "text": "First-Start: The first registered user automatically becomes admin", - "type": "info" - }, - { - "text": "First-Start: Add your account to the CLI: `ente account add` (export dir: any path, e.g. /photos)", + "text": "First-Start: Add your account to the CLI first: `ente account add` (export dir: any path, e.g. /photos)", "type": "warning" }, { - "text": "First-Start: Remove the subscription limit: `ente admin update-subscription -a -u --no-limit True`", + "text": "First-Start: Whitelist admin and remove subscription limit: `ente-upgrade-subscription `", "type": "warning" }, {