Prioritize /opt/pangolin as default directory across backup, inspection, and remote testing
This commit is contained in:
1 parent
2527045bc6
commit
a4eb7a2fa9
2 files changed
+12
-4
No files matched your search
+1
-1
@@ -97,7 +97,7 @@ if [ ! -d "$P_DIR" ] || [ -z "$(ls -A "$P_DIR" 2>/dev/null)" ]; then
|
||||
echo "Searching VPS for Pangolin Docker compose stack..."
|
||||
DETECTED=$(docker inspect --format '{{{{index .Config.Labels "com.docker.compose.project.working_dir"}}}}' $(docker ps -aq --filter "name=pangolin" 2>/dev/null) 2>/dev/null | head -n 1)
|
||||
if [ -z "$DETECTED" ] || [ ! -d "$DETECTED" ]; then
|
||||
for candidate in "$HOME/config" "/root/config" "$HOME" "/root" "$HOME/pangolin" "/root/pangolin" "/opt/pangolin"; do
|
||||
for candidate in "/opt/pangolin" "$HOME/pangolin" "/root/pangolin" "$HOME/config" "/root/config" "$HOME" "/root"; do
|
||||
if [ -d "$candidate" ] && [ -n "$(ls -A "$candidate" 2>/dev/null)" ]; then
|
||||
DETECTED="$candidate"
|
||||
break
|
||||
|
||||
+11
-3
@@ -134,13 +134,21 @@ async def test_vps_connection(settings: Optional[Dict[str, Any]] = None) -> Dict
|
||||
docker_version = stdout_docker.strip() if docker_installed else "Not detected"
|
||||
|
||||
# 3. Check Pangolin Directory
|
||||
pangolin_dir = settings.get("vps_pangolin_dir", "/opt/pangolin")
|
||||
chk_dir_cmd = f'[ -d "{pangolin_dir}" ] && echo "DIR_EXISTS" || echo "DIR_MISSING"'
|
||||
pangolin_dir = settings.get("vps_pangolin_dir", "/opt/pangolin").strip() or "/opt/pangolin"
|
||||
chk_dir_cmd = f"""
|
||||
eval P_DIR="{pangolin_dir}"
|
||||
P_DIR="${{P_DIR/#~/$HOME}}"
|
||||
[ -d "$P_DIR" ] && echo "DIR_EXISTS" || echo "DIR_MISSING"
|
||||
"""
|
||||
_, stdout_dir, _ = await run_remote_quick(chk_dir_cmd, settings)
|
||||
pangolin_dir_found = "DIR_EXISTS" in stdout_dir
|
||||
|
||||
# 4. Check SQLite database status in Pangolin directory
|
||||
chk_db_cmd = f'find "{pangolin_dir}" -name "*.db" -o -name "*.sqlite" 2>/dev/null'
|
||||
chk_db_cmd = f"""
|
||||
eval P_DIR="{pangolin_dir}"
|
||||
P_DIR="${{P_DIR/#~/$HOME}}"
|
||||
find "$P_DIR" -name "*.db" -o -name "*.sqlite" 2>/dev/null
|
||||
"""
|
||||
_, stdout_db, _ = await run_remote_quick(chk_db_cmd, settings)
|
||||
dbs_found = [p.strip() for p in stdout_db.strip().split("\n") if p.strip()]
|
||||
|
||||
|
||||
Reference in new issue
Block a user