add migration verifications
This commit is contained in:
parent
b17ae68672
commit
3a6febe098
21
migrate.sh
Normal file → Executable file
21
migrate.sh
Normal file → Executable file
|
@ -15,6 +15,25 @@ backup() {
|
|||
cp "$file" "$file".apreq.bak
|
||||
}
|
||||
|
||||
verify_migration() {
|
||||
if apache2ctl -t; then
|
||||
echo "the migration produced valid config"
|
||||
else
|
||||
echo "the migration went wrong, try doing it manually"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
try_disabling_access_compat() {
|
||||
if a2dismod access_compat && apache2ctl -t; then
|
||||
echo "access_compat disabled succesfully!"
|
||||
else
|
||||
echo "access_compat can't be disabled, \
|
||||
some config is still using it"
|
||||
a2enmod access_compat
|
||||
fi
|
||||
}
|
||||
|
||||
awk '{ print $1 }' "$inventory" > "$to_convert"
|
||||
|
||||
while IFS= read -r file; do
|
||||
|
@ -22,3 +41,5 @@ while IFS= read -r file; do
|
|||
backup "$file"
|
||||
perl -i ~bwaegeneire/convert.pl "$file"
|
||||
done < "$to_convert"
|
||||
|
||||
verify_migration && try_disabling_access_compat
|
||||
|
|
Loading…
Reference in a new issue