gpt4 book ai didi

linux - 即使使用安全启动 - bash 脚本,如何在 Linux 上安装 VirtualBox

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:29:38 28 4
gpt4 key购买 nike

我构建了一个简单的 bash 脚本,它应该能够安装 VirtualBox 存储库和 VirtualBox,即使在安全启动系统上也是如此。
它使用我自己的处于测试阶段的 bash 函数库。
因此,如果您在安全引导系统上运行 VirtualBox 时遇到问题,这适合您。

附言我假设安装了 rpmfusion

评论和帮助让它在其他发行版和版本上运行将不胜感激。当收到评论时,我会不断更新此脚本

最佳答案

#!/bin/bash

########################################## ################################
##
# @author Øystein "iRock"Jacobsen #
#@email irock.dev@gmail.com #
# @title VirtualBox.sh #
# @date 06.04.15 - 19.03.17 #
# @description 安装 VirtualBox repo 和 VirtualBox #
##
############################################## #############################

# -= 脚本变量 =- #
install=1 # 安装/卸载 ( 1/-1 ).
package="VirtualBox-5.1 kernel-devel gcc dkms"# 要安装的包。
user=用户``
package_url=""# 所述包的 URL。
archive_version=""# 要下载的存档版本。
archive=""# 要下载和安装的存档。
archive_url=""# 存档的 URL。
remove_archive=1 # 安装后删除存档 ( 0/1 )。
install_path=""# 提取路径。
icon_path="$install_path/icon.png"# 安装图标的路径。
icon_url=""# 图标的 URL。
debug=1 # 调试。
log=1 # Logging ( 0/1/2 ) ( None/File/File & Terminal).
log_file="$script_path/$script_name.log"# 日志文件名 ($0.log)。

# -= IMPORTING FUNCTIONS =-#
source "`dirname "$0"`/framework/FunctionLibrary.sh" # Importing FunctionLibrary.sh


# -= ELEVATING PRIVILEGES =- #
elevate_privileges # Elevate privileges


# -= CORE VARIABLES =- #
core_variables # Determines system-variables


# -= PRE INSTALL =- #
repo_url="http://download.virtualbox.org/virtualbox/$pkg/`echo $distro | tr '[:upper:]' '[:lower:]'`/virtualbox.repo" # URL to repo.

# -= INSTALL REPOSITORY =- #
if [ $pkg == "rpm" ]; then
install_repo "1" "$repo_url" "https://www.virtualbox.org/download/oracle_vbox.asc"
elif [ $pkg == "deb" ]; then
install_repo "1" "$repo_url" "https://www.virtualbox.org/download/oracle_vbox_2016.asc" "https://www.virtualbox.org/download/oracle_vbox.asc"
fi


# -= INSTALL =- #
install_pkg "1" $package


# -= POST INSTALL =- #
if [ "`getent group vboxusers`" == "" ]; then # If vboxusers group doesn't exist.
groupadd vboxusers # Create vboxusers group.
fi
usermod -a -G vboxusers "$user" # Add user to vboxusers.


# BUILD DRIVERS #
/usr/lib/virtualbox/vboxdrv.sh setup # Build kernel modules.
#/etc/init.d/vboxdrv setup # Build kernel modules.
#/sbin/rcvboxdrv setup # Build kernel modules.

关于linux - 即使使用安全启动 - bash 脚本,如何在 Linux 上安装 VirtualBox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29480176/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com