[IMP] avoid directory changes in migration loop
Replace cd into version directories with absolute path execution:
Before:
cd "${version}.0"
./pre_upgrade.sh
./upgrade.sh
./post_upgrade.sh
cd ..
After:
"${SCRIPT_DIR}/${version}.0/pre_upgrade.sh"
"${SCRIPT_DIR}/${version}.0/upgrade.sh"
"${SCRIPT_DIR}/${version}.0/post_upgrade.sh"
Benefits:
- No working directory state to track
- More robust: script works regardless of where it's called from
- Easier debugging: no need to remember current directory
- Avoids potential issues if a subscript changes directory
This commit is contained in:
@@ -125,13 +125,10 @@ log_step "UPGRADE PROCESS"
|
|||||||
for version in "${versions[@]}"; do
|
for version in "${versions[@]}"; do
|
||||||
log_info "START UPGRADE TO ${version}.0"
|
log_info "START UPGRADE TO ${version}.0"
|
||||||
|
|
||||||
cd "${version}.0"
|
"${SCRIPT_DIR}/${version}.0/pre_upgrade.sh"
|
||||||
|
"${SCRIPT_DIR}/${version}.0/upgrade.sh"
|
||||||
|
"${SCRIPT_DIR}/${version}.0/post_upgrade.sh"
|
||||||
|
|
||||||
./pre_upgrade.sh
|
|
||||||
./upgrade.sh
|
|
||||||
./post_upgrade.sh
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
log_info "END UPGRADE TO ${version}.0"
|
log_info "END UPGRADE TO ${version}.0"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user