This commit is contained in:
Oliver Gwyther 2024-11-28 22:38:29 +00:00
parent fe47af873c
commit a3a02a861c
3 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,77 @@
#!/bin/bash
# Function to check if a command exists
command_exists() {
type "$1" &> /dev/null ;
}
# Check if the script is run as root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root. Please use sudo." 1>&2
exit 1
fi
# Update and install necessary packages
echo "Updating package list and installing necessary tools..."
apt-get update && apt-get upgrade -y
if command_exists lspci; then
echo "lspci is already installed."
else
echo "Installing lspci..."
apt-get install pciutils -y
fi
if command_exists grep; then
echo "grep is already installed."
else
echo "Installing grep..."
apt-get install grep -y
fi
# Identify the GPU device you want to passthrough
echo "Listing all PCI devices to identify your GPU:"
lspci
read -p "Enter the PCI ID of your GPU (e.g., 00:01.0): " gpu_id
# Verify GPU identification
echo "Verifying GPU with lspci -k..."
lspci -k | grep -i "$gpu_id"
if [ $? -ne 0 ]; then
echo "GPU not found or incorrect ID entered." >&2
exit 1
fi
# Configure Proxmox for GPU passthrough
echo "Configuring Proxmox to enable GPU passthrough..."
# Edit the VM configuration file, e.g., /etc/pve/qemu-server/YOUR_VM_ID.conf
read -p "Enter the ID of the VM you want to configure (e.g., 100 for vm100): " vm_id
echo "Editing VM configuration file for GPU passthrough..."
sed -i "/^[^#]*args=/ s/$/ --device $gpu_id/" /etc/pve/qemu-server/$vm_id.conf
# Optionally, add the GPU to a specific PCI slot (useful if you have multiple GPUs)
echo "Do you want to bind this GPU to a specific PCI slot in Proxmox? This might require creating a new VMDX file."
read -p "Type 'yes' or 'no': " response
if [[ "$response" == "yes" ]]; then
read -p "Enter the desired PCI slot (e.g., 00:02.0): " pci_slot
echo "Adding GPU to specified PCI slot..."
# You might need to create a new VMDX file or modify an existing one, this step depends on your Proxmox setup and version.
fi
# Blacklist the GPU driver modules
echo "Do you want to blacklist the GPU driver modules? This will prevent them from loading at boot."
read -p "Type 'yes' or 'no': " response
if [[ "$response" == "yes" ]]; then
echo "Blacklisting GPU driver modules..."
# Create a blacklist file for the relevant drivers
echo "${gpu_id}*" > /etc/modprobe.d/blacklist-gpu.conf
fi
# Restart the VM for changes to take effect
echo "Changes require restarting the VM. Please power off your VM:"
read -p "Enter the ID of the VM you want to restart (e.g., 100): " vm_id
virsh shutdown $vm_id
read -p "Power on the VM now? Type 'yes': " response
if [[ "$response" == "yes" ]]; then
virsh start $vm_id
fi
echo "GPU passthrough setup is complete. Please check your VM for GPU functionality."

View File

@ -17,6 +17,8 @@ function show_menu() {
function install_pve_no_subscription_warning() {
clear
echo "Installing PVE-No-Subscription-Warning..."
# Backup important configuration files
backup_file "/etc/apt/sources.list"
# Add your installation command here, for example:
wget https://raw.githubusercontent.com/proxmox/pve-no-subscription-warning/master/pve-no-subscription-warning -O /usr/local/bin/pve-no-subscription-warning
chmod +x /usr/local/bin/pve-no-subscription-warning
@ -28,6 +30,8 @@ function install_pve_no_subscription_warning() {
function install_pve_kernel_module_patcher() {
clear
echo "Installing PVE Kernel Module Patcher..."
# Backup important configuration files
backup_file "/etc/modprobe.d/proxmox-no-subscription.conf"
# Add your installation command here, for example:
wget https://raw.githubusercontent.com/olafm/proxmox-no-subscription-patch/master/pve-no-subscription-patch -O /usr/local/bin/pve-kernel-module-patcher
chmod +x /usr/local/bin/pve-kernel-module-patcher
@ -46,6 +50,19 @@ function install_pve_vm_backup_script() {
read -n 1 -s -r -p "Press any key to continue..."
}
# Function to backup files
function backup_file() {
local file=$1
if [ -f $file ]; then
local timestamp=$(date +%Y%m%d_%H%M%S)
local backup_file="/root/backup_$timestamp_$(basename $file)"
echo "Backing up $file to $backup_file"
rsync -a --delete $file $backup_file
else
echo "$file does not exist. Skipping backup."
fi
}
# Main loop
while true; do
show_menu

View File

@ -0,0 +1,49 @@
Please write me a Windows 11 Powershell script that presents the user with a menu of the following options and executes the associated tasks. It should include echo statements to keep the user informed. Please also style the terminal interface to make it easy to use.
The script should include the following options:
1) Make the following modifications to Windows:
1) Revert to the old explorer context menu.
2) Enable hidden files by default.
3) Enable showing file extensions by default.
2) The option to download and install the following system utilities. Users should be able to select/deselect which apps they would like installed before executing the task:
1) OpenRGB
2) FanControl
3) System Informer
4) WizTree
5) Rustdesk (remote desktop software)
6) XnViewMP (image viewer)
7) Browsers:
1) Mozilla Firefox
2) Waterfox
3) Zen Browser
4) Thorium
5) Chromium
6) Vivaldi
8) UniGetUI (package manager)
9) ShareX
10) Windhawk
3) Download an execute the MassGravel Windows Activation Script.
4) Download and install Grafana, Prometheus, Windows Exporter and OHMGraphite. Make sure Prometheus is then configured to collect data from Windows Exporter and OHMGraphite.