mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6152] [MERGED] fix(install): preserve custom bin/ files (e.g. hand-added geoip) across updates #6115
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6152
Author: @kuzzrus
Created: 7/29/2026
Status: ✅ Merged
Merged: 8/14/2026
Merged by: @MHSanaei
Base:
main← Head:upstream-pr/preserve-custom-bin-files📝 Commits (2)
e62e0dcfix(install): preserve custom bin/ files (e.g. hand-added geoip) across updatesdc377d0fix: harden the bin/ snapshot-and-restore against the review round on #6152📊 Changes
2 files changed (+77 additions, -0 deletions)
View changed files
📝
deploy/test/smoke-noninteractive.sh(+18 -0)📝
install.sh(+59 -0)📄 Description
Problem
Every reinstall/update (
install_x-ui) stops the panel and then wipes/usr/local/x-ui/wholesale before re-extracting the release tarball:The release tarball only ships the assets 3x-ui itself bundles (the
xray/mtgbinaries, the defaultgeoip.dat/geosite.datset). Anythingelse an admin has placed in
bin/— most commonly a hand-added customgeoip/geosite file referenced from a routing rule via
ext:<file>:<code>—has no owner other than the admin, and is silently deleted by this wipe.
Real-world impact: after an update, Xray refuses to start at all, with
every inbound down, because a routing rule now points at a file that no
longer exists (
failed to open <file>: no such file or directory). Theonly way back is restoring the missing file from a separate backup — the
installer itself gives no warning that this will happen or has happened.
Fix
install_x-uinow backs up the existingbin/directory before the wipe,and after extracting the fresh release, restores only the files the new
release doesn't already provide. Bundled assets (
geoip.dat,xray-linux-*,etc.) always end up as the fresh release's copy — nothing about the update
path for standard files changes. Anything extra that was in
bin/andisn't part of the new release (custom geoip/geosite files, or anything else
hand-placed there) survives the update untouched, and the installer prints
which file(s) it restored so the admin can see it happened.
Also cleans up the temporary backup on the existing early-exit error paths
(failed extraction, missing
x-uibinary after extraction) so a failedupdate doesn't leave a stray temp directory behind.
Testing
bash -n install.sh— syntax check passes.shellcheck install.sh— no new warnings introduced by this change(one pre-existing-style
SC2086info note, consistent with how thesurrounding function already handles
${xui_folder}elsewhere).geoip.dat, thexraybinary)end up as the fresh release's copy after an update; a custom file that
isn't part of the release survives an update untouched.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.