qubes-core-agent-passwordless-root.postrm 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. # postrm script for core-agent-linux
  3. #
  4. # see: dh_installdeb(1)
  5. set -e
  6. # The prerm script may be called in the following ways:
  7. # * <postrm> 'remove'
  8. # * <postrm> 'purge'
  9. # * <old-postrm> 'upgrade' <new-version>
  10. # * <disappearer's-postrm> 'disappear' <overwriter> <overwriter-version>
  11. #
  12. # The postrm script is called after the package's files have been removed
  13. # or replaced. The package whose postrm is being called may have previously been
  14. # deconfigured and only be "Unpacked", at which point subsequent package changes
  15. # do not consider its dependencies. Therefore, all postrm actions may only rely
  16. # on essential packages and must gracefully skip any actions that require the
  17. # package's dependencies if those dependencies are unavailable.[48]
  18. #
  19. # * <new-postrm> 'failed-upgrade' <old-version>
  20. #
  21. # Called when the old postrm upgrade action fails. The new package will be
  22. # unpacked, but only essential packages and pre-dependencies can be relied on.
  23. # Pre-dependencies will either be configured or will be "Unpacked" or
  24. # "Half-Configured" but previously had been configured and was never removed.
  25. #
  26. # * <new-postrm> 'abort-install'
  27. # * <new-postrm> 'abort-install' <old-version>
  28. # * <new-postrm> 'abort-upgrade' <old-version>
  29. #
  30. # Called before unpacking the new package as part of the error handling of
  31. # preinst failures. May assume the same state as preinst can assume.
  32. #
  33. # For details, see http://www.debian.org/doc/debian-policy/ or
  34. # https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html or
  35. # the debian-policy package
  36. if [ "${1}" = "remove" ] ; then
  37. gpasswd -d user sudo
  38. if [ "$(passwd -S root|cut -f 2 -d ' ')" = "NP" ]; then
  39. passwd -l root
  40. fi
  41. fi
  42. # dh_installdeb will replace this with shell code automatically
  43. # generated by other debhelper scripts.
  44. #DEBHELPER#
  45. exit 0
  46. # vim: set ts=4 sw=4 sts=4 et :