mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-01-30 22:34:27 +00:00
refact: fix (almost) all shellcheck errors
the only files i didn't fix: - core/tabs/utils/ssh.sh (ref #996) - core/tabs/system-setup/arch/server-setup.sh
This commit is contained in:
parent
d91a44efab
commit
414c75792c
|
@ -19,7 +19,7 @@ install_adb() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add android-tools
|
"$ESCALATION_TOOL" "$PACKAGER" add android-tools
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -8,7 +8,7 @@ installLibreWolf() {
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates
|
"$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates
|
||||||
distro=`if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then lsb_release -sc; else echo focal; fi`
|
distro=$(if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q "$(lsb_release -sc)"; then "$(lsb_release -sc)"; else echo 'focal'; fi)
|
||||||
curl -fsSL https://deb.librewolf.net/keyring.gpg | "$ESCALATION_TOOL" gpg --dearmor -o /usr/share/keyrings/librewolf.gpg
|
curl -fsSL https://deb.librewolf.net/keyring.gpg | "$ESCALATION_TOOL" gpg --dearmor -o /usr/share/keyrings/librewolf.gpg
|
||||||
echo "Types: deb
|
echo "Types: deb
|
||||||
URIs: https://deb.librewolf.net
|
URIs: https://deb.librewolf.net
|
||||||
|
@ -49,4 +49,4 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
checkAURHelper
|
checkAURHelper
|
||||||
installLibreWolf
|
installLibreWolf
|
||||||
|
|
|
@ -17,7 +17,7 @@ installDiscord() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm discord
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm discord
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y discord
|
"$ESCALATION_TOOL" "$PACKAGER" install -y discord
|
||||||
;;
|
;;
|
||||||
apk)
|
apk)
|
||||||
|
@ -36,4 +36,4 @@ installDiscord() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
installDiscord
|
installDiscord
|
||||||
|
|
|
@ -8,7 +8,7 @@ installSignal() {
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
curl -fsSL https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg
|
curl -fsSL https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg
|
||||||
cat signal-desktop-keyring.gpg | "$ESCALATION_TOOL" tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
|
"$ESCALATION_TOOL" tee /usr/share/keyrings/signal-desktop-keyring.gpg < signal-desktop-keyring.gpg > /dev/null
|
||||||
printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/signal-xenial.list
|
printf "%b\n" 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | "$ESCALATION_TOOL" tee /etc/apt/sources.list.d/signal-xenial.list
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -y install signal-desktop
|
"$ESCALATION_TOOL" "$PACKAGER" -y install signal-desktop
|
||||||
|
@ -39,4 +39,4 @@ installSignal() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
installSignal
|
installSignal
|
||||||
|
|
|
@ -192,7 +192,7 @@ setupDisplayManager() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
|
"$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -244,7 +244,7 @@ setupDisplayManager() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DM"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -53,7 +53,7 @@ installLinutil() {
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
. $HOME/.cargo/env
|
. "$HOME/.cargo/env"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -17,7 +17,7 @@ updateLinutil() {
|
||||||
zypper)
|
zypper)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
"$ESCALATION_TOOL" "$PACKAGER" install -n curl gcc make
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
. $HOME/.cargo/env
|
. "$HOME/.cargo/env"
|
||||||
;;
|
;;
|
||||||
apk)
|
apk)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add build-base
|
"$ESCALATION_TOOL" "$PACKAGER" add build-base
|
||||||
|
|
|
@ -15,33 +15,33 @@ installDepend() {
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
printf "%b\n" "${GREEN}Multilib is already enabled.${RC}"
|
||||||
fi
|
fi
|
||||||
"$AUR_HELPER" -S --needed --noconfirm $DEPENDENCIES
|
"$AUR_HELPER" -S --needed --noconfirm "$DEPENDENCIES"
|
||||||
;;
|
;;
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
COMPILEDEPS='build-essential'
|
COMPILEDEPS='build-essential'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" "$COMPILEDEPS"
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
COMPILEDEPS='@development-tools'
|
COMPILEDEPS='@development-tools'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled powertools
|
"$ESCALATION_TOOL" "$PACKAGER" config-manager --set-enabled powertools
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" "$COMPILEDEPS"
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
"$ESCALATION_TOOL" "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||||
;;
|
;;
|
||||||
zypper)
|
zypper)
|
||||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
"$ESCALATION_TOOL" "$PACKAGER" refresh
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install $DEPENDENCIES $COMPILEDEPS
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install "$DEPENDENCIES" "$COMPILEDEPS"
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
||||||
;;
|
;;
|
||||||
apk)
|
apk)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" add build-base multitail tar tree trash-cli unzip cmake jq
|
"$ESCALATION_TOOL" "$PACKAGER" add build-base multitail tar tree trash-cli unzip cmake jq
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -49,4 +49,4 @@ installDepend() {
|
||||||
checkEnv
|
checkEnv
|
||||||
checkAURHelper
|
checkAURHelper
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
installDepend
|
installDepend
|
||||||
|
|
|
@ -22,7 +22,7 @@ cleanup_system() {
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
|
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null || true
|
"$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm > /dev/null || true
|
||||||
;;
|
;;
|
||||||
apk)
|
apk)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" cache clean
|
"$ESCALATION_TOOL" "$PACKAGER" cache clean
|
||||||
|
|
|
@ -65,12 +65,11 @@ scan_devices() {
|
||||||
printf "%b\n" "$devices"
|
printf "%b\n" "$devices"
|
||||||
fi
|
fi
|
||||||
printf "%b" "Press any key to return to the main menu..."
|
printf "%b" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to prompt for MAC address using numbers
|
# Function to prompt for MAC address using numbers
|
||||||
prompt_for_mac() {
|
prompt_for_mac() {
|
||||||
action=$1
|
|
||||||
command=$2
|
command=$2
|
||||||
prompt_msg=$3
|
prompt_msg=$3
|
||||||
success_msg=$4
|
success_msg=$4
|
||||||
|
@ -82,14 +81,14 @@ prompt_for_mac() {
|
||||||
if [ -z "$devices" ]; then
|
if [ -z "$devices" ]; then
|
||||||
printf "%b\n" "${RED}No devices available. Please scan for devices first.${RC}"
|
printf "%b\n" "${RED}No devices available. Please scan for devices first.${RC}"
|
||||||
printf "%b" "Press any key to return to the main menu..."
|
printf "%b" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display devices with numbers
|
# Display devices with numbers
|
||||||
device_list=$(echo "$devices" | tr '\n' '\n')
|
device_list=$(echo "$devices" | tr '\n' '\n')
|
||||||
i=1
|
i=1
|
||||||
echo "$device_list" | while IFS= read -r device; do
|
for device in $device_list; do
|
||||||
printf "%d. %s\n" "$i" "$device"
|
printf "%d. %s\n" "$i" "$device"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
@ -102,12 +101,12 @@ prompt_for_mac() {
|
||||||
device=$(echo "$device_list" | sed -n "${choice}p")
|
device=$(echo "$device_list" | sed -n "${choice}p")
|
||||||
mac=$(echo "$device" | awk '{print $2}')
|
mac=$(echo "$device" | awk '{print $2}')
|
||||||
if bluetoothctl info "$mac" > /dev/null 2>&1; then
|
if bluetoothctl info "$mac" > /dev/null 2>&1; then
|
||||||
bluetoothctl "$command" "$mac" && {
|
if bluetoothctl "$command" "$mac"; then
|
||||||
printf "%b\n" "${GREEN}$success_msg${RC}"
|
printf "%b\n" "${GREEN}$success_msg${RC}"
|
||||||
break
|
break
|
||||||
} || {
|
else
|
||||||
printf "%b\n" "${RED}$failure_msg${RC}"
|
printf "%b\n" "${RED}$failure_msg${RC}"
|
||||||
}
|
fi
|
||||||
else
|
else
|
||||||
printf "%b\n" "${RED}Invalid MAC address. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid MAC address. Please try again.${RC}"
|
||||||
fi
|
fi
|
||||||
|
@ -118,7 +117,7 @@ prompt_for_mac() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf "%b" "Press any key to return to the main menu..."
|
printf "%b" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to pair with a device
|
# Function to pair with a device
|
||||||
|
|
|
@ -62,11 +62,11 @@ encrypt_file() {
|
||||||
if [ -d "$INPUT_PATH" ]; then
|
if [ -d "$INPUT_PATH" ]; then
|
||||||
# Encrypt each file in the directory
|
# Encrypt each file in the directory
|
||||||
find "$INPUT_PATH" -type f | while read -r FILE; do
|
find "$INPUT_PATH" -type f | while read -r FILE; do
|
||||||
REL_PATH="${FILE#$INPUT_PATH/}"
|
REL_PATH="${FILE#"$INPUT_PATH"/}"
|
||||||
OUTPUT_FILE="$OUTPUT_PATH/$REL_PATH.enc"
|
OUTPUT_FILE="$OUTPUT_PATH/$REL_PATH.enc"
|
||||||
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
||||||
openssl enc -aes-256-cbc -salt -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD"
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ "$(openssl enc -aes-256-cbc -salt -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD")" -eq 0 ]; then
|
||||||
printf "%b\n" "Encrypted: $OUTPUT_FILE"
|
printf "%b\n" "Encrypted: $OUTPUT_FILE"
|
||||||
else
|
else
|
||||||
printf "%b\n" "Failed to encrypt: $FILE"
|
printf "%b\n" "Failed to encrypt: $FILE"
|
||||||
|
@ -79,8 +79,8 @@ encrypt_file() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
||||||
openssl enc -aes-256-cbc -salt -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD"
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ "$(openssl enc -aes-256-cbc -salt -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD")" -eq 0 ]; then
|
||||||
printf "%b\n" "Encrypted: $OUTPUT_PATH"
|
printf "%b\n" "Encrypted: $OUTPUT_PATH"
|
||||||
else
|
else
|
||||||
printf "%b\n" "Failed to encrypt: $INPUT_PATH"
|
printf "%b\n" "Failed to encrypt: $INPUT_PATH"
|
||||||
|
@ -107,11 +107,11 @@ decrypt_file() {
|
||||||
if [ -d "$INPUT_PATH" ]; then
|
if [ -d "$INPUT_PATH" ]; then
|
||||||
# Decrypt each file in the directory
|
# Decrypt each file in the directory
|
||||||
find "$INPUT_PATH" -type f -name '*.enc' | while read -r FILE; do
|
find "$INPUT_PATH" -type f -name '*.enc' | while read -r FILE; do
|
||||||
REL_PATH="${FILE#$INPUT_PATH/}"
|
REL_PATH="${FILE#"$INPUT_PATH"/}"
|
||||||
OUTPUT_FILE="$OUTPUT_PATH/${REL_PATH%.enc}"
|
OUTPUT_FILE="$OUTPUT_PATH/${REL_PATH%.enc}"
|
||||||
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
mkdir -p "$(dirname "$OUTPUT_FILE")"
|
||||||
openssl enc -aes-256-cbc -d -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD"
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ "$(openssl enc -aes-256-cbc -d -pbkdf2 -in "$FILE" -out "$OUTPUT_FILE" -k "$PASSWORD")" -eq 0 ]; then
|
||||||
printf "%b\n" "Decrypted: $OUTPUT_FILE"
|
printf "%b\n" "Decrypted: $OUTPUT_FILE"
|
||||||
else
|
else
|
||||||
printf "%b\n" "Failed to decrypt: $FILE"
|
printf "%b\n" "Failed to decrypt: $FILE"
|
||||||
|
@ -124,8 +124,8 @@ decrypt_file() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
mkdir -p "$(dirname "$OUTPUT_PATH")"
|
||||||
openssl enc -aes-256-cbc -d -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD"
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ "$(openssl enc -aes-256-cbc -d -pbkdf2 -in "$INPUT_PATH" -out "$OUTPUT_PATH" -k "$PASSWORD")" -eq 0 ]; then
|
||||||
printf "%b\n" "Decrypted: $OUTPUT_PATH"
|
printf "%b\n" "Decrypted: $OUTPUT_PATH"
|
||||||
else
|
else
|
||||||
printf "%b\n" "Failed to decrypt: $INPUT_PATH"
|
printf "%b\n" "Failed to decrypt: $INPUT_PATH"
|
||||||
|
@ -148,10 +148,10 @@ main(){
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%b\n" "Press [Enter] to continue..."
|
printf "%b\n" "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r _
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
main
|
main
|
||||||
|
|
|
@ -29,7 +29,7 @@ adjust_monitor_brightness() {
|
||||||
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then
|
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then
|
||||||
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
||||||
printf "Press [Enter] to continue..."
|
printf "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r _
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ adjust_monitor_brightness() {
|
||||||
if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$monitor_count" ]; then
|
if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$monitor_count" ]; then
|
||||||
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
||||||
printf "Press [Enter] to continue..."
|
printf "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r _
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ set_resolutions() {
|
||||||
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$' || [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$((i - 1))" ]; then
|
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$' || [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$((i - 1))" ]; then
|
||||||
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
|
||||||
printf "%b\n" "Press [Enter] to continue..."
|
printf "%b\n" "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r _
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,8 @@ run_model() {
|
||||||
printf "%b\n" "${installed_models}"
|
printf "%b\n" "${installed_models}"
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Custom Models${RC}"
|
printf "%b\n" "${YELLOW}Custom Models${RC}"
|
||||||
custom_models=$(ollama list | grep 'custom-model-prefix')
|
custom_models=$(ollama list | grep 'custom-model-prefix')
|
||||||
|
printf "%b\n" "${custom_models}"
|
||||||
|
|
||||||
printf "%b" "Select a model to run: "
|
printf "%b" "Select a model to run: "
|
||||||
printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: "
|
printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: "
|
||||||
|
@ -195,7 +196,7 @@ menu() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Press Enter to continue...${RC}"
|
printf "%b\n" "${YELLOW}Press Enter to continue...${RC}"
|
||||||
read -r dummy
|
read -r _
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ setup_ssh_samba(){
|
||||||
printf "%b\n" "5. Exit"
|
printf "%b\n" "5. Exit"
|
||||||
|
|
||||||
printf "%b" "Enter your choice (1-5): "
|
printf "%b" "Enter your choice (1-5): "
|
||||||
read CHOICE
|
read -r CHOICE
|
||||||
|
|
||||||
case "$CHOICE" in
|
case "$CHOICE" in
|
||||||
1)
|
1)
|
||||||
|
@ -205,4 +205,4 @@ setup_ssh_samba(){
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
setup_ssh_samba
|
setup_ssh_samba
|
||||||
|
|
|
@ -267,10 +267,10 @@ main() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%b\n" "Press [Enter] to continue..."
|
printf "%b\n" "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r _
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
main
|
main
|
||||||
|
|
|
@ -67,6 +67,7 @@ create_snapshot() {
|
||||||
"$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG"
|
"$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
printf "%b\n" "${GREEN}Snapshot created successfully.${RC}"
|
printf "%b\n" "${GREEN}Snapshot created successfully.${RC}"
|
||||||
else
|
else
|
||||||
|
@ -93,6 +94,7 @@ restore_snapshot() {
|
||||||
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes
|
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
printf "%b\n" "${GREEN}Snapshot restored successfully.${RC}"
|
printf "%b\n" "${GREEN}Snapshot restored successfully.${RC}"
|
||||||
else
|
else
|
||||||
|
@ -110,6 +112,7 @@ delete_snapshot() {
|
||||||
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
|
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
|
||||||
"$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes
|
"$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes
|
||||||
|
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}"
|
printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}"
|
||||||
else
|
else
|
||||||
|
@ -126,6 +129,7 @@ delete_all_snapshots() {
|
||||||
if [ "$CONFIRMATION" = "y" ] || [ "$CONFIRMATION" = "Y" ]; then
|
if [ "$CONFIRMATION" = "y" ] || [ "$CONFIRMATION" = "Y" ]; then
|
||||||
printf "%b\n" "${CYAN}Deleting all snapshots...${RC}"
|
printf "%b\n" "${CYAN}Deleting all snapshots...${RC}"
|
||||||
"$ESCALATION_TOOL" timeshift --delete-all --yes
|
"$ESCALATION_TOOL" timeshift --delete-all --yes
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}"
|
printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}"
|
||||||
else
|
else
|
||||||
|
@ -153,7 +157,7 @@ main_menu() {
|
||||||
*) printf "%b\n" "${RED}Invalid option. Please try again.${RC}" ;;
|
*) printf "%b\n" "${RED}Invalid option. Please try again.${RC}" ;;
|
||||||
esac
|
esac
|
||||||
printf "%b\n" "${CYAN}Press Enter to continue...${RC}"
|
printf "%b\n" "${CYAN}Press Enter to continue...${RC}"
|
||||||
read -r dummy
|
read -r _
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ addToGroup() {
|
||||||
groups_to_add=$(echo "$groups" | tr ' ' ',')
|
groups_to_add=$(echo "$groups" | tr ' ' ',')
|
||||||
|
|
||||||
printf "%b" "${YELLOW}Are you sure you want to add user $username to $groups_to_add? [Y/n]: ${RC}"
|
printf "%b" "${YELLOW}Are you sure you want to add user $username to $groups_to_add? [Y/n]: ${RC}"
|
||||||
read -r confirm
|
read -r _
|
||||||
confirmAction || exit 1
|
confirmAction || exit 1
|
||||||
|
|
||||||
"$ESCALATION_TOOL" usermod -aG "$groups_to_add" "$username"
|
"$ESCALATION_TOOL" usermod -aG "$groups_to_add" "$username"
|
||||||
|
@ -44,4 +44,4 @@ addToGroup() {
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
checkGroups
|
checkGroups
|
||||||
addToGroup
|
addToGroup
|
||||||
|
|
|
@ -17,7 +17,7 @@ changePassword() {
|
||||||
read -r password
|
read -r password
|
||||||
|
|
||||||
printf "%b" "${YELLOW}Are you sure you want to change password for ""$username""? [Y/n]: ${RC}"
|
printf "%b" "${YELLOW}Are you sure you want to change password for ""$username""? [Y/n]: ${RC}"
|
||||||
read -r confirm
|
read -r _
|
||||||
confirmAction || exit 1
|
confirmAction || exit 1
|
||||||
|
|
||||||
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd
|
echo "$username:$password" | "$ESCALATION_TOOL" chpasswd
|
||||||
|
@ -30,4 +30,4 @@ changePassword() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
changePassword
|
changePassword
|
||||||
|
|
|
@ -14,7 +14,7 @@ deleteUser() {
|
||||||
|
|
||||||
if id "$username" > /dev/null 2>&1; then
|
if id "$username" > /dev/null 2>&1; then
|
||||||
printf "%b" "${YELLOW}Are you sure you want to delete user ""$username""? [Y/n]: ${RC}"
|
printf "%b" "${YELLOW}Are you sure you want to delete user ""$username""? [Y/n]: ${RC}"
|
||||||
read -r confirm
|
read -r _
|
||||||
confirmAction || exit 1
|
confirmAction || exit 1
|
||||||
|
|
||||||
$ESCALATION_TOOL userdel --remove "$username" 2>/dev/null
|
$ESCALATION_TOOL userdel --remove "$username" 2>/dev/null
|
||||||
|
@ -27,4 +27,4 @@ deleteUser() {
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
deleteUser
|
deleteUser
|
||||||
|
|
|
@ -34,14 +34,14 @@ removeFromGroup() {
|
||||||
groups_to_remove=$(echo "$groups" | tr ' ' ',')
|
groups_to_remove=$(echo "$groups" | tr ' ' ',')
|
||||||
|
|
||||||
printf "%b" "${YELLOW}Are you sure you want to remove user $username from $groups_to_remove? [Y/n]: ${RC}"
|
printf "%b" "${YELLOW}Are you sure you want to remove user $username from $groups_to_remove? [Y/n]: ${RC}"
|
||||||
read -r confirm
|
read -r _
|
||||||
confirmAction || exit 1
|
confirmAction || exit 1
|
||||||
|
|
||||||
$ESCALATION_TOOL usermod -rG $groups_to_remove "$username"
|
$ESCALATION_TOOL usermod -rG "$groups_to_remove" "$username"
|
||||||
|
|
||||||
printf "%b\n" "${GREEN}User successfully removed from $groups_to_remove${RC}"
|
printf "%b\n" "${GREEN}User successfully removed from $groups_to_remove${RC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
removeFromGroup
|
removeFromGroup
|
||||||
|
|
|
@ -30,6 +30,7 @@ execute_command() {
|
||||||
command="$1"
|
command="$1"
|
||||||
printf "Executing: %s\n" "$command"
|
printf "Executing: %s\n" "$command"
|
||||||
eval "$command" 2>&1 | tee /tmp/xrandr.log | tail -n 20
|
eval "$command" 2>&1 | tee /tmp/xrandr.log | tail -n 20
|
||||||
|
# shellcheck disable=SC2181
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
printf "%b\n" "${RED}An error occurred while executing the command. Check /tmp/xrandr.log for details.${RC}"
|
printf "%b\n" "${RED}An error occurred while executing the command. Check /tmp/xrandr.log for details.${RC}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -75,33 +75,33 @@ scan_networks() {
|
||||||
echo "$networks" | awk -F: '{printf("%d. SSID: %-25s \n", NR, $1)}'
|
echo "$networks" | awk -F: '{printf("%d. SSID: %-25s \n", NR, $1)}'
|
||||||
fi
|
fi
|
||||||
printf "%b\n" "Press any key to return to the main menu..."
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to turn WiFi on
|
# Function to turn WiFi on
|
||||||
wifi_on() {
|
wifi_on() {
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}Turning WiFi on...${RC}"
|
printf "%b\n" "${YELLOW}Turning WiFi on...${RC}"
|
||||||
nmcli radio wifi on && {
|
if "$(nmcli radio wifi on)"; then
|
||||||
printf "%b\n" "${GREEN}WiFi is now turned on.${RC}"
|
printf "%b\n" "${GREEN}WiFi is now turned on.${RC}"
|
||||||
} || {
|
else
|
||||||
printf "%b\n" "${RED}Failed to turn on WiFi.${RC}"
|
printf "%b\n" "${RED}Failed to turn on WiFi.${RC}"
|
||||||
}
|
fi
|
||||||
printf "%b\n" "Press any key to return to the main menu..."
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to turn WiFi off
|
# Function to turn WiFi off
|
||||||
wifi_off() {
|
wifi_off() {
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}Turning WiFi off...${RC}"
|
printf "%b\n" "${YELLOW}Turning WiFi off...${RC}"
|
||||||
nmcli radio wifi off && {
|
if "$(nmcli radio wifi off)"; then
|
||||||
printf "%b\n" "${GREEN}WiFi is now turned off.${RC}"
|
printf "%b\n" "${GREEN}WiFi is now turned off.${RC}"
|
||||||
} || {
|
else
|
||||||
printf "%b\n" "${RED}Failed to turn off WiFi.${RC}"
|
printf "%b\n" "${RED}Failed to turn off WiFi.${RC}"
|
||||||
}
|
fi
|
||||||
printf "%b\n" "Press any key to return to the main menu..."
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to prompt for WiFi network selection
|
# Function to prompt for WiFi network selection
|
||||||
|
@ -118,7 +118,7 @@ prompt_for_network() {
|
||||||
if [ -z "$networks" ]; then
|
if [ -z "$networks" ]; then
|
||||||
printf "%b\n" "${RED}No networks available. Please scan for networks first.${RC}"
|
printf "%b\n" "${RED}No networks available. Please scan for networks first.${RC}"
|
||||||
printf "%b\n" "Press any key to return to the main menu..."
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -142,18 +142,18 @@ prompt_for_network() {
|
||||||
printf "%b" "Enter password for SSID: " "$ssid"
|
printf "%b" "Enter password for SSID: " "$ssid"
|
||||||
read -r password
|
read -r password
|
||||||
printf "\n"
|
printf "\n"
|
||||||
nmcli dev wifi connect "$ssid" password "$password" && {
|
if "$(nmcli dev wifi connect "$ssid" password "$password")"; then
|
||||||
printf "%b\n" "${GREEN}$success_msg${RC}"
|
printf "%b\n" "${GREEN}$success_msg${RC}"
|
||||||
} || {
|
else
|
||||||
printf "%b\n" "${RED}$failure_msg${RC}"
|
printf "%b\n" "${RED}$failure_msg${RC}"
|
||||||
}
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b\n" "Press any key to return to the selection menu..."
|
printf "%b\n" "Press any key to return to the selection menu..."
|
||||||
read -r dummy
|
read -r _
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
|
@ -178,4 +178,4 @@ remove_network() {
|
||||||
checkEnv
|
checkEnv
|
||||||
checkEscalationTool
|
checkEscalationTool
|
||||||
setupNetworkManager
|
setupNetworkManager
|
||||||
main_menu
|
main_menu
|
||||||
|
|
Loading…
Reference in New Issue
Block a user