日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

virtualbox和vagrant卸载脚本在macbook

發布時間:2024/4/17 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 virtualbox和vagrant卸载脚本在macbook 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

virtualbox和vagrant在macbook版本的安裝文件內,都有一個卸載腳本uninstall.tool

vagrant2.1.5卸載腳本:

#!/usr/bin/env bash#---------------------------------------------------------------------- # Functions #---------------------------------------------------------------------- # Exits the script with the given exit code after waiting # for a keypress. # # @param [Integer] $1 exit code. function key_exit() {echo "Press any key to exit."readexit $1 }# Appends a value to an array. # # @param [String] $1 Name of the variable to modify # @param [String] $2 Value to append function append() {eval $1[\${#$1[*]}]=$2 }#---------------------------------------------------------------------- # Script #---------------------------------------------------------------------- # Collect the directories and files to remove my_files=() append my_files "/opt/vagrant" append my_files "/usr/local/bin/vagrant"# Print the files and directories that are to be removed and verify # with the user that that is what he/she really wants to do. echo "The following files and directories will be removed:" for file in "${my_files[@]}"; doecho " $file" doneecho "" echo "Do you wish to uninstall Vagrant (Yes/No)?" read my_answer if [ "$my_answer" != "Yes" ]; thenecho "Aborting install. (answer: ${my_answer})"key_exit 2 fi# Initiate the actual uninstall, which requires admin privileges. echo "The uninstallation process requires administrative privileges" echo "because some of the installed files cannot be removed by a" echo "normal user. You may now be prompted for a password..." echo ""# Use AppleScript so we can use a graphical `sudo` prompt. # This way, people can enter the username they wish to use # for sudo, and it is more Apple-like. osascript -e "do shell script \"/bin/rm -Rf ${my_files[*]}\" with administrator privileges"# Verify that the uninstall succeeded by checking whether every file # we meant to remove is actually removed. for file in "${my_files[@]}"; doif [ -e "${file}" ]; thenecho "An error must have occurred since a file that was supposed to be"echo "removed still exists: ${file}"echo ""echo "Please try again."key_exit 1fi doneecho "Successfully uninstalled Vagrant." echo "Done." key_exit 0

VirtualBox5.2.18卸載腳本:

#!/bin/bash # $Id: VirtualBox_Uninstall.tool 118839 2017-10-28 15:14:05Z bird $ ## @file # VirtualBox Uninstaller Script. ## # Copyright (C) 2007-2017 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; # you can redistribute it and/or modify it under the terms of the GNU # General Public License (GPL) as published by the Free Software # Foundation, in version 2 as it comes in the "COPYING" file of the # VirtualBox OSE distribution. VirtualBox OSE is distributed in the # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ## Override any funny stuff from the user. export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"# # Display a simple welcome message first. # echo "" echo "Welcome to the VirtualBox uninstaller script." echo ""# # Check for arguments and display # my_default_prompt=0 if test "$#" != "0"; thenif test "$#" != "1" -o "$1" != "--unattended"; thenecho "Error: Unknown argument(s): $*"echo ""echo "Usage: uninstall.sh [--unattended]"echo ""echo "If the '--unattended' option is not given, you will be prompted"echo "for a Yes/No before doing the actual uninstallation."echo ""exit 4;fimy_default_prompt="Yes" fi# # Collect directories and files to remove. # Note: Do NOT attempt adding directories or filenames with spaces! # declare -a my_directories declare -a my_files# Users files first test -f "${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" && my_files+=("${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist")test -d /Library/StartupItems/VirtualBox/ && my_directories+=("/Library/StartupItems/VirtualBox/") test -d /Library/Receipts/VBoxStartupItems.pkg/ && my_directories+=("/Library/Receipts/VBoxStartupItems.pkg/")test -d "/Library/Application Support/VirtualBox/LaunchDaemons/" && my_directories+=("/Library/Application Support/VirtualBox/LaunchDaemons/") test -d "/Library/Application Support/VirtualBox/VBoxDrv.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxDrv.kext/") test -d "/Library/Application Support/VirtualBox/VBoxUSB.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxUSB.kext/") test -d "/Library/Application Support/VirtualBox/VBoxNetFlt.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetFlt.kext/") test -d "/Library/Application Support/VirtualBox/VBoxNetAdp.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetAdp.kext/") # Pre 4.3.0rc1 locations: test -d /Library/Extensions/VBoxDrv.kext/ && my_directories+=("/Library/Extensions/VBoxDrv.kext/") test -d /Library/Extensions/VBoxUSB.kext/ && my_directories+=("/Library/Extensions/VBoxUSB.kext/") test -d /Library/Extensions/VBoxNetFlt.kext/ && my_directories+=("/Library/Extensions/VBoxNetFlt.kext/") test -d /Library/Extensions/VBoxNetAdp.kext/ && my_directories+=("/Library/Extensions/VBoxNetAdp.kext/") # Tiger support is obsolete, but we leave it here for a clean removing of older # VirtualBox versions test -d /Library/Extensions/VBoxDrvTiger.kext/ && my_directories+=("/Library/Extensions/VBoxDrvTiger.kext/") test -d /Library/Extensions/VBoxUSBTiger.kext/ && my_directories+=("/Library/Extensions/VBoxUSBTiger.kext/") test -d /Library/Receipts/VBoxKEXTs.pkg/ && my_directories+=("/Library/Receipts/VBoxKEXTs.pkg/")test -f /usr/bin/VirtualBox && my_files+=("/usr/bin/VirtualBox") test -f /usr/bin/VBoxManage && my_files+=("/usr/bin/VBoxManage") test -f /usr/bin/VBoxVRDP && my_files+=("/usr/bin/VBoxVRDP") test -f /usr/bin/VBoxHeadless && my_files+=("/usr/bin/VBoxHeadless") test -f /usr/bin/vboxwebsrv && my_files+=("/usr/bin/vboxwebsrv") test -f /usr/bin/VBoxBugReport && my_files+=("/usr/bin/VBoxBugReport") test -f /usr/bin/VBoxBalloonCtrl && my_files+=("/usr/bin/VBoxBalloonCtrl") test -f /usr/bin/VBoxAutostart && my_files+=("/usr/bin/VBoxAutostart") test -f /usr/bin/VBoxDTrace && my_files+=("/usr/bin/VBoxDTrace") test -f /usr/bin/vbox-img && my_files+=("/usr/bin/vbox-img") test -f /usr/local/bin/VirtualBox && my_files+=("/usr/local/bin/VirtualBox") test -f /usr/local/bin/VBoxManage && my_files+=("/usr/local/bin/VBoxManage") test -f /usr/local/bin/VBoxVRDP && my_files+=("/usr/local/bin/VBoxVRDP") test -f /usr/local/bin/VBoxHeadless && my_files+=("/usr/local/bin/VBoxHeadless") test -f /usr/local/bin/vboxwebsrv && my_files+=("/usr/local/bin/vboxwebsrv") test -f /usr/local/bin/VBoxBugReport && my_files+=("/usr/local/bin/VBoxBugReport") test -f /usr/local/bin/VBoxBalloonCtrl && my_files+=("/usr/local/bin/VBoxBalloonCtrl") test -f /usr/local/bin/VBoxAutostart && my_files+=("/usr/local/bin/VBoxAutostart") test -f /usr/local/bin/VBoxDTrace && my_files+=("/usr/local/bin/VBoxDTrace") test -f /usr/local/bin/vbox-img && my_files+=("/usr/local/bin/vbox-img") test -d /Library/Receipts/VirtualBoxCLI.pkg/ && my_directories+=("/Library/Receipts/VirtualBoxCLI.pkg/") test -f /Library/LaunchDaemons/org.virtualbox.startup.plist && my_files+=("/Library/LaunchDaemons/org.virtualbox.startup.plist")test -d /Applications/VirtualBox.app/ && my_directories+=("/Applications/VirtualBox.app/") test -d /Library/Receipts/VirtualBox.pkg/ && my_directories+=("/Library/Receipts/VirtualBox.pkg/")# legacy test -d /Library/Receipts/VBoxDrv.pkg/ && my_directories+=("/Library/Receipts/VBoxDrv.pkg/") test -d /Library/Receipts/VBoxUSB.pkg/ && my_directories+=("/Library/Receipts/VBoxUSB.pkg/")# python stuff python_versions="2.3 2.5 2.6 2.7" for p in $python_versions; dotest -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py")test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc")test -f /Library/Python/$p/site-packages/vboxapi/__init__.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.py")test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.pyc")test -f /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info && my_files+=("/Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info")test -d /Library/Python/$p/site-packages/vboxapi/ && my_directories+=("/Library/Python/$p/site-packages/vboxapi/") done# # Collect KEXTs to remove. # Note that the unload order is significant. # declare -a my_kexts for kext in org.virtualbox.kext.VBoxUSB org.virtualbox.kext.VBoxNetFlt org.virtualbox.kext.VBoxNetAdp org.virtualbox.kext.VBoxDrv; doif /usr/sbin/kextstat -b $kext -l | grep -q $kext; thenmy_kexts+=("$kext")fi done# # Collect packages to forget # my_pb='org\.virtualbox\.pkg\.' my_pkgs=`/usr/sbin/pkgutil --pkgs="${my_pb}vboxkexts|${my_pb}vboxstartupitems|${my_pb}virtualbox|${my_pb}virtualboxcli"`# # Did we find anything to uninstall? # if test -z "${my_directories[*]}" -a -z "${my_files[*]}" -a -z "${my_kexts[*]}" -a -z "$my_pkgs"; thenecho "No VirtualBox files, directories, KEXTs or packages to uninstall."echo "Done."exit 0; fi# # Look for running VirtualBox processes and warn the user # if something is running. Since deleting the files of # running processes isn't fatal as such, we will leave it # to the user to choose whether to continue or not. # # Note! comm isn't supported on Tiger, so we make -c to do the stripping. # my_processes="`ps -axco 'pid uid command' | grep -wEe '(VirtualBox|VirtualBoxVM|VBoxManage|VBoxHeadless|vboxwebsrv|VBoxXPCOMIPCD|VBoxSVC|VBoxNetDHCP|VBoxNetNAT)' | grep -vw grep | grep -vw VirtualBox_Uninstall.tool | tr '\n' '\a'`"; if test -n "$my_processes"; thenecho 'Warning! Found the following active VirtualBox processes:'echo "$my_processes" | tr '\a' '\n'echo ""echo "We recommend that you quit all VirtualBox processes before"echo "uninstalling the product."echo ""if test "$my_default_prompt" != "Yes"; thenecho "Do you wish to continue none the less (Yes/No)?"read my_answerif test "$my_answer" != "Yes" -a "$my_answer" != "YES" -a "$my_answer" != "yes"; thenecho "Aborting uninstall. (answer: '$my_answer')".exit 2;fiecho ""my_answer=""fi fi# # Display the files and directories that will be removed # and get the user's consent before continuing. # if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; thenecho "The following files and directories (bundles) will be removed:"for file in "${my_files[@]}"; do echo " $file"; donefor dir in "${my_directories[@]}"; do echo " $dir"; doneecho "" fi if test -n "${my_kexts[*]}"; thenecho "And the following KEXTs will be unloaded:"for kext in "${my_kexts[@]}"; do echo " $kext"; doneecho "" fi if test -n "$my_pkgs"; thenecho "And the traces of following packages will be removed:"for kext in $my_pkgs; do echo " $kext"; doneecho "" fiif test "$my_default_prompt" != "Yes"; thenecho "Do you wish to uninstall VirtualBox (Yes/No)?"read my_answerif test "$my_answer" != "Yes" -a "$my_answer" != "YES" -a "$my_answer" != "yes"; thenecho "Aborting uninstall. (answer: '$my_answer')".exit 2;fiecho "" fi# # Unregister has to be done before the files are removed. # LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister if [ -e ${LSREGISTER} ]; then${LSREGISTER} -u /Applications/VirtualBox.app > /dev/null${LSREGISTER} -u /Applications/VirtualBox.app/Contents/Resources/vmstarter.app > /dev/null fi# # Display the sudo usage instructions and execute the command. # echo "The uninstallation processes requires administrative privileges" echo "because some of the installed files cannot be removed by a normal" echo "user. You may be prompted for your password now..." echo ""if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; then/usr/bin/sudo -p "Please enter %u's password:" /bin/rm -Rf "${my_files[@]}" "${my_directories[@]}"my_rc=$?if test "$my_rc" -ne 0; thenecho "An error occurred durning 'sudo rm', there should be a message above. (rc=$my_rc)"test -x /usr/bin/sudo || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."test -x /bin/rm || echo "warning: Cannot find /bin/rm or it's not an executable"echo ""echo "The uninstall failed. Please retry."exit 1;fi fimy_rc=0 for kext in "${my_kexts[@]}"; doecho unloading $kext/usr/bin/sudo -p "Please enter %u's password (unloading $kext):" /sbin/kextunload -m $kextmy_rc2=$?if test "$my_rc2" -ne 0; thenecho "An error occurred durning 'sudo /sbin/kextunload -m $kext', there should be a message above. (rc=$my_rc2)"test -x /usr/bin/sudo || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."test -x /sbin/kextunload || echo "warning: Cannot find /sbin/kextunload or it's not an executable"my_rc=$my_rc2fi done if test "$my_rc" -eq 0; thenecho "Successfully unloaded VirtualBox kernel extensions." elseecho "Failed to unload one or more KEXTs, please reboot the machine to complete the uninstall."exit 1; fi# Cleaning up pkgutil database for my_pkg in $my_pkgs; do/usr/bin/sudo -p "Please enter %u's password (removing $my_pkg):" /usr/sbin/pkgutil --forget "$my_pkg" doneecho "Done." exit 0;

?

轉載于:https://www.cnblogs.com/litifeng/p/9664227.html

總結

以上是生活随笔為你收集整理的virtualbox和vagrant卸载脚本在macbook的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 黄色成人免费观看 | 超鹏在线视频 | 欧美午夜精品一区二区 | 免费看黄色一级片 | 欧美一及片 | √资源天堂中文在线 | 第一毛片| 色男天堂 | 国产涩涩 | 蜜桃传媒一区二区亚洲 | 欧美三日本三级少妇三级99观看视频 | 亚洲欧洲在线看 | 在线看黄色av | a在线免费| 亚洲丝袜中文字幕 | 亚洲尤物视频 | 理论视频在线观看 | 黄色污网站在线观看 | 四虎影院一区二区 | av久操| 中文一区二区 | 在线免费一级片 | 欧美黄在线 | 亚洲青青草原 | 99久久久无码国产精品性色戒 | 中文字幕系列 | 日韩欧美中文字幕一区二区 | 草女人视频 | 国产一在线 | 重口另类 | 久久综合色鬼 | www黄色| 99在线观看视频 | 成人在线观看www | 先锋影音av在线资源 | 国产超91| 鲁丝av | 国产av人人夜夜澡人人爽麻豆 | 色呦| 成人看 | 成人精品一区二区三区四区 | 干综合网 | 久久久99精品国产一区二区三区 | 亚洲成人99| 亚洲一本之道 | 国产精品97 | 胖女人做爰全过程 | 天堂在线亚洲 | 可乐操亚洲 | 黄片毛片在线看 | 91丨九色丨黑人外教 | 特级西西www444人体聚色 | 日韩精品麻豆 | 久久久久女人精品毛片九一 | 一本色道久久加勒比精品 | 69亚洲 | 日韩精品成人免费观看视频 | 日韩城人视频 | 狠狠操狠狠操 | 在线a级 | 欧美另类人妖 | 中出av在线 | 久久久久久久久综合 | 国产看片网站 | 成人高潮片 | 日韩av一区二区三区四区 | 日本人xxxⅹ18hd19hd | 亚州视频在线 | 国产精品综合久久 | 天天爽网站 | 午夜精品免费 | 一本大道东京热无码aⅴ | 国产欧美日韩高清 | 国产一区二区三区影视 | 午夜美女视频 | 在线免费观看a级片 | 美女黄视频网站 | av地址在线 | 久久久99国产精品免费 | 日韩久久精品视频 | 国产成人在线电影 | 新香蕉视频| 中文字幕av资源 | 免费看亚洲 | 麻豆免费在线播放 | 国语一区 | 久久久久99精品 | 成年人爱爱视频 | 久久久久免费精品 | 香蕉黄视频 | 人妻精品无码一区二区 | 国产人与禽zoz0性伦 | 中文字幕一区二区三区不卡 | 欧美日韩在线视频免费播放 | 相亲对象是问题学生动漫免费观看 | 国产成人免费av一区二区午夜 | 欧美日韩三| 久久作爱| 人妻丰满熟妇岳av无码区hd |