Code

- Added triggers
[gosa.git] / gosa-core / debian / gosa.postinst
index edf307e373202935846a278f47bff367477f5861..8aa3db73fb2be2ce4716e1d26f01a754a77a6501 100644 (file)
@@ -14,6 +14,7 @@ case "$1" in
 
   triggered)
       /usr/sbin/update-gosa
+      exit 0
       ;;
 
   *)
@@ -105,6 +106,30 @@ chmod 770 -R /var/spool/gosa
 chown root.$WEBGROUP -R /var/cache/gosa
 chmod 770 -R /var/cache/gosa
 
-update-gosa
+# Activating triggers
+echo DEBUG: triggertest postinst called, $# args: "$@"
+
+if [ "$1" = "configure" ]; then
+  # in the general case, update-foo and update-bar should always be called
+  # when the central package is updated
+  update-gosa
+
+elif [ "$1" = "triggered" ]; then
+  # since the example ships two triggers, we should determine how to act
+  # based on which trigger was activated.
+  for triggername in $2; do
+    echo DEBUG: processing trigger "'$triggername'"
+    case "$triggername" in
+    "/usr/share/gosa")
+      update-gosa
+      ;;
+    *)
+      echo "unhandled/unknown trigger!"
+      exit 1
+      ;;
+    esac
+  done
+fi
+
 
 exit 0