Skip to content

Commit cdc1ca7

Browse files
authored
Updates
1 parent 36eccd1 commit cdc1ca7

121 files changed

Lines changed: 288 additions & 837 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/enginescript-build-test.yml

Lines changed: 134 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,74 @@ jobs:
242242
# Set CI environment variables
243243
export CI_ENVIRONMENT=true
244244
export DEBIAN_FRONTEND=noninteractive
245+
export NEEDRESTART_MODE=a
246+
export NEEDRESTART_SUSPEND=1
247+
248+
# Debug: Check script exists and is executable
249+
echo "🔍 Checking remove-preinstalled.sh..."
250+
if [ -f "./removes/remove-preinstalled.sh" ]; then
251+
echo "✅ remove-preinstalled.sh exists"
252+
ls -la ./removes/remove-preinstalled.sh
253+
else
254+
echo "❌ remove-preinstalled.sh missing"
255+
ls -la ./removes/
256+
exit 1
257+
fi
258+
259+
# Debug: Check environment and fix EUID issue
260+
echo "🔍 Environment check:"
261+
echo "Current user: $(whoami)"
262+
echo "EUID: $EUID"
263+
echo "PWD: $PWD"
264+
echo "CI_ENVIRONMENT: $CI_ENVIRONMENT"
265+
echo "DEBIAN_FRONTEND: $DEBIAN_FRONTEND"
266+
267+
# Debug: Check required files exist
268+
echo "🔍 Checking required files..."
269+
if [ -f "/usr/local/bin/enginescript/enginescript-variables.txt" ]; then
270+
echo "✅ enginescript-variables.txt exists"
271+
else
272+
echo "❌ enginescript-variables.txt missing"
273+
fi
245274
246-
sudo bash -c "cd /usr/local/bin/enginescript/scripts/install && timeout 300 ./removes/remove-preinstalled.sh" 2>&1 | sudo tee /tmp/ci-logs/removes.log || {
247-
echo "⚠️ Remove preinstalled software had issues, continuing..."
275+
if [ -f "/home/EngineScript/enginescript-install-options.txt" ]; then
276+
echo "✅ enginescript-install-options.txt exists"
277+
else
278+
echo "❌ enginescript-install-options.txt missing"
279+
fi
280+
281+
# Run with enhanced debugging and CI-specific fixes
282+
echo "🚀 Starting preinstalled software removal with debug output..."
283+
sudo bash -c "
284+
set -x
285+
cd /usr/local/bin/enginescript/scripts/install
286+
export CI_ENVIRONMENT=true
287+
export DEBIAN_FRONTEND=noninteractive
288+
export NEEDRESTART_MODE=a
289+
export NEEDRESTART_SUSPEND=1
290+
export APT_LISTCHANGES_FRONTEND=none
291+
292+
# Force EUID to 0 for CI environment
293+
export EUID=0
294+
295+
# Ensure package manager is ready
296+
echo 'Preparing package manager...'
297+
apt-get update -qq
298+
299+
# Kill any hanging package managers
300+
killall -9 apt apt-get dpkg 2>/dev/null || true
301+
302+
# Remove package manager locks
303+
rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock
304+
305+
echo 'Starting remove-preinstalled.sh...'
306+
timeout 300 ./removes/remove-preinstalled.sh
307+
" 2>&1 | sudo tee /tmp/ci-logs/removes.log || {
308+
echo "❌ Remove preinstalled software failed or timed out"
309+
echo "📋 Last 30 lines of output:"
248310
tail -30 /tmp/ci-logs/removes.log
311+
echo "📋 Full log file size: $(wc -l < /tmp/ci-logs/removes.log 2>/dev/null || echo 0) lines"
312+
exit 1
249313
}
250314
sudo sync
251315
echo "✅ Preinstalled software removal completed"
@@ -285,16 +349,80 @@ jobs:
285349
286350
- name: Install Dependencies
287351
run: |
288-
echo " Installing dependencies..."
352+
echo "📦 Installing dependencies..."
289353
cd /usr/local/bin/enginescript/scripts/install
290354
291-
# Set CI environment variables
355+
# Set CI environment variables with maximum verbosity
292356
export CI_ENVIRONMENT=true
293357
export DEBIAN_FRONTEND=noninteractive
358+
export NEEDRESTART_MODE=a
359+
export NEEDRESTART_SUSPEND=1
360+
361+
# Debug: Check script exists and is executable
362+
echo "🔍 Checking depends-install.sh..."
363+
if [ -f "./depends/depends-install.sh" ]; then
364+
echo "✅ depends-install.sh exists"
365+
ls -la ./depends/depends-install.sh
366+
else
367+
echo "❌ depends-install.sh missing"
368+
ls -la ./depends/
369+
exit 1
370+
fi
371+
372+
# Debug: Check environment and fix EUID issue
373+
echo "🔍 Environment check:"
374+
echo "Current user: $(whoami)"
375+
echo "EUID: $EUID"
376+
echo "PWD: $PWD"
377+
echo "CI_ENVIRONMENT: $CI_ENVIRONMENT"
378+
echo "DEBIAN_FRONTEND: $DEBIAN_FRONTEND"
379+
380+
# Debug: Check required files exist
381+
echo "🔍 Checking required files..."
382+
if [ -f "/usr/local/bin/enginescript/enginescript-variables.txt" ]; then
383+
echo "✅ enginescript-variables.txt exists"
384+
else
385+
echo "❌ enginescript-variables.txt missing"
386+
ls -la /usr/local/bin/enginescript/ | head -10
387+
fi
294388
295-
sudo bash -c "cd /usr/local/bin/enginescript/scripts/install && timeout 900 ./depends/depends-install.sh" 2>&1 | sudo tee /tmp/ci-logs/depends.log || {
296-
echo "⚠️ Dependencies installation had issues, continuing..."
389+
if [ -f "/home/EngineScript/enginescript-install-options.txt" ]; then
390+
echo "✅ enginescript-install-options.txt exists"
391+
else
392+
echo "❌ enginescript-install-options.txt missing"
393+
ls -la /home/EngineScript/
394+
fi
395+
396+
# Run with enhanced debugging and CI-specific fixes
397+
echo "🚀 Starting dependencies installation with debug output..."
398+
sudo bash -c "
399+
set -x
400+
cd /usr/local/bin/enginescript/scripts/install
401+
export CI_ENVIRONMENT=true
402+
export DEBIAN_FRONTEND=noninteractive
403+
export NEEDRESTART_MODE=a
404+
export NEEDRESTART_SUSPEND=1
405+
export APT_LISTCHANGES_FRONTEND=none
406+
407+
# Force EUID to 0 for CI environment
408+
export EUID=0
409+
410+
# Ensure package manager is ready
411+
apt-get update -qq
412+
413+
# Kill any hanging package managers
414+
killall -9 apt apt-get dpkg 2>/dev/null || true
415+
416+
# Remove package manager locks
417+
rm -f /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock
418+
419+
timeout 300 ./depends/depends-install.sh
420+
" 2>&1 | sudo tee /tmp/ci-logs/depends.log || {
421+
echo "❌ Dependencies installation failed or timed out"
422+
echo "📋 Last 50 lines of output:"
297423
tail -50 /tmp/ci-logs/depends.log
424+
echo "📋 Full log file size: $(wc -l < /tmp/ci-logs/depends.log 2>/dev/null || echo 0) lines"
425+
exit 1
298426
}
299427
sudo sync
300428
echo "✅ Dependencies installation completed"

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to EngineScript will be documented in this file.
44

55
Changes are organized by date, with the most recent changes listed first.
66

7+
## 2025-06-28
8+
9+
### Changed
10+
- **Removed EUID/root user checks from all scripts except `setup.sh` and `enginescript-install.sh`**
11+
- Eliminated EUID checks from 100+ shell scripts across all directories
12+
- Maintained root checks only in the main entry point scripts (`setup.sh` and `scripts/install/enginescript-install.sh`)
13+
- Prevents CI workflow hangs caused by EUID checks in non-interactive environments
14+
- Improves script portability and execution in containerized/automated environments
15+
- Scripts affected include all alias, auto-upgrade, cron, security, vhost, install, update, and menu scripts
16+
- CI workflows can now execute all scripts without manual EUID override requirements
17+
718
## 2025-06-27
819

920
### Added
@@ -212,3 +223,27 @@ Each entry is dated to show when changes were implemented. For questions about a
212223
- Focus on Nginx compilation ensures the most complex build process is thoroughly tested
213224
- Removed components (PHP, MariaDB, Redis) can still be tested manually or in separate workflows if needed
214225
- Nginx build remains the most comprehensive test of EngineScript's compilation capabilities
226+
227+
---
228+
229+
## 2025-01-29
230+
231+
### Added
232+
- **Enhanced debugging for CI script execution hangs**
233+
- **Comprehensive environment checks before script execution**
234+
- **Package manager preparation and lock removal in CI environment**
235+
- **Script existence and permission validation before execution**
236+
- **Enhanced error reporting with detailed log output for failed scripts**
237+
238+
### Fixed
239+
- **Fixed CI script hanging by adding enhanced debugging to Remove Preinstalled Software step**
240+
- **Added EUID override for CI environment to prevent root check failures**
241+
- **Implemented package manager lock removal and process cleanup**
242+
- **Enhanced script timeout handling with detailed failure reporting**
243+
244+
### Technical Details
245+
- CI now validates script existence and permissions before execution
246+
- Package manager locks and hanging processes are cleared before script execution
247+
- EUID is explicitly set to 0 in CI environment to bypass root checks
248+
- Enhanced debugging shows exact point of failure when scripts hang
249+
- Timeout failures now provide detailed log output for debugging

scripts/functions/alias/alias-backup.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/alias/alias-cache.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/alias/alias-mysql-pass.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/alias/alias-restart.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/alias/alias-server-info.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/alias/alias-virus-scan.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/auto-upgrade/emergency-auto-upgrade.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

scripts/functions/auto-upgrade/normal-auto-upgrade.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
source /usr/local/bin/enginescript/enginescript-variables.txt
1212
source /home/EngineScript/enginescript-install-options.txt
1313

14-
# Check current user's ID. If user is not 0 (root), exit.
15-
if [ "${EUID}" -ne 0 ];
16-
then
17-
echo "${BOLD}ALERT:${NORMAL}"
18-
echo "EngineScript should be executed as the root user."
19-
exit 1
20-
fi
14+
2115

2216
#----------------------------------------------------------------------------------
2317
# Start Main Script

0 commit comments

Comments
 (0)