Skip to content

Commit 6b23934

Browse files
committed
Revised Installation Logs
Changed the update log to a .conf file and added checks to all installation scripts that verify whether that install step has been successfully completed previously.
1 parent 5ec6393 commit 6b23934

33 files changed

Lines changed: 388 additions & 172 deletions

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ jobs:
183183
# Create EngineScript log files (already done in earlier step, but ensure completeness)
184184
echo "📊 Creating log files..." | sudo tee -a /tmp/ci-logs/setup.log
185185
sudo touch "/var/log/EngineScript/install-error-log.log"
186-
sudo touch "/var/log/EngineScript/install-log.log"
187186
sudo touch "/var/log/EngineScript/vhost-export.log"
188187
sudo touch "/var/log/EngineScript/vhost-import.log"
189188
sudo touch "/var/log/EngineScript/vhost-install.log"

scripts/functions/shared/enginescript-common.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ function set_php_permissions() {
558558
# Check if all required EngineScript installation components are completed
559559
# Returns 0 if all components are installed, exits with error if incomplete
560560
function check_installation_completion() {
561-
local install_log="/var/log/EngineScript/install-log.log"
561+
local install_log="/etc/enginescript/install-state.conf"
562562
local missing_components=()
563563
local quiet_mode="${1:-false}" # Optional parameter for quiet mode
564564

@@ -812,7 +812,7 @@ function validate_not_placeholder() {
812812

813813

814814
# ----------------------------------------------------------------
815-
# Run an idempotent install step: skip if already completed, otherwise execute and mark done
815+
# Run an idempotent install step: skip if already completed, otherwise execute
816816
# Usage: run_install_step "FLAG_NAME" "/path/to/script.sh" "Step Description"
817817
function run_install_step() {
818818
local flag_name="$1"
@@ -824,7 +824,6 @@ function run_install_step() {
824824
echo "${flag_name} script has already run."
825825
else
826826
"${script_path}" 2>> /tmp/enginescript_install_errors.log
827-
echo "${flag_name}=1" >> /var/log/EngineScript/install-log.log
828827
fi
829828
print_last_errors
830829
debug_pause "${step_desc}"
@@ -833,20 +832,16 @@ function run_install_step() {
833832

834833
# ----------------------------------------------------------------
835834
# Verify a systemd service is running after installation
836-
# Logs completion flag and exits on failure
837-
# Usage: verify_service_running "service_name" "LOG_FLAG" "Display Name"
835+
# Exits on failure
836+
# Usage: verify_service_running "service_name" "Display Name"
838837
function verify_service_running() {
839838
local service_name="$1"
840-
local log_flag="${2:-""}"
841-
local display_name="${3:-${service_name}}"
839+
local display_name="${2:-${service_name}}"
842840
local status
843841

844842
status="$(systemctl is-active "${service_name}")"
845843
if [[ "${status}" == "active" ]]; then
846844
echo "PASSED: ${display_name} is running."
847-
if [[ -n "${log_flag}" ]]; then
848-
echo "${log_flag}=1" >> /var/log/EngineScript/install-log.log
849-
fi
850845
else
851846
echo "FAILED: ${display_name} not running. Please diagnose this issue before proceeding."
852847
exit 1

scripts/install/acme/acme-install.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.
1818
#----------------------------------------------------------------------------------
1919
# Start Main Script
2020

21+
source /etc/enginescript/install-state.conf
22+
if [[ "${ACME}" = 1 ]]; then
23+
echo "ACME script has already run"
24+
exit 0
25+
fi
26+
2127
# ACME.sh Install
2228
curl https://get.acme.sh | sh
2329

@@ -30,3 +36,6 @@ export CF_Email="${CF_ACCOUNT_EMAIL}"
3036
/root/.acme.sh/acme.sh --register-account -m "${CF_ACCOUNT_EMAIL}"
3137

3238
/root/.acme.sh/acme.sh --upgrade --auto-upgrade
39+
40+
# Mark the installation as complete
41+
echo "ACME=1" >> /etc/enginescript/install-state.conf

scripts/install/block/package-block.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.
1818
#----------------------------------------------------------------------------------
1919
# Start Main Script
2020

21+
source /etc/enginescript/install-state.conf
22+
if [[ "${BLOCK}" = 1 ]]; then
23+
echo "BLOCK script has already run"
24+
exit 0
25+
fi
26+
2127
cd /etc/apt/preferences.d/
2228

2329
# Block Apache2 from APT
@@ -42,3 +48,6 @@ for ver in "${block_versions[@]}"; do
4248
sanitized="${ver//.}"
4349
echo -e "Package: php${ver}*\nPin: release *\nPin-Priority: -1" > "php${sanitized}-block"
4450
done
51+
52+
# Mark the installation as complete
53+
echo "BLOCK=1" >> /etc/enginescript/install-state.conf

scripts/install/cron/cron-install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ add_cron_job "54 5 * * * cd /usr/local/bin/enginescript/scripts/functions/cron;
7474
add_cron_job "56 5 * * * cd /usr/local/bin/enginescript/scripts/functions/cron; bash uploads-php-scan.sh >/dev/null 2>&1"
7575
add_cron_job "57 5 * * * cd /usr/local/bin/enginescript/scripts/functions/cron; bash checksums.sh >/dev/null 2>&1"
7676
}
77+
78+
# Mark the installation as complete
79+
echo "CRON=1" >> /etc/enginescript/install-state.conf

0 commit comments

Comments
 (0)