qubes-core-agent.preinst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # preinst script for core-agent-linux
  3. #
  4. # see: dh_installdeb(1)
  5. set -e
  6. # The preinst script may be called in the following ways:
  7. # * <new-preinst> 'install'
  8. # * <new-preinst> 'install' <old-version>
  9. # * <new-preinst> 'upgrade' <old-version>
  10. #
  11. # The package will not yet be unpacked, so the preinst script cannot rely
  12. # on any files included in its package. Only essential packages and
  13. # pre-dependencies (Pre-Depends) may be assumed to be available.
  14. # Pre-dependencies will have been configured at least once, but at the time the
  15. # preinst is called they may only be in an "Unpacked" or "Half-Configured" state
  16. # if a previous version of the pre-dependency was completely configured and has
  17. # not been removed since then.
  18. #
  19. #
  20. # * <old-preinst> 'abort-upgrade' <new-version>
  21. #
  22. # Called during error handling of an upgrade that failed after unpacking the
  23. # new package because the postrm upgrade action failed. The unpacked files may
  24. # be partly from the new version or partly missing, so the script cannot rely
  25. # on files included in the package. Package dependencies may not be available.
  26. # Pre-dependencies will be at least "Unpacked" following the same rules as
  27. # above, except they may be only "Half-Installed" if an upgrade of the
  28. # pre-dependency failed.[46]
  29. #
  30. # For details, see http://www.debian.org/doc/debian-policy/ or
  31. # https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html or
  32. # the debian-policy package
  33. if [ "$1" = "install" ] ; then
  34. # --------------------------------------------------------------------------
  35. # Create required directories
  36. # --------------------------------------------------------------------------
  37. mkdir -p /var/lib/qubes
  38. mkdir -p /lib/modules
  39. #mkdir -p -m 0700 /var/log/xen # xen-utils-common should do this
  40. # --------------------------------------------------------------------------
  41. # Many Qubes scripts reference /bin/sh expecting the shell to be bash but
  42. # in Debian it is dash so some scripts will fail so force an alternate for
  43. # /bin/sh to be /bin/bash
  44. # --------------------------------------------------------------------------
  45. update-alternatives --force --install /bin/sh sh /bin/bash 999
  46. # --------------------------------------------------------------------------
  47. # Modules setup
  48. # --------------------------------------------------------------------------
  49. echo "xen_netfront" >> /etc/modules
  50. # --------------------------------------------------------------------------
  51. # Remove `mesg` from root/.profile?
  52. # --------------------------------------------------------------------------
  53. sed -i -e '/^mesg n/d' /root/.profile
  54. # --------------------------------------------------------------------------
  55. # User add / modifications
  56. # --------------------------------------------------------------------------
  57. id -u 'user' || {
  58. groupadd -f user
  59. useradd -g user -G dialout,cdrom,floppy,sudo,audio,dip,video,plugdev -m -s /bin/bash user
  60. }
  61. id -u 'tinyproxy' || {
  62. groupadd -f tinyproxy
  63. useradd -g tinyproxy -r -M --home /run/tinyproxy --shell /bin/false tinyproxy
  64. }
  65. usermod -p '' root
  66. usermod -L user
  67. exit 0
  68. fi
  69. if [ "$1" = "upgrade" ] ; then
  70. exit 0
  71. fi
  72. # dh_installdeb will replace this with shell code automatically
  73. # generated by other debhelper scripts.
  74. #DEBHELPER#
  75. exit 0
  76. # vim: set ts=4 sw=4 sts=4 et :