Advertisement
Guest User

Untitled

a guest
Jul 13th, 2018
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. #!/bin/sh
  2. # $Id: postinst-common.sh 118839 2017-10-28 15:14:05Z bird $
  3. ## @file
  4. # Oracle VM VirtualBox
  5. # VirtualBox Linux post-installer common portions
  6. #
  7.  
  8. #
  9. # Copyright (C) 2015-2017 Oracle Corporation
  10. #
  11. # This file is part of VirtualBox Open Source Edition (OSE), as
  12. # available from http://www.virtualbox.org. This file is free software;
  13. # you can redistribute it and/or modify it under the terms of the GNU
  14. # General Public License (GPL) as published by the Free Software
  15. # Foundation, in version 2 as it comes in the "COPYING" file of the
  16. # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  17. # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  18. #
  19.  
  20. # Put bits of the post-installation here which should work the same for all of
  21. # the Linux installers. We do not use special helpers (e.g. dh_* on Debian),
  22. # but that should not matter, as we know what those helpers actually do, and we
  23. # have to work on those systems anyway when installed using the all
  24. # distributions installer.
  25. #
  26. # We assume that all required files are in the same folder as this script
  27. # (e.g. /opt/VirtualBox, /usr/lib/VirtualBox, the build output directory).
  28.  
  29. # The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
  30. TARGET=`readlink -e -- "${0}"` || exit 1
  31. MY_PATH="${TARGET%/[!/]*}"
  32. cd "${MY_PATH}"
  33. . "./routines.sh"
  34.  
  35. START=true
  36. while test -n "${1}"; do
  37. case "${1}" in
  38. --nostart)
  39. START=
  40. ;;
  41. *)
  42. echo "Bad argument ${1}" >&2
  43. exit 1
  44. ;;
  45. esac
  46. shift
  47. done
  48.  
  49. # Remove any traces of DKMS from previous installations.
  50. for i in vboxhost vboxdrv vboxnetflt vboxnetadp; do
  51. rm -rf "/var/lib/dkms/${i}"*
  52. done
  53.  
  54. # Install runlevel scripts and systemd unit files
  55. install_init_script "${MY_PATH}/vboxdrv.sh" vboxdrv
  56. install_init_script "${MY_PATH}/vboxballoonctrl-service.sh" vboxballoonctrl-service
  57. install_init_script "${MY_PATH}/vboxautostart-service.sh" vboxautostart-service
  58. install_init_script "${MY_PATH}/vboxweb-service.sh" vboxweb-service
  59.  
  60. delrunlevel vboxdrv
  61. addrunlevel vboxdrv
  62. delrunlevel vboxballoonctrl-service
  63. addrunlevel vboxballoonctrl-service
  64. delrunlevel vboxautostart-service
  65. addrunlevel vboxautostart-service
  66. delrunlevel vboxweb-service
  67. addrunlevel vboxweb-service
  68.  
  69. ln -sf "${MY_PATH}/postinst-common.sh" /sbin/vboxconfig
  70.  
  71. # Set SELinux permissions
  72. # XXX SELinux: allow text relocation entries
  73. if [ -x /usr/bin/chcon ]; then
  74. chcon -t texrel_shlib_t "${MY_PATH}"/*VBox* > /dev/null 2>&1
  75. chcon -t texrel_shlib_t "${MY_PATH}"/VBoxAuth.so \
  76. > /dev/null 2>&1
  77. chcon -t texrel_shlib_t "${MY_PATH}"/VirtualBox.so \
  78. > /dev/null 2>&1
  79. chcon -t texrel_shlib_t "${MY_PATH}"/components/VBox*.so \
  80. > /dev/null 2>&1
  81. chcon -t java_exec_t "${MY_PATH}"/VirtualBox > /dev/null 2>&1
  82. chcon -t java_exec_t "${MY_PATH}"/VBoxSDL > /dev/null 2>&1
  83. chcon -t java_exec_t "${MY_PATH}"/VBoxHeadless \
  84. > /dev/null 2>&1
  85. chcon -t java_exec_t "${MY_PATH}"/VBoxNetDHCP \
  86. > /dev/null 2>&1
  87. chcon -t java_exec_t "${MY_PATH}"/VBoxNetNAT \
  88. > /dev/null 2>&1
  89. chcon -t java_exec_t "${MY_PATH}"/VBoxExtPackHelperApp \
  90. > /dev/null 2>&1
  91. chcon -t java_exec_t "${MY_PATH}"/vboxwebsrv > /dev/null 2>&1
  92. chcon -t bin_t "${MY_PATH}"/src/vboxhost/build_in_tmp \
  93. > /dev/null 2>&1
  94. chcon -t bin_t /usr/share/virtualbox/src/vboxhost/build_in_tmp \
  95. > /dev/null 2>&1
  96. fi
  97.  
  98. test -n "${START}" &&
  99. {
  100. if ! "${MY_PATH}/vboxdrv.sh" setup; then
  101. "${MY_PATH}/check_module_dependencies.sh" >&2
  102. echo >&2
  103. echo "There were problems setting up VirtualBox. To re-start the set-up process, run" >&2
  104. echo " /sbin/vboxconfig" >&2
  105. echo "as root." >&2
  106. else
  107. start_init_script vboxdrv
  108. start_init_script vboxballoonctrl-service
  109. start_init_script vboxautostart-service
  110. start_init_script vboxweb-service
  111. fi
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement