From 0c5f94a35c25e95e2a3785deb80e14146b88b784 Mon Sep 17 00:00:00 2001 From: stqfdyr <89149493+stqfdyr@users.noreply.github.com> Date: Sat, 19 Sep 2026 22:04:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(install):=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=8F=96=E5=AF=86=E7=A0=81=E6=97=B6=E5=9B=9E=E9=80=80=E8=AF=BB?= =?UTF-8?q?=20journal=20=E7=9A=84=E8=BF=87=E6=B8=A1=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v1.2.0 发布后,安装器下载的二进制都支持 --reset-password,回退分支不会再走到。首次安装调用 --reset-password 不再静音:失败时 hub 自己的报错会显示出来。 --- install-hub.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/install-hub.sh b/install-hub.sh index 72a410a3..95fd6b53 100755 --- a/install-hub.sh +++ b/install-hub.sh @@ -246,8 +246,7 @@ UNIT pw="" if [ -n "$first" ]; then install -m 0600 -o "$USER_NAME" /dev/null "$DATA/monitor.db" - # Quiet: a release predating the flag is handled after the start below. - pw="$(new_password 2>/dev/null)" + pw="$(new_password)" fi systemctl daemon-reload @@ -256,7 +255,6 @@ UNIT # precisely the case the rollback below exists for. Unguarded, the script # would exit here with a raw systemd error and leave the hub down on the # binary that just failed. - started="$(date '+%Y-%m-%d %H:%M:%S')" systemctl restart "$SERVICE" || true # is-active answers before a unit that exits immediately has done so. Wait, # then query. @@ -283,13 +281,6 @@ UNIT fi rm -f "$BIN.old" ok "服务" "已启动并开机自启" - # A release predating --reset-password refuses it, and its first start sets - # the password and prints it to the journal instead. Only this start's lines: - # an earlier failed attempt printed a password for a database since removed. - if [ -n "$first" ] && [ -z "$pw" ]; then - pw="$(journalctl -u "$SERVICE" --since "$started" --no-pager 2>/dev/null | - sed -n 's/.*Emergency password: //p' | tail -1)" - fi if [ -n "$first" ]; then done_title="安装完成"; else done_title="升级完成"; fi printf '\n %s%s%s\n' "$B" "$done_title" "$N"