barnowl/zcrypt.pl: BarnOwl::quote the editwin prompt.
[snippets/.git] / apt-zephyr / apt-zephyr
index 72c217ec77f3effdae76f07cb97eb905c44e37bc..fdf13182a2abd4883c6c1d1d43960363053c565a 100755 (executable)
@@ -84,17 +84,36 @@ parse_v2 ()
     done
 }
 
-read -r line
-case "$line" in
-    'VERSION 2')
-       parse_v2
-       ;;
-    'VERSION *')
-       echo "$0: unrecognized version: $line"
-       ;;
-    '')
-       ;;
-    *)
-       (echo "$line"; cat) | parse_v1
-       ;;
-esac | send_zephyr
+pre_install_pkgs ()
+{
+    read -r line
+    case "$line" in
+       'VERSION 2')
+           parse_v2 | send_zephyr
+           ;;
+       'VERSION *')
+           echo "$0: unrecognized version: $line" | send-zephyr
+           ;;
+       '')
+           ;;
+       *)
+           (echo "$line"; cat) | parse_v1 | send_zephyr
+           ;;
+    esac
+}
+
+post_invoke ()
+{
+    echo 'Done.' | send_zephyr
+}
+
+if [ "$1" = "--pre-install-pkgs" ]; then
+    pre_install_pkgs
+elif [ "$1" = "--post-invoke" ]; then
+    post_invoke
+else
+    echo "usage: $0 {--pre-install-pkgs | --post-invoke}" >&2
+    echo "(Hint: you probably need to update /etc/apt/apt.conf.d/90zephyr.)" >&2
+fi
+
+exit 0