@@ -90,6 +90,26 @@ echo " Registry: ${REGISTRY}"
9090echo " Beacon: ${BEACON} "
9191echo " "
9292
93+ # --- Resolve email ---
94+
95+ EMAIL=" ${PILOT_EMAIL:- } "
96+
97+ # On fresh install, email is required (like certbot)
98+ if [ -z " $EMAIL " ] && [ ! -x " $BIN_DIR /pilotctl" ]; then
99+ # Check if account.json already has an email
100+ if [ -f " $PILOT_DIR /account.json" ]; then
101+ EMAIL=$( grep ' "email"' " $PILOT_DIR /account.json" 2> /dev/null | head -1 | cut -d' "' -f4 || true)
102+ fi
103+ if [ -z " $EMAIL " ]; then
104+ printf " Email (for account recovery): "
105+ read EMAIL
106+ if [ -z " $EMAIL " ]; then
107+ echo " Error: email is required. Set PILOT_EMAIL or enter when prompted."
108+ exit 1
109+ fi
110+ fi
111+ fi
112+
93113# --- Detect existing installation ---
94114
95115UPDATING=false
@@ -193,7 +213,8 @@ cat > "$PILOT_DIR/config.json" <<CONF
193213 "beacon": "${BEACON} ",
194214 "socket": "/tmp/pilot.sock",
195215 "encrypt": true,
196- "identity": "${PILOT_DIR} /identity.json"
216+ "identity": "${PILOT_DIR} /identity.json",
217+ "email": "${EMAIL} "
197218}
198219CONF
199220
@@ -231,6 +252,7 @@ ExecStart=${BIN_DIR}/pilot-daemon \\
231252 -listen :4000 \\
232253 -socket /tmp/pilot.sock \\
233254 -identity ${PILOT_DIR} /identity.json \\
255+ -email ${EMAIL} \\
234256 -encrypt ${HOSTNAME_FLAG} ${PUBLIC_FLAG}
235257Restart=on-failure
236258RestartSec=5
@@ -281,6 +303,8 @@ if [ "$OS" = "darwin" ]; then
281303 <string>/tmp/pilot.sock</string>
282304 <string>-identity</string>
283305 <string>${PILOT_DIR} /identity.json</string>
306+ <string>-email</string>
307+ <string>${EMAIL} </string>
284308 <string>-encrypt</string>
285309${EXTRA_ARGS} </array>
286310 <key>RunAtLoad</key>
@@ -339,11 +363,12 @@ echo " Registry: ${REGISTRY}"
339363echo " Beacon: ${BEACON} "
340364echo " Socket: /tmp/pilot.sock"
341365echo " Identity: ${PILOT_DIR} /identity.json"
366+ echo " Email: ${EMAIL} "
342367echo " "
343368echo " Get started:"
344369echo " "
345370echo " export PATH=\" ${BIN_DIR} :\$ PATH\" # if not restarting your shell"
346- echo " pilotctl daemon start --hostname my-agent"
371+ echo " pilotctl daemon start --hostname my-agent # email already saved "
347372echo " pilotctl info"
348373echo " pilotctl ping <other-agent>"
349374echo " "
0 commit comments