fix(install): предотвращено сворачивание каталога .local

- Зачем:
  - свежая установка могла превратить ~/.local в ссылку на пакет и записать Xray в репозиторий.
- Что:
  - перед Stow теперь гарантируются настоящие ~/.local/bin и ~/.config/proxy-client без раскрытия посторонних ссылок.
  - добавлены регрессионные проверки свежего HOME и посторонней ссылки ~/.local.
  - README перестроены вокруг установки, выбора режима и ежедневного использования.
- Проверка:
  - bash tests/test_install.sh.
  - bash tests/test_proxy_launchers.sh.
  - bash -n install.sh tests/test_install.sh.
  - git diff --cached --check.
This commit is contained in:
ddadmin committed 2026-07-21 11:15:27 -04:00
1 parent bca90c1d21
commit 9c2e134fc1
5 files changed
+341 -201

No files matched your search

+27
View File
@@ -97,6 +97,10 @@ test_fresh_install_uses_home_target() {
run_install "$repo_root" "$home_dir" env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >"$fixture/install.out"
[ -L "$home_dir/.bash_custom" ] || fail "Expected .bash_custom symlink in HOME"
[ -d "$home_dir/.local" ] || fail "Expected ~/.local directory"
[ ! -L "$home_dir/.local" ] || fail "Expected ~/.local to stay a real directory"
[ -d "$home_dir/.local/bin" ] || fail "Expected ~/.local/bin directory"
[ ! -L "$home_dir/.local/bin" ] || fail "Expected ~/.local/bin to stay a real directory"
[ -x "$home_dir/.local/bin/proxy-client" ] || fail "Expected executable proxy-client CLI in HOME"
[ -d "$home_dir/.config/proxy-client" ] || fail "Expected proxy-client config directory"
[ ! -L "$home_dir/.config/proxy-client" ] || fail "Expected proxy-client config to stay outside the repository"
@@ -221,6 +225,28 @@ test_does_not_migrate_unrelated_config_symlink() {
assert_not_exists "$unrelated_config/proxy-client"
}
test_does_not_follow_unrelated_local_symlink() {
local fixture repo_root home_dir unrelated_local target expected
fixture="$(setup_fixture)"
repo_root="$fixture/repo"
home_dir="$fixture/home"
unrelated_local="$fixture/unrelated-local"
mkdir -p "$home_dir" "$unrelated_local"
printf '%s\n' 'keep me' > "$unrelated_local/local.conf"
ln -s "$unrelated_local" "$home_dir/.local"
# Установщик не должен создавать bin через произвольную ссылку ~/.local.
run_install "$repo_root" "$home_dir" \
env WSL_DISTRO_NAME= INSTALL_INTERACTIVE_MODE=never >"$fixture/install.out" 2>&1 || true
[ -L "$home_dir/.local" ] || fail "Expected unrelated ~/.local symlink to be preserved"
target="$(readlink -f "$home_dir/.local")"
expected="$(readlink -f "$unrelated_local")"
[ "$target" = "$expected" ] || fail "Unrelated ~/.local target changed"
assert_file_contains "$unrelated_local/local.conf" "keep me"
assert_not_exists "$unrelated_local/bin"
}
test_settings_local_is_symlinked_to_repo() {
local fixture repo_root home_dir
fixture="$(setup_fixture)"
@@ -505,6 +531,7 @@ main() {
test_migrates_legacy_zed_config_symlink
test_stops_legacy_migration_when_listing_fails
test_does_not_migrate_unrelated_config_symlink
test_does_not_follow_unrelated_local_symlink
test_settings_local_is_symlinked_to_repo
test_settings_local_backup_on_existing_file
test_settings_local_dir_is_skipped