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 ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ##
## 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 ##
## testing them for us! ## ## in your terminal ##
##################################################### #######################
@ -23,21 +23,21 @@
################################# Variables #################################
## 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 ##
DISPMGR="null"
################################## Script ###################################
echo "$DATE Beginning of Startup!"
echo "$DATETIME Beginning of Startup!"
function stop_display_manager_if_running {
## 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)}')"
echo "$DATE Display Manager = $DISPMGR"
echo "$DATETIME Display Manager = $DISPMGR"
## Stop display manager using systemd ##
if systemctl is-active --quiet "$DISPMGR.service"; then
@ -58,7 +58,7 @@ function stop_display_manager_if_running {
function kde-clause {
echo "$DATE Display Manager = display-manager"
echo "$DATETIME Display Manager = display-manager"
## Stop display manager using systemd ##
if systemctl is-active --quiet "display-manager.service"; then
@ -81,10 +81,10 @@ function kde-clause {
####################################################################################################################
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
else
echo "$DATE Display Manager is not KDE!"
echo "$DATETIME Display Manager is not KDE!"
stop_display_manager_if_running
fi
@ -109,7 +109,7 @@ do
if test -x /sys/class/vtconsole/vtcon"${i}"; then
if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"${i}"/name)" = 1 ]; then
echo 0 > /sys/class/vtconsole/vtcon"${i}"/bind
echo "$DATE Unbinding Console ${i}"
echo "$DATETIME Unbinding Console ${i}"
echo "$i" >> /tmp/vfio-bound-consoles
fi
fi
@ -118,7 +118,7 @@ done
sleep "1"
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
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
echo "$DATE NVIDIA GPU Drivers Unloaded"
echo "$DATETIME NVIDIA GPU Drivers Unloaded"
fi
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
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 drm
echo "$DATE AMD GPU Drivers Unloaded"
echo "$DATETIME AMD GPU Drivers Unloaded"
fi
## Load VFIO-PCI driver ##
@ -153,4 +153,4 @@ modprobe vfio
modprobe vfio_pci
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 ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ##
## 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 ##
## testing them for us! ## ## in your terminal ##
##################################################### #######################
@ -23,11 +23,11 @@
################################# Variables #################################
## 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 ###################################
echo "$DATE Beginning of Teardown!"
echo "$DATETIME Beginning of Teardown!"
## Unload VFIO-PCI driver ##
modprobe -r vfio_pci
@ -37,7 +37,7 @@ modprobe -r vfio
if grep -q "true" "/tmp/vfio-is-nvidia" ; then
## Load NVIDIA drivers ##
echo "$DATE Loading NVIDIA GPU Drivers"
echo "$DATETIME Loading NVIDIA GPU Drivers"
modprobe drm
modprobe drm_kms_helper
@ -47,20 +47,20 @@ if grep -q "true" "/tmp/vfio-is-nvidia" ; then
modprobe nvidia_drm
modprobe nvidia_uvm
echo "$DATE NVIDIA GPU Drivers Loaded"
echo "$DATETIME NVIDIA GPU Drivers Loaded"
fi
if grep -q "true" "/tmp/vfio-is-amd" ; then
## Load NVIDIA drivers ##
echo "$DATE Loading AMD GPU Drivers"
echo "$DATETIME Loading AMD GPU Drivers"
modprobe drm
modprobe amdgpu
modprobe radeon
modprobe drm_kms_helper
echo "$DATE AMD GPU Drivers Loaded"
echo "$DATETIME AMD GPU Drivers Loaded"
fi
## Restart Display Manager ##
@ -69,7 +69,7 @@ while read -r DISPMGR; do
if command -v systemctl; then
## 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"
@ -89,11 +89,11 @@ while read -r consoleNumber; do
if test -x /sys/class/vtconsole/vtcon"${consoleNumber}"; then
if [ "$(grep -c "frame buffer" "/sys/class/vtconsole/vtcon${consoleNumber}/name")" \
= 1 ]; then
echo "$DATE Rebinding console ${consoleNumber}"
echo "$DATETIME Rebinding console ${consoleNumber}"
echo 1 > /sys/class/vtconsole/vtcon"${consoleNumber}"/bind
fi
fi
done < "$input"
echo "$DATE End of Teardown!"
echo "$DATETIME End of Teardown!"