55# Exit on errors
66set -e
77
8- # Define color codes for output
9- GREEN=' \033[0;32m'
10- RED=' \033[0;31m'
11- YELLOW=' \033[0;33m'
12- NC=' \033[0m' # No Color
13-
148echo " Performing comprehensive installation verification..."
159
1610# Define critical files to check (POSIX-compliant, no arrays)
@@ -40,35 +34,35 @@ TOTAL_ERRORS=0
4034# Function to check if file exists and is executable
4135check_executable () {
4236 if [ -x " $1 " ]; then
43- printf ' %s✓%s Executable file %s exists and is executable\n' " $GREEN " " $NC " " $1 "
37+ printf ' ✓ Executable file %s exists and is executable\n' " $1 "
4438 return 0
4539 elif [ -f " $1 " ]; then
46- printf ' %s⚠%s File %s exists but is not executable\n' " $YELLOW " " $NC " " $1 "
40+ printf ' ⚠ File %s exists but is not executable\n' " $1 "
4741 return 1
4842 else
49- printf ' %s✗%s Executable file %s is missing\n' " $RED " " $NC " " $1 "
43+ printf ' ✗ Executable file %s is missing\n' " $1 "
5044 return 2
5145 fi
5246}
5347
5448# Function to check if directory exists
5549check_dir () {
5650 if [ -d " $1 " ]; then
57- printf ' %s✓%s Directory %s exists\n' " $GREEN " " $NC " " $1 "
51+ printf ' ✓ Directory %s exists\n' " $1 "
5852 return 0
5953 else
60- printf ' %s✗%s Directory %s is missing\n' " $RED " " $NC " " $1 "
54+ printf ' ✗ Directory %s is missing\n' " $1 "
6155 return 1
6256 fi
6357}
6458
6559# Function to check symlinks
6660check_symlink () {
6761 if [ -L " $1 " ]; then
68- printf ' %s✓%s Symlink %s exists -> %s\n' " $GREEN " " $NC " " $1 " " $( readlink " $1 " ) "
62+ printf ' ✓ Symlink %s exists -> %s\n' " $1 " " $( readlink " $1 " ) "
6963 return 0
7064 else
71- printf ' %s✗%s Symlink %s is missing\n' " $RED " " $NC " " $1 "
65+ printf ' ✗ Symlink %s is missing\n' " $1 "
7266 return 1
7367 fi
7468}
@@ -108,9 +102,9 @@ ENV_FILE="/boot/config/plugins/dynamix.my.servers/env"
108102echo " Checking configuration files..."
109103CONFIG_ERRORS=0
110104if [ -f " $ENV_FILE " ]; then
111- printf ' %s✓%s Environment file %s exists\n' " $GREEN " " $NC " " $ENV_FILE "
105+ printf ' ✓ Environment file %s exists\n' " $ENV_FILE "
112106else
113- printf ' %s✗%s Environment file %s is missing\n' " $RED " " $NC " " $ENV_FILE "
107+ printf ' ✗ Environment file %s is missing\n' " $ENV_FILE "
114108 CONFIG_ERRORS=$(( CONFIG_ERRORS + 1 ))
115109fi
116110TOTAL_ERRORS=$(( TOTAL_ERRORS + CONFIG_ERRORS))
@@ -123,46 +117,46 @@ SHUTDOWN_ERRORS=0
123117echo " Checking for shutdown scripts in rc6.d..."
124118if [ -f " /etc/rc.d/rc.flash_backup" ]; then
125119 if [ -x " /etc/rc.d/rc6.d/K10flash-backup" ]; then
126- printf ' %s✓%s Shutdown script for flash_backup exists and is executable\n' " $GREEN " " $NC "
120+ printf ' ✓ Shutdown script for flash_backup exists and is executable\n'
127121 else
128- printf ' %s✗%s Shutdown script for flash_backup missing or not executable\n' " $RED " " $NC "
122+ printf ' ✗ Shutdown script for flash_backup missing or not executable\n'
129123 SHUTDOWN_ERRORS=$(( SHUTDOWN_ERRORS + 1 ))
130124 fi
131125fi
132126
133127# Check for unraid-api shutdown script
134128if [ -x " /etc/rc.d/rc6.d/K20unraid-api" ]; then
135- printf ' %s✓%s Shutdown script for unraid-api exists and is executable\n' " $GREEN " " $NC "
129+ printf ' ✓ Shutdown script for unraid-api exists and is executable\n'
136130else
137- printf ' %s✗%s Shutdown script for unraid-api missing or not executable\n' " $RED " " $NC "
131+ printf ' ✗ Shutdown script for unraid-api missing or not executable\n'
138132 SHUTDOWN_ERRORS=$(( SHUTDOWN_ERRORS + 1 ))
139133fi
140134
141135# Check for rc0.d symlink or directory
142136if [ -L " /etc/rc.d/rc0.d" ]; then
143- printf ' %s✓%s rc0.d symlink exists\n' " $GREEN " " $NC "
137+ printf ' ✓ rc0.d symlink exists\n'
144138elif [ -d " /etc/rc.d/rc0.d" ]; then
145- printf ' %s✓%s rc0.d directory exists\n' " $GREEN " " $NC "
139+ printf ' ✓ rc0.d directory exists\n'
146140else
147- printf ' %s✗%s rc0.d symlink or directory missing\n' " $RED " " $NC "
141+ printf ' ✗ rc0.d symlink or directory missing\n'
148142 SHUTDOWN_ERRORS=$(( SHUTDOWN_ERRORS + 1 ))
149143fi
150144
151145TOTAL_ERRORS=$(( TOTAL_ERRORS + SHUTDOWN_ERRORS))
152146
153147# Check if unraid-api is in path
154148if command -v unraid-api > /dev/null 2>&1 ; then
155- printf ' %s✓%s unraid-api is in PATH\n' " $GREEN " " $NC "
149+ printf ' ✓ unraid-api is in PATH\n'
156150else
157- printf ' %s⚠%s unraid-api is not in PATH\n' " $YELLOW " " $NC "
151+ printf ' ⚠ unraid-api is not in PATH\n'
158152 TOTAL_ERRORS=$(( TOTAL_ERRORS + 1 ))
159153fi
160154
161155# Log file check
162156if [ -f " /var/log/unraid-api/dynamix-unraid-install.log" ]; then
163- printf ' %s✓%s Installation log file exists\n' " $GREEN " " $NC "
157+ printf ' ✓ Installation log file exists\n'
164158else
165- printf ' %s⚠%s Installation log file not found\n' " $YELLOW " " $NC "
159+ printf ' ⚠ Installation log file not found\n'
166160fi
167161
168162# Summary
@@ -176,11 +170,11 @@ echo "- Shutdown configuration errors: $SHUTDOWN_ERRORS"
176170echo " - Total errors: $TOTAL_ERRORS "
177171
178172if [ $TOTAL_ERRORS -eq 0 ]; then
179- printf ' %sAll checks passed successfully.%s \n' " $GREEN " " $NC "
173+ printf ' All checks passed successfully.\n'
180174 echo " Installation verification completed successfully."
181175 exit 0
182176else
183- printf ' %sFound %d total errors.%s \n' " $RED " " $ TOTAL_ERRORS" " $NC "
177+ printf ' Found %d total errors.\n' " $TOTAL_ERRORS "
184178 echo " Installation verification completed with issues."
185179 echo " See log file for details: /var/log/unraid-api/dynamix-unraid-install.log"
186180 # We don't exit with error as this is just a verification script
0 commit comments