Skip to content

Commit 2d7346c

Browse files
committed
Sync web/public/install.sh with root install.sh
The website copy was missing the email prompt, config.json email field, systemd -email flag, and macOS LaunchAgent -email entries.
1 parent aa0a5fa commit 2d7346c

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

web/public/install.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ echo " Registry: ${REGISTRY}"
9090
echo " Beacon: ${BEACON}"
9191
echo ""
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

95115
UPDATING=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
}
198219
CONF
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}
235257
Restart=on-failure
236258
RestartSec=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}"
339363
echo " Beacon: ${BEACON}"
340364
echo " Socket: /tmp/pilot.sock"
341365
echo " Identity: ${PILOT_DIR}/identity.json"
366+
echo " Email: ${EMAIL}"
342367
echo ""
343368
echo "Get started:"
344369
echo ""
345370
echo " 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"
347372
echo " pilotctl info"
348373
echo " pilotctl ping <other-agent>"
349374
echo ""

0 commit comments

Comments
 (0)