Fix spelling mistake and rename DATE variable to DATETIME to make more sense.

This commit is contained in:
Lily Freeman 2023-02-02 02:54:10 +00:00
parent e94c32df36
commit b9515b0166
2 changed files with 24 additions and 24 deletions

View File

@ -15,7 +15,7 @@
## Void for testing and helping out in general ## ## ## ## Void for testing and helping out in general ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ## ## .Chris. for testing and helping out in general ## ## Run this command ##
## WORMS for helping out with testing ## ## if you dont have ## ## WORMS for helping out with testing ## ## if you dont have ##
##################################################### ## names in you're ## ##################################################### ## names in your ##
## The VFIO community for using the scripts and ## ## lspci feedback ## ## The VFIO community for using the scripts and ## ## lspci feedback ##
## testing them for us! ## ## in your terminal ## ## testing them for us! ## ## in your terminal ##
##################################################### ####################### ##################################################### #######################
@ -23,21 +23,21 @@
################################# Variables ################################# ################################# Variables #################################
## Adds current time to var for use in echo for a cleaner log and script ## ## Adds current time to var for use in echo for a cleaner log and script ##
DATE=$(date +"%m/%d/%Y %R:%S :") DATETIME=$(date +"%m/%d/%Y %R:%S :")
## Sets dispmgr var as null ## ## Sets dispmgr var as null ##
DISPMGR="null" DISPMGR="null"
################################## Script ################################### ################################## Script ###################################
echo "$DATE Beginning of Startup!" echo "$DATETIME Beginning of Startup!"
function stop_display_manager_if_running { function stop_display_manager_if_running {
## Get display manager on systemd based distros ## ## Get display manager on systemd based distros ##
if [[ -x /run/systemd/system ]] && echo "$DATE Distro is using Systemd"; then if [[ -x /run/systemd/system ]] && echo "$DATETIME Distro is using Systemd"; then
DISPMGR="$(grep 'ExecStart=' /etc/systemd/system/display-manager.service | awk -F'/' '{print $(NF-0)}')" DISPMGR="$(grep 'ExecStart=' /etc/systemd/system/display-manager.service | awk -F'/' '{print $(NF-0)}')"
echo "$DATE Display Manager = $DISPMGR" echo "$DATETIME Display Manager = $DISPMGR"
## Stop display manager using systemd ## ## Stop display manager using systemd ##
if systemctl is-active --quiet "$DISPMGR.service"; then if systemctl is-active --quiet "$DISPMGR.service"; then
@ -58,7 +58,7 @@ function stop_display_manager_if_running {
function kde-clause { function kde-clause {
echo "$DATE Display Manager = display-manager" echo "$DATETIME Display Manager = display-manager"
## Stop display manager using systemd ## ## Stop display manager using systemd ##
if systemctl is-active --quiet "display-manager.service"; then if systemctl is-active --quiet "display-manager.service"; then
@ -81,10 +81,10 @@ function kde-clause {
#################################################################################################################### ####################################################################################################################
if pgrep -l "plasma" | grep "plasmashell"; then if pgrep -l "plasma" | grep "plasmashell"; then
echo "$DATE Display Manager is KDE, running KDE clause!" echo "$DATETIME Display Manager is KDE, running KDE clause!"
kde-clause kde-clause
else else
echo "$DATE Display Manager is not KDE!" echo "$DATETIME Display Manager is not KDE!"
stop_display_manager_if_running stop_display_manager_if_running
fi fi
@ -109,7 +109,7 @@ do
if test -x /sys/class/vtconsole/vtcon"${i}"; then if test -x /sys/class/vtconsole/vtcon"${i}"; then
if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"${i}"/name)" = 1 ]; then if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"${i}"/name)" = 1 ]; then
echo 0 > /sys/class/vtconsole/vtcon"${i}"/bind echo 0 > /sys/class/vtconsole/vtcon"${i}"/bind
echo "$DATE Unbinding Console ${i}" echo "$DATETIME Unbinding Console ${i}"
echo "$i" >> /tmp/vfio-bound-consoles echo "$i" >> /tmp/vfio-bound-consoles
fi fi
fi fi
@ -118,7 +118,7 @@ done
sleep "1" sleep "1"
if lspci -nn | grep -e VGA | grep -s NVIDIA ; then if lspci -nn | grep -e VGA | grep -s NVIDIA ; then
echo "$DATE System has an NVIDIA GPU" echo "$DATETIME System has an NVIDIA GPU"
grep -qsF "true" "/tmp/vfio-is-nvidia" || echo "true" >/tmp/vfio-is-nvidia grep -qsF "true" "/tmp/vfio-is-nvidia" || echo "true" >/tmp/vfio-is-nvidia
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
@ -131,11 +131,11 @@ if lspci -nn | grep -e VGA | grep -s NVIDIA ; then
modprobe -r drm_kms_helper modprobe -r drm_kms_helper
modprobe -r drm modprobe -r drm
echo "$DATE NVIDIA GPU Drivers Unloaded" echo "$DATETIME NVIDIA GPU Drivers Unloaded"
fi fi
if lspci -nn | grep -e VGA | grep -s AMD ; then if lspci -nn | grep -e VGA | grep -s AMD ; then
echo "$DATE System has an AMD GPU" echo "$DATETIME System has an AMD GPU"
grep -qsF "true" "/tmp/vfio-is-amd" || echo "true" >/tmp/vfio-is-amd grep -qsF "true" "/tmp/vfio-is-amd" || echo "true" >/tmp/vfio-is-amd
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
@ -145,7 +145,7 @@ if lspci -nn | grep -e VGA | grep -s AMD ; then
modprobe -r radeon modprobe -r radeon
modprobe -r drm modprobe -r drm
echo "$DATE AMD GPU Drivers Unloaded" echo "$DATETIME AMD GPU Drivers Unloaded"
fi fi
## Load VFIO-PCI driver ## ## Load VFIO-PCI driver ##
@ -153,4 +153,4 @@ modprobe vfio
modprobe vfio_pci modprobe vfio_pci
modprobe vfio_iommu_type1 modprobe vfio_iommu_type1
echo "$DATE End of Startup!" echo "$DATETIME End of Startup!"

View File

@ -15,7 +15,7 @@
## Void for testing and helping out in general ## ## ## ## Void for testing and helping out in general ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ## ## .Chris. for testing and helping out in general ## ## Run this command ##
## WORMS for helping out with testing ## ## if you dont have ## ## WORMS for helping out with testing ## ## if you dont have ##
##################################################### ## names in you're ## ##################################################### ## names in your ##
## The VFIO community for using the scripts and ## ## lspci feedback ## ## The VFIO community for using the scripts and ## ## lspci feedback ##
## testing them for us! ## ## in your terminal ## ## testing them for us! ## ## in your terminal ##
##################################################### ####################### ##################################################### #######################
@ -23,11 +23,11 @@
################################# Variables ################################# ################################# Variables #################################
## Adds current time to var for use in echo for a cleaner log and script ## ## Adds current time to var for use in echo for a cleaner log and script ##
DATE=$(date +"%m/%d/%Y %R:%S :") DATETIME=$(date +"%m/%d/%Y %R:%S :")
################################## Script ################################### ################################## Script ###################################
echo "$DATE Beginning of Teardown!" echo "$DATETIME Beginning of Teardown!"
## Unload VFIO-PCI driver ## ## Unload VFIO-PCI driver ##
modprobe -r vfio_pci modprobe -r vfio_pci
@ -37,7 +37,7 @@ modprobe -r vfio
if grep -q "true" "/tmp/vfio-is-nvidia" ; then if grep -q "true" "/tmp/vfio-is-nvidia" ; then
## Load NVIDIA drivers ## ## Load NVIDIA drivers ##
echo "$DATE Loading NVIDIA GPU Drivers" echo "$DATETIME Loading NVIDIA GPU Drivers"
modprobe drm modprobe drm
modprobe drm_kms_helper modprobe drm_kms_helper
@ -47,20 +47,20 @@ if grep -q "true" "/tmp/vfio-is-nvidia" ; then
modprobe nvidia_drm modprobe nvidia_drm
modprobe nvidia_uvm modprobe nvidia_uvm
echo "$DATE NVIDIA GPU Drivers Loaded" echo "$DATETIME NVIDIA GPU Drivers Loaded"
fi fi
if grep -q "true" "/tmp/vfio-is-amd" ; then if grep -q "true" "/tmp/vfio-is-amd" ; then
## Load NVIDIA drivers ## ## Load NVIDIA drivers ##
echo "$DATE Loading AMD GPU Drivers" echo "$DATETIME Loading AMD GPU Drivers"
modprobe drm modprobe drm
modprobe amdgpu modprobe amdgpu
modprobe radeon modprobe radeon
modprobe drm_kms_helper modprobe drm_kms_helper
echo "$DATE AMD GPU Drivers Loaded" echo "$DATETIME AMD GPU Drivers Loaded"
fi fi
## Restart Display Manager ## ## Restart Display Manager ##
@ -69,7 +69,7 @@ while read -r DISPMGR; do
if command -v systemctl; then if command -v systemctl; then
## Make sure the variable got collected ## ## Make sure the variable got collected ##
echo "$DATE Var has been collected from file: $DISPMGR" echo "$DATETIME Var has been collected from file: $DISPMGR"
systemctl start "$DISPMGR.service" systemctl start "$DISPMGR.service"
@ -89,11 +89,11 @@ while read -r consoleNumber; do
if test -x /sys/class/vtconsole/vtcon"${consoleNumber}"; then if test -x /sys/class/vtconsole/vtcon"${consoleNumber}"; then
if [ "$(grep -c "frame buffer" "/sys/class/vtconsole/vtcon${consoleNumber}/name")" \ if [ "$(grep -c "frame buffer" "/sys/class/vtconsole/vtcon${consoleNumber}/name")" \
= 1 ]; then = 1 ]; then
echo "$DATE Rebinding console ${consoleNumber}" echo "$DATETIME Rebinding console ${consoleNumber}"
echo 1 > /sys/class/vtconsole/vtcon"${consoleNumber}"/bind echo 1 > /sys/class/vtconsole/vtcon"${consoleNumber}"/bind
fi fi
fi fi
done < "$input" done < "$input"
echo "$DATE End of Teardown!" echo "$DATETIME End of Teardown!"