softflowd.preinst 793 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. set -e
  3. DEFAULT_CONF='/etc/softflowd/default.conf'
  4. LEGACY_CONF='/etc/default/softflowd'
  5. case "$1" in
  6. install)
  7. ;;
  8. upgrade)
  9. if \
  10. dpkg --compare-versions "$2" lt 0.9.9-4~ &&
  11. [ -f "$LEGACY_CONF" ] &&
  12. [ ! -f "$DEFAULT_CONF" ] &&
  13. [ $(md5sum "$LEGACY_CONF" | awk '{print $1}') != '617dbe97c274b4491b22b85b28f3ccf0' ]
  14. then
  15. # create /etc/softflowd/default.conf from /etc/default/softflowd
  16. # lower-case key names
  17. mkdir -p "$(dirname "$DEFAULT_CONF")"
  18. sed -e '
  19. s/^INTERFACE=/interface=/ ;
  20. s/^OPTIONS=/options=/ ;
  21. ' <"$LEGACY_CONF" >"$DEFAULT_CONF"
  22. fi
  23. ;;
  24. abort-upgrade)
  25. ;;
  26. *)
  27. echo "preinst called with unknown argument '$1'"
  28. exit 1
  29. ;;
  30. esac
  31. #DEBHELPER#
  32. exit 0