]> gitweb.fluxo.info Git - hydra.git/commitdiff
More upgrade procedures at system-upgrade
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 25 Aug 2015 01:04:24 +0000 (22:04 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 25 Aug 2015 01:04:24 +0000 (22:04 -0300)
share/hydractl/system-upgrade

index da427709321c2cf9030dd4cb9834e2b049c41f7d..358920bd0ea53eeb113f765f0caf50cd6a266350 100755 (executable)
@@ -115,6 +115,51 @@ function hydra_system_upgrade_download {
   hydra_system_upgrade_stage upgrade
 }
 
+# Proceed with the actual upgrade
+function hydra_system_upgrade_upgrade {
+  echo ""
+  echo "Upgrading the system..."
+  DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade
+
+  if [ "$?" != "0" ]; then
+    echo "Upgrade failed. Please fix it manually and run this command again."
+    exit 1
+  fi
+
+  hydra_system_upgrade_stage cleanup
+}
+
+# Cleanup procedures
+function hydra_system_upgrade_cleanup {
+  apt-get autoremove -y
+  apt-get clean
+  hydra_system_upgrade_stage custom
+}
+
+# Custom upgrade procedures
+function hydra_system_upgrade_custom {
+  if [ "$nextrelease" == "wheezy" ]; then
+    # Old suhosin config
+    rm -f /etc/php5/conf.d/suhosin.ini
+
+    # This has to be manually installed again
+    if [ -f "/etc/php5/cli/conf.d/uploadprogress.ini" ]; then
+      pecl uninstall uploadprogress
+      pecl install   uploadprogress
+    fi
+  fi
+
+  hydractl trac-upgrade
+  hydra_system_upgrade_stage puppet
+}
+
+# Enable puppet again
+function hydra_system_upgrade_custom {
+  echo ""
+  echo "Starting puppet again..."
+  hydractl puppet-enable
+}
+
 # Initialize
 if [ ! -e "$STATE" ]; then
   hydra_system_upgrade_env
@@ -141,47 +186,22 @@ fi
 
 # Upgrade the system
 if [ "$STAGE" == "upgrade" ]; then
-  echo ""
-  echo "Upgrading the system..."
-  DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade
-
-  if [ "$?" != "0" ]; then
-    echo "Upgrade failed. Please fix it manually and run this command again."
-    exit 1
-  fi
-
-  hydra_system_upgrade_stage cleanup
+  hydra_system_upgrade_upgrade
 fi
 
 # Cleanup
 if [ "$STAGE" == "cleanup" ]; then
-  apt-get autoremove -y
-  apt-get clean
-  hydra_system_upgrade_stage custom
+  hydra_system_upgrade_cleanup
 fi
 
 # Custom procedures
 if [ "$STAGE" == "custom" ]; then
-  if [ "$nextrelease" == "wheezy" ]; then
-    # Old suhosin config
-    rm -f /etc/php5/conf.d/suhosin.ini
-
-    # This has to be manually installed again
-    if [ -f "/etc/php5/cli/conf.d/uploadprogress.ini" ]; then
-      pecl uninstall uploadprogress
-      pecl install   uploadprogress
-    fi
-  fi
-
-  hydractl trac-upgrade
-  hydra_system_upgrade_stage puppet
+  hydra_system_upgrade_custom
 fi
 
 # Enable puppet again
 if [ "$STAGE" == "puppet" ]; then
-  echo ""
-  echo "Starting puppet again..."
-  hydractl puppet-enable
+  hydra_system_upgrade_puppet
 fi
 
 # Teardown