From f9beed309163685032ed80b2b6c474d8b7a9e4dd Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Sat, 11 Oct 2025 05:52:22 -0600 Subject: [PATCH] added shutdown delay selector --- customscripts/install_script.sh | 17 ++++++++++++----- customscripts/message_users | 12 ++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 customscripts/message_users diff --git a/customscripts/install_script.sh b/customscripts/install_script.sh index 113eec0..94d1bcd 100644 --- a/customscripts/install_script.sh +++ b/customscripts/install_script.sh @@ -6,7 +6,8 @@ # set -e # make sure da silly thing dont continue when there be errorZ gitRepo='https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup.git' -tmpDir='/tmp/customscripts' +tmpDir='/tmp/generalssss' +tmp_customscripts_dir="$tmpDir/customscripts" finalDir='/usr/share/customscripts' echo "Using Shell $SHELL" @@ -65,12 +66,11 @@ echo "Cloning Repo $gitRepo" git clone $gitRepo $tmpDir --single-branch --depth 1 echo "Compiling donut" -gcc -o "$tmpDir/customscripts/donut" "$tmpDir/customscripts/donut.c" -lm -rm -f "$tmpDir/customscripts/donut.c" +gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm # put the customscripts dir into place echo "Placing in $finalDir" -sudo mv "$tmpDir/customscripts" "$finalDir" +sudo mv "$tmp_customscripts_dir" "$finalDir" # fix ownership echo "Changing ownership of $finalDir to $username:$username recursively" @@ -92,7 +92,14 @@ else fi # cleanup -sudo rm -f $finalDir/install_script.sh +## installer +sudo rm -f "$finalDir/install_script.sh" + +## git repo +sudo rm -rf "$tmpDir" + +## donut c file +rm -f "$tmp_customscripts_dir/donut.c" # sudo apt autoremove -y echo "Done with first stage" \ No newline at end of file diff --git a/customscripts/message_users b/customscripts/message_users new file mode 100644 index 0000000..55c6e79 --- /dev/null +++ b/customscripts/message_users @@ -0,0 +1,12 @@ +#!/bin/bash +if [[ ! -z $1 ]]; then + message="$1" +else + message="Something happening! Maybe a shutdown!" +fi + +for pts in $(ls -q /dev/pts); do + if [[ "$pts" =~ ^[0-9]+$ ]] && [[ "/dev/pts/$pts" != "$(tty)" ]]; then + sudo echo -e "$message" > /dev/pts/$pts + fi +done \ No newline at end of file