vboxreload 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # vboxreload: shortcut to reload virtualbox host modules
  3. #
  4. # Copyright © 2016 Sébastien Luttringer
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. (( UID > 0 )) && { echo 'You must be root' >&2; exit 1; }
  20. modules=(vboxnetadp vboxnetflt vboxpci vboxdrv)
  21. echo -n 'Unloading modules: '
  22. for _m in "${modules[@]}"; do
  23. lsmod|grep -q "$_m" && rmmod "$_m" && echo -n "$_m "
  24. done
  25. echo
  26. echo -n 'Loading modules: '
  27. for _m in "${modules[@]}"; do
  28. modprobe "$_m" && echo -n "$_m "
  29. done
  30. echo
  31. # vim:set ts=2 sw=2 ai et: