awg-ctrl: update, reinstall and uninstall from the menu
The awg-ctrl menu only started, stopped and changed the panel login; updating or removing an installation meant finding and running install.sh by hand. The menu gets "Обновить", "Переустановить" and "Удалить" (7–9), and the same as `awg-ctrl update | reinstall | uninstall`. The work stays in install.sh, which now takes ACTION=update|reinstall|uninstall to skip its own menu. The CLI fetches it — the latest from INSTALLER_URL (GitHub by default) for update and reinstall, the copy shipped in the release archive for uninstall, so removal works offline — writes it to a temp file and execs bash on it in the same terminal. It must not run from /opt/awg-control or via `bash -c`: kill_related kills every process whose command line holds the install path, and would kill the installer itself. The CLI passes its original environment, not the one with cli.env loaded, or the installer would take UI_PORT, SERVER_NAME and the rest as explicit overrides. The installer deletes its temp copy on start. The release archive now includes install.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013bNGYiDst62wH3ZGTRPFLJ
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
# package.sh <версия> — архивы релиза: по одному на архитектуру, awgcontrol-<версия>-linux-<arch>.tar.gz.
|
||||
# Внутри: awg-control (статический Go-бинарник: сервисы и CLI), awg-ui/dist (фронтенд), .env.
|
||||
# Внутри: awg-control (статический Go-бинарник: сервисы и CLI), awg-ui/dist (фронтенд), .env и
|
||||
# install.sh (им `awg-ctrl uninstall` удаляет установку без сети).
|
||||
# Фронтенд должен быть собран заранее (npm run build в awg-ui). Общий для GitHub и Gitea.
|
||||
set -eu
|
||||
VERSION="$1"
|
||||
@@ -11,7 +12,7 @@ for ARCH in amd64 arm64; do
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH="$ARCH" go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \
|
||||
-o "$D/awg-control" ./cmd/awg-control
|
||||
cp -r awg-ui/dist "$D/awg-ui/dist"
|
||||
cp .env "$D/"
|
||||
cp .env install.sh "$D/"
|
||||
tar -czf "awgcontrol-${VERSION}-linux-${ARCH}.tar.gz" "$D/"
|
||||
rm -rf "$D"
|
||||
echo "awgcontrol-${VERSION}-linux-${ARCH}.tar.gz"
|
||||
|
||||
Reference in New Issue
Block a user