From a8a394c8f21d6f0fc320f82014db34db95d5d56e Mon Sep 17 00:00:00 2001 From: imbytecat Date: Thu, 26 Mar 2026 13:39:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(source):=20=E7=A7=BB=E9=99=A4=20hardcoded?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E5=90=8D=20fallback=EF=BC=8C=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E8=A6=81=E6=B1=82=20sudo=20=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source.py b/source.py index 776cfcf..885a50e 100644 --- a/source.py +++ b/source.py @@ -20,8 +20,9 @@ assert decman.aur is not None assert decman.systemd is not None # ── 用户 ────────────────────────────────────────────────────── -# sudo decman 时 SUDO_USER 为调用 sudo 的原始用户 -USERNAME = os.environ.get("SUDO_USER", "imbytecat") +USERNAME = os.environ.get("SUDO_USER") +if not USERNAME: + raise decman.SourceError("请使用 sudo decman 运行") HOME = f"/home/{USERNAME}" # ── 系统文件(/etc/)──────────────────────────────────────────