@@ -1853,9 +1853,9 @@ def sh(cmd, t=30):
18531853 script = (
18541854 'export DEBIAN_FRONTEND=noninteractive && '
18551855 'systemctl stop mariadb 2>/dev/null && '
1856- f'curl -fsSL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version={ ver } && '
1857- 'apt-get update -qq && '
1858- 'apt-get install -y mariadb-server && '
1856+ f'curl -fsSL --max-time 30 https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version={ ver } && '
1857+ 'apt-get update -qq -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 && '
1858+ 'apt-get install -y -o Dpkg::Options::="--force-confnew" mariadb-server && '
18591859 'systemctl start mariadb'
18601860 )
18611861 ver_check_cmd = "mariadb --version 2>/dev/null | grep -oP '[0-9]+[.][0-9]+[.][0-9]+' | head -1"
@@ -1876,7 +1876,7 @@ def sh(cmd, t=30):
18761876 'curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc -o /tmp/pg.asc && '
18771877 'gpg --batch --no-tty --dearmor -o /usr/share/keyrings/postgresql.gpg /tmp/pg.asc && '
18781878 f'echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && '
1879- 'apt-get update -qq && '
1879+ 'apt-get update -qq -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 && '
18801880 f'apt-get install -y postgresql-{ ver } && '
18811881 'systemctl restart postgresql'
18821882 )
@@ -1890,7 +1890,7 @@ def sh(cmd, t=30):
18901890 f'curl -fsSL https://www.mongodb.org/static/pgp/server-{ ver } .asc -o /tmp/mongo.asc && '
18911891 f'gpg --batch --no-tty --dearmor -o /usr/share/keyrings/mongodb-server-{ ver } .gpg /tmp/mongo.asc && '
18921892 f'echo "deb [signed-by=/usr/share/keyrings/mongodb-server-{ ver } .gpg] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/{ ver } multiverse" > /etc/apt/sources.list.d/mongodb-org-{ ver } .list && '
1893- 'apt-get update -qq && '
1893+ 'apt-get update -qq -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 && '
18941894 'apt-get install -y mongodb-org && '
18951895 'systemctl start mongod'
18961896 )
@@ -1900,7 +1900,7 @@ def sh(cmd, t=30):
19001900 script = (
19011901 'export DEBIAN_FRONTEND=noninteractive && '
19021902 'add-apt-repository -y ppa:ondrej/apache2 2>/dev/null && '
1903- 'apt-get update -qq && '
1903+ 'apt-get update -qq -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 && '
19041904 f'apt-get install -y --allow-downgrades apache2={ ver } -* 2>/dev/null || apt-get install -y apache2 && '
19051905 'systemctl restart apache2'
19061906 )
@@ -1954,17 +1954,30 @@ def sh(cmd, t=30):
19541954 def run_switch ():
19551955 mod_name = mod ['name' ] if mod else mod_id
19561956 _job_append_line (job_id , f'[VortexPanel] Switching { mod_name } to version { ver } ...' )
1957+ env = os .environ .copy ()
1958+ env ['DEBIAN_FRONTEND' ] = 'noninteractive'
1959+ # Prevent apt-get from hanging indefinitely on slow/unreachable mirrors
1960+ env ['APT_LISTCHANGES_FRONTEND' ] = 'none'
19571961 proc = subprocess .Popen (
1958- f'DEBIAN_FRONTEND=noninteractive { script } 2>&1' ,
1959- shell = True , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , text = True , bufsize = 1
1962+ script ,
1963+ shell = True , stdout = subprocess .PIPE , stderr = subprocess .STDOUT ,
1964+ text = True , bufsize = 1 , env = env
19601965 )
1966+ # Max 8 minutes — kills hanging apt-get update etc.
1967+ MAX_SECONDS = 480
1968+ import time as _time
1969+ start = _time .time ()
19611970 for line in proc .stdout :
19621971 _job_append_line (job_id , line .rstrip ())
1972+ if _time .time () - start > MAX_SECONDS :
1973+ proc .kill ()
1974+ _job_append_line (job_id , '[VortexPanel] ⚠ Timed out after 8 minutes. Operation killed.' )
1975+ break
19631976 proc .wait ()
19641977 success = proc .returncode == 0
19651978 new_ver = sh (ver_check_cmd ) if ver_check_cmd else ver
19661979 _job_append_line (job_id ,
1967- f'[VortexPanel] { "✓ Switched to " + new_ver + " successfully!" if success else "⚠ Switch may have failed — check output above." } '
1980+ f'[VortexPanel] { "✓ Switched to " + new_ver + " successfully!" if success else "⚠ Switch failed — check output above." } '
19681981 )
19691982 _job_finish (job_id , success = success , installed = True , inst_ver = new_ver )
19701983 panel_cache .invalidate ('modules_list' )
0 commit comments