mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 07:25:27 +08:00
* fix(core): replace the packaged core through one elevated run on Linux
Distribution packages install the core beside the app in a root-owned
directory such as /usr/bin, so an in-app upgrade died creating its staging
file there:
failed to create /usr/bin/.verge-mihomo.513755.1.tmp: Permission denied (os error 13)
The upgrade now re-executes the app's own binary through pkexec with
--replace-core. That run verifies the caller's digest, stages the bytes as
.verge-mihomo.next beside the target and renames them over it, so a core
that is still executing keeps its inode and an interrupted copy leaves the
live path untouched. It then hands the same file to the service installer,
which is already root and does not ask again: one prompt covers the
packaged core and, when one is installed, the Service's approved copy.
The privileged mode trusts nothing from its caller: the target must be one
of the two core names and must live in the directory the binary was started
from, and the source must match the attested sha256.
A sidecar session with a Service installed now refreshes the approved copy
too, so switching back cannot run the core this upgrade replaced. The
previous bytes are kept in user data and restored by the same elevated run,
and a refused Service copy is reported apart from an unpublished core, so
only the former is rolled back.
Fixes #8037
Fixes #8390
* docs(changelog): note Linux core upgrade fix
Assisted-by: Copilot Fusion (Standard) > GPT-6 Luna
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
---------
Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
Co-authored-by: venti1112 <3788365896@qq.com>
Co-authored-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>