Code

- Added triggers
[gosa.git] / gosa-core / debian / gosa.postinst
index 6286d073a1f75131f7790c1a460b55a89f423c1f..8aa3db73fb2be2ce4716e1d26f01a754a77a6501 100644 (file)
@@ -12,6 +12,11 @@ case "$1" in
   abort-upgrade|abort-remove|abort-deconfigure)
       ;;
 
+  triggered)
+      /usr/sbin/update-gosa
+      exit 0
+      ;;
+
   *)
       echo "postinst called with unknown argument \`$1'" >&2
       exit 1
@@ -101,7 +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
-