mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-25 14:30:11 +00:00
fix every issue related to printf (#596)
* increase synergy between scripts * Fix newlines Fix packagers etc * fix an issue with no new line being created * fix formatting Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * fix extra comma Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * change to () Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * change to () Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * change to () Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * change to () Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * remove extra comma Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * remove "please" Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * add support for caps Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * add support for caps Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * add support for caps Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * remove \n and make the default option "N" Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * add an extra quote Co-authored-by: Adam Perkowski <adas1per@protonmail.com> * add extra quotes * fix remaining sn * fix remaining new lines --------- Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com> Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
parent
76a4ffc70e
commit
cca2660c3b
|
@ -25,7 +25,7 @@ installGithubDesktop() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install github-desktop
|
"$ESCALATION_TOOL" "$PACKAGER" install github-desktop
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install Github Desktop manually.${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -30,7 +30,7 @@ installNeovim() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original nvim-setup-script.
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -27,7 +27,8 @@ installSublime() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install sublime-text
|
"$ESCALATION_TOOL" "$PACKAGER" install sublime-text
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -28,7 +28,8 @@ installVsCode() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install code
|
"$ESCALATION_TOOL" "$PACKAGER" install code
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,7 +23,8 @@ installVsCodium() {
|
||||||
printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/yum.repos.d/vscodium.repo
|
printf "%b\n" "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | "$ESCALATION_TOOL" tee -a /etc/yum.repos.d/vscodium.repo
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,7 +24,7 @@ install_chrome() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y google-chrome-stable
|
"$ESCALATION_TOOL" "$PACKAGER" install -y google-chrome-stable
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -43,15 +43,14 @@ install_thorium() {
|
||||||
;;
|
;;
|
||||||
zypper|dnf)
|
zypper|dnf)
|
||||||
url=$(curl -s https://api.github.com/repos/Alex313031/Thorium/releases/latest | grep -oP '(?<=browser_download_url": ")[^"]*\.rpm')
|
url=$(curl -s https://api.github.com/repos/Alex313031/Thorium/releases/latest | grep -oP '(?<=browser_download_url": ")[^"]*\.rpm')
|
||||||
echo $url && curl -L $url -o thorium-latest.rpm
|
echo "$url" && curl -L "$url" -o thorium-latest.rpm
|
||||||
"$ESCALATION_TOOL" rpm -i thorium-latest.rpm && rm thorium-latest.rpm
|
"$ESCALATION_TOOL" rpm -i thorium-latest.rpm && rm thorium-latest.rpm
|
||||||
;;
|
;;
|
||||||
pacman)
|
pacman)
|
||||||
"$AUR_HELPER" -S --needed --noconfirm thorium-browser-bin
|
"$AUR_HELPER" -S --needed --noconfirm thorium-browser-bin
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install Thorium manually.${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -76,7 +75,8 @@ install_firefox() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox
|
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -117,7 +117,7 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
|
||||||
"$AUR_HELPER" -S --needed --noconfirm librewolf-bin
|
"$AUR_HELPER" -S --needed --noconfirm librewolf-bin
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install Librewolf manually.${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -152,7 +152,8 @@ install_brave() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
|
"$ESCALATION_TOOL" "$PACKAGER" install -y brave-browser
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -189,7 +190,8 @@ install_chromium() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium
|
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -227,7 +229,7 @@ browserSetup() {
|
||||||
printf "%b\n" "7. Thorium"
|
printf "%b\n" "7. Thorium"
|
||||||
printf "%b\n" "8. Lynx"
|
printf "%b\n" "8. Lynx"
|
||||||
printf "%b\n" "----------------------------"
|
printf "%b\n" "----------------------------"
|
||||||
printf "%b\n" "Enter your choices (e.g., 1 3 5): "
|
printf "%b" "Enter your choices (e.g. 1 3 5): "
|
||||||
read -r choice
|
read -r choice
|
||||||
for ch in $choice; do
|
for ch in $choice; do
|
||||||
case $ch in
|
case $ch in
|
||||||
|
|
|
@ -16,7 +16,7 @@ setupDWM() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel unzip flameshot lxappearance feh # no need to include git here as it should be already installed via "Development Tools"
|
"$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel unzip flameshot lxappearance feh # no need to include git here as it should be already installed via "Development 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
|
||||||
|
|
|
@ -27,7 +27,7 @@ installLinutil() {
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}There are no official packages for your distro.${RC}"
|
printf "%b\n" "${RED}There are no official packages for your distro.${RC}"
|
||||||
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N) ${RC}"
|
printf "%b" "${YELLOW}Do you want to install the crates.io package? (y/N): ${RC}"
|
||||||
read -r choice
|
read -r choice
|
||||||
case $choice in
|
case $choice in
|
||||||
y|Y)
|
y|Y)
|
||||||
|
|
|
@ -21,7 +21,7 @@ installDepend() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original mybash-setup-script.
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -18,7 +18,8 @@ install_onlyoffice() {
|
||||||
"$AUR_HELPER" -S --needed --noconfirm onlyoffice
|
"$AUR_HELPER" -S --needed --noconfirm onlyoffice
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -41,7 +42,7 @@ install_libreoffice() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install Thorium manually.${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -88,7 +89,8 @@ install_freeoffice() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y softmaker-freeoffice-2024
|
"$ESCALATION_TOOL" "$PACKAGER" install -y softmaker-freeoffice-2024
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}The script does not support your Distro. Install manually..${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -174,7 +176,7 @@ officeSuiteSetup() {
|
||||||
printf "%b\n" "7. PDF Studio Viewer"
|
printf "%b\n" "7. PDF Studio Viewer"
|
||||||
printf "%b\n" "8. PDF Studio (Paid Software)"
|
printf "%b\n" "8. PDF Studio (Paid Software)"
|
||||||
printf "%b\n" "----------------------------"
|
printf "%b\n" "----------------------------"
|
||||||
printf "%b\n" "Enter your choices (e.g., 1 3 5): "
|
printf "%b" "Enter your choices (e.g., 1 3 5): "
|
||||||
read -r choice
|
read -r choice
|
||||||
for ch in $choice; do
|
for ch in $choice; do
|
||||||
case $ch in
|
case $ch in
|
||||||
|
|
|
@ -41,7 +41,7 @@ setup_flatpak() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -S flatpak
|
"$ESCALATION_TOOL" "$PACKAGER" install -S flatpak
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -50,7 +50,7 @@ setup_flatpak() {
|
||||||
else
|
else
|
||||||
if command -v flatpak >/dev/null 2>&1; then
|
if command -v flatpak >/dev/null 2>&1; then
|
||||||
if ! flatpak remotes | grep -q "flathub"; then
|
if ! flatpak remotes | grep -q "flathub"; then
|
||||||
printf "%b\n" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/n)${RC}"
|
printf "%b" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/N): ${RC}"
|
||||||
read -r add_remote
|
read -r add_remote
|
||||||
case "$add_remote" in
|
case "$add_remote" in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
|
@ -70,14 +70,14 @@ setup_flatpak() {
|
||||||
# Only used for Ubuntu GNOME. Ubuntu GNOME doesnt allow flathub to be added as a remote to their store.
|
# Only used for Ubuntu GNOME. Ubuntu GNOME doesnt allow flathub to be added as a remote to their store.
|
||||||
# So in case the user wants to use a GUI siftware manager they can setup it here
|
# So in case the user wants to use a GUI siftware manager they can setup it here
|
||||||
if [ "$DE" = "GNOME" ]; then
|
if [ "$DE" = "GNOME" ]; then
|
||||||
printf "%b\n" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/n)${RC}"
|
printf "%b" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/N): ${RC}"
|
||||||
read -r install_gnome
|
read -r install_gnome
|
||||||
if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then
|
if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak
|
"$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak
|
||||||
fi
|
fi
|
||||||
# Useful for Debian KDE spin as well
|
# Useful for Debian KDE spin as well
|
||||||
elif [ "$DE" = "KDE" ]; then
|
elif [ "$DE" = "KDE" ]; then
|
||||||
printf "%b\n" "${YELLOW}Detected KDE desktop environment. Would you like to install KDE Plasma Discover backend for Flatpak? (y/n)${RC}"
|
printf "%b" "${YELLOW}Detected KDE desktop environment. Would you like to install KDE Plasma Discover backend for Flatpak? (y/N): ${RC}"
|
||||||
read -r install_kde
|
read -r install_kde
|
||||||
if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then
|
if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak
|
"$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak
|
||||||
|
|
|
@ -44,7 +44,7 @@ RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
|
||||||
echo 'export ZDOTDIR="$HOME/.config/zsh"' | "$ESCALATION_TOOL" tee -a /etc/zsh/zshenv
|
echo "export ZDOTDIR=\"$HOME/.config/zsh\"" | "$ESCALATION_TOOL" tee -a /etc/zsh/zshenv
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
|
@ -5,22 +5,22 @@
|
||||||
# Check for required commands
|
# Check for required commands
|
||||||
for cmd in find curl unzip stty; do
|
for cmd in find curl unzip stty; do
|
||||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
printf "%s\n" "Error: $cmd is not installed."
|
printf "%b\n" "Error: $cmd is not installed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Search for possible Diablo II Resurrected folder locations
|
# Search for possible Diablo II Resurrected folder locations
|
||||||
printf "%s\n" "Searching for Diablo II Resurrected folders..."
|
printf "%b\n" "Searching for Diablo II Resurrected folders..."
|
||||||
possible_paths=$(find "$HOME" -type d -path "*/drive_c/Program Files (x86)/Diablo II Resurrected" 2>/dev/null)
|
possible_paths=$(find "$HOME" -type d -path "*/drive_c/Program Files (x86)/Diablo II Resurrected" 2>/dev/null)
|
||||||
|
|
||||||
if [ -z "$possible_paths" ]; then
|
if [ -z "$possible_paths" ]; then
|
||||||
printf "%s\n" "Error: No Diablo II Resurrected folders found."
|
printf "%b\n" "Error: No Diablo II Resurrected folders found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display possible paths and allow selection
|
# Display possible paths and allow selection
|
||||||
printf "%s\n" "Possible Diablo II Resurrected folder locations:"
|
printf "%b\n" "Possible Diablo II Resurrected folder locations:"
|
||||||
paths_string=""
|
paths_string=""
|
||||||
i=0
|
i=0
|
||||||
IFS='
|
IFS='
|
||||||
|
@ -42,7 +42,7 @@ print_menu() {
|
||||||
if [ $((start + max_display)) -gt $total ]; then start=$((total - max_display)); fi
|
if [ $((start + max_display)) -gt $total ]; then start=$((total - max_display)); fi
|
||||||
if [ $start -lt 0 ]; then start=0; fi
|
if [ $start -lt 0 ]; then start=0; fi
|
||||||
|
|
||||||
printf "%s\n" "Please select the Diablo II: Resurrected installation path:"
|
printf "%b\n" "Please select the Diablo II: Resurrected installation path:"
|
||||||
i=0
|
i=0
|
||||||
echo "$paths_string" | tr '|' '\n' | while IFS= read -r path; do
|
echo "$paths_string" | tr '|' '\n' | while IFS= read -r path; do
|
||||||
if [ $i -ge $start ] && [ $i -lt $((start + max_display)) ]; then
|
if [ $i -ge $start ] && [ $i -lt $((start + max_display)) ]; then
|
||||||
|
@ -95,7 +95,7 @@ select_path
|
||||||
|
|
||||||
# Validate the path
|
# Validate the path
|
||||||
if [ ! -d "$d2r_path" ]; then
|
if [ ! -d "$d2r_path" ]; then
|
||||||
printf "%s\n" "Error: The specified path does not exist."
|
printf "%b\n" "Error: The specified path does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -104,29 +104,29 @@ mods_path="$d2r_path/mods"
|
||||||
mkdir -p "$mods_path"
|
mkdir -p "$mods_path"
|
||||||
|
|
||||||
# Download the latest release
|
# Download the latest release
|
||||||
printf "%s\n" "Downloading the latest loot filter..."
|
printf "%b\n" "Downloading the latest loot filter..."
|
||||||
if ! curl -sSLo /tmp/lootfilter.zip https://github.com/ChrisTitusTech/d2r-loot-filter/releases/latest/download/lootfilter.zip; then
|
if ! curl -sSLo /tmp/lootfilter.zip https://github.com/ChrisTitusTech/d2r-loot-filter/releases/latest/download/lootfilter.zip; then
|
||||||
printf "%s\n" "Error: Failed to download the loot filter."
|
printf "%b\n" "Error: Failed to download the loot filter."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the contents to the mods folder
|
# Extract the contents to the mods folder
|
||||||
printf "%s\n" "Extracting loot filter to $mods_path..."
|
printf "%b\n" "Extracting loot filter to $mods_path..."
|
||||||
if ! unzip -q -o /tmp/lootfilter.zip -d "$mods_path"; then
|
if ! unzip -q -o /tmp/lootfilter.zip -d "$mods_path"; then
|
||||||
printf "%s\n" "Error: Failed to extract the loot filter."
|
printf "%b\n" "Error: Failed to extract the loot filter."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm /tmp/lootfilter.zip
|
rm /tmp/lootfilter.zip
|
||||||
|
|
||||||
printf "%s\n" "Loot filter installed successfully in $mods_path"
|
printf "%b\n" "Loot filter installed successfully in $mods_path"
|
||||||
|
|
||||||
printf "\nTo complete the setup, please follow these steps to add launch options in Battle.net:\n"
|
printf "%b\n" "To complete the setup, please follow these steps to add launch options in Battle.net:"
|
||||||
printf "1. Open the Battle.net launcher\n"
|
printf "%b\n" "1. Open the Battle.net launcher"
|
||||||
printf "2. Select Diablo II: Resurrected\n"
|
printf "%b\n" "2. Select Diablo II: Resurrected"
|
||||||
printf "3. Click the gear icon next to the 'Play' button\n"
|
printf "%b\n" "3. Click the gear icon next to the 'Play' button"
|
||||||
printf "4. Select 'Game Settings'\n"
|
printf "%b\n" "4. Select 'Game Settings'"
|
||||||
printf "5. In the 'Additional command line arguments' field, enter: -mod lootfilter -txt\n"
|
printf "%b\n" "5. In the 'Additional command line arguments' field, enter: -mod lootfilter -txt"
|
||||||
printf "6. Click 'Done' to save the changes\n"
|
printf "%b\n" "6. Click 'Done' to save the changes"
|
||||||
printf "\nAfter completing these steps, launch Diablo II: Resurrected through Battle.net to use the loot filter.\n"
|
printf "%b\n" "After completing these steps, launch Diablo II: Resurrected through Battle.net to use the loot filter."
|
|
@ -16,7 +16,7 @@ installDepend() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ installDepend() {
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ installDepend() {
|
||||||
"$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'
|
||||||
|
@ -34,11 +34,11 @@ installDepend() {
|
||||||
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
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
|
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ install_docker() {
|
||||||
"$ESCALATION_TOOL" systemctl start docker
|
"$ESCALATION_TOOL" systemctl start docker
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "${RED}Unsupported package manager. Please install Docker manually.${RC}\n"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -56,7 +56,7 @@ install_docker_compose() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm docker-compose
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "${RED}Unsupported package manager. Please install Docker Compose manually.${RC}\n"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -68,7 +68,7 @@ installDriver() {
|
||||||
|
|
||||||
# NOTE: A confirmation option to proceed or not
|
# NOTE: A confirmation option to proceed or not
|
||||||
userConfirmation() {
|
userConfirmation() {
|
||||||
printf "%b" "${YELLOW}Do you want to continue? (Y/N): ${RC}"
|
printf "%b" "${YELLOW}Do you want to continue? (y/N): ${RC}"
|
||||||
read -r choice
|
read -r choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
y | Y)
|
y | Y)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
. ../common-script.sh
|
. ../common-script.sh
|
||||||
|
|
||||||
install_theme_tools() {
|
install_theme_tools() {
|
||||||
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
|
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
apt-get|nala)
|
apt-get|nala)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
|
||||||
|
@ -18,14 +18,14 @@ install_theme_tools() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_qt6ct() {
|
configure_qt6ct() {
|
||||||
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}\n"
|
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}"
|
||||||
mkdir -p "$HOME/.config/qt6ct"
|
mkdir -p "$HOME/.config/qt6ct"
|
||||||
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf"
|
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf"
|
||||||
[Appearance]
|
[Appearance]
|
||||||
|
@ -33,15 +33,15 @@ style=kvantum
|
||||||
color_scheme=default
|
color_scheme=default
|
||||||
icon_theme=breeze
|
icon_theme=breeze
|
||||||
EOF
|
EOF
|
||||||
printf "%b\n" "${GREEN}qt6ct configured successfully.${RC}\n"
|
printf "%b\n" "${GREEN}qt6ct configured successfully.${RC}"
|
||||||
|
|
||||||
# Add QT_QPA_PLATFORMTHEME to /etc/environment
|
# Add QT_QPA_PLATFORMTHEME to /etc/environment
|
||||||
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
|
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
|
||||||
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n"
|
printf "%b\n" "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}"
|
||||||
echo "QT_QPA_PLATFORMTHEME=qt6ct" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null
|
echo "QT_QPA_PLATFORMTHEME=qt6ct" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null
|
||||||
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n"
|
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}"
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
|
printf "%b\n" "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ configure_kvantum() {
|
||||||
[General]
|
[General]
|
||||||
theme=Breeze
|
theme=Breeze
|
||||||
EOF
|
EOF
|
||||||
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}\n"
|
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
|
@ -20,7 +20,8 @@ removeSnaps() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
"$ESCALATION_TOOL" "$PACKAGER" remove snapd
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ setup_ssh_samba(){
|
||||||
printf "4. Setup All\n"
|
printf "4. Setup All\n"
|
||||||
printf "5. Exit\n"
|
printf "5. Exit\n"
|
||||||
|
|
||||||
printf "Enter your choice [1-5]: "
|
printf "%b" "Enter your choice (1-5): "
|
||||||
read CHOICE
|
read CHOICE
|
||||||
|
|
||||||
case "$CHOICE" in
|
case "$CHOICE" in
|
||||||
|
|
|
@ -26,7 +26,7 @@ cleanup_system() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm
|
"$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -15,7 +15,7 @@ list_sessions() {
|
||||||
printf "%b\n" "8) Openbox (openbox.desktop)"
|
printf "%b\n" "8) Openbox (openbox.desktop)"
|
||||||
printf "%b\n" "9) i3 (i3.desktop)"
|
printf "%b\n" "9) i3 (i3.desktop)"
|
||||||
printf "%b\n" "10) Custom session"
|
printf "%b\n" "10) Custom session"
|
||||||
printf "%b\n" "Enter your choice [1-10]: "
|
printf "%b" "Enter your choice (1-10): "
|
||||||
read -r session_choice
|
read -r session_choice
|
||||||
|
|
||||||
case "$session_choice" in
|
case "$session_choice" in
|
||||||
|
@ -29,7 +29,7 @@ list_sessions() {
|
||||||
8) session="openbox.desktop" ;;
|
8) session="openbox.desktop" ;;
|
||||||
9) session="i3.desktop" ;;
|
9) session="i3.desktop" ;;
|
||||||
10)
|
10)
|
||||||
printf "%b\n" "Enter custom session name (e.g., mysession.desktop): "
|
printf "%b" "Enter custom session name (e.g., mysession.desktop): "
|
||||||
read -r session ;;
|
read -r session ;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "Invalid option selected."
|
printf "%b\n" "Invalid option selected."
|
||||||
|
@ -40,7 +40,7 @@ list_sessions() {
|
||||||
# Function to configure LightDM
|
# Function to configure LightDM
|
||||||
configure_lightdm() {
|
configure_lightdm() {
|
||||||
printf "%b\n" "Configuring LightDM for autologin..."
|
printf "%b\n" "Configuring LightDM for autologin..."
|
||||||
printf "%b\n" "Enter username for LightDM autologin: "
|
printf "%b" "Enter username for LightDM autologin: "
|
||||||
read -r user
|
read -r user
|
||||||
|
|
||||||
"$ESCALATION_TOOL" "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
|
"$ESCALATION_TOOL" "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
|
||||||
|
@ -60,7 +60,7 @@ remove_lightdm_autologin() {
|
||||||
# Function to configure GDM
|
# Function to configure GDM
|
||||||
configure_gdm() {
|
configure_gdm() {
|
||||||
printf "%b\n" "Configuring GDM for autologin..."
|
printf "%b\n" "Configuring GDM for autologin..."
|
||||||
printf "%b\n" "Enter username for GDM autologin: "
|
printf "%b" "Enter username for GDM autologin: "
|
||||||
read -r user
|
read -r user
|
||||||
|
|
||||||
"$ESCALATION_TOOL" "printf '[daemon]' > /etc/gdm/custom.conf"
|
"$ESCALATION_TOOL" "printf '[daemon]' > /etc/gdm/custom.conf"
|
||||||
|
@ -81,7 +81,7 @@ remove_gdm_autologin() {
|
||||||
# Function to configure SDDM
|
# Function to configure SDDM
|
||||||
configure_sddm() {
|
configure_sddm() {
|
||||||
printf "%b\n" "Configuring SDDM for autologin..."
|
printf "%b\n" "Configuring SDDM for autologin..."
|
||||||
printf "%b\n" "Enter username for SDDM autologin: "
|
printf "%b" "Enter username for SDDM autologin: "
|
||||||
read -r user
|
read -r user
|
||||||
list_sessions # Show session options
|
list_sessions # Show session options
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ remove_sddm_autologin() {
|
||||||
# Function to configure LXDM
|
# Function to configure LXDM
|
||||||
configure_lxdm() {
|
configure_lxdm() {
|
||||||
printf "%b\n" "Configuring LXDM for autologin..."
|
printf "%b\n" "Configuring LXDM for autologin..."
|
||||||
printf "%b\n" "Enter username for LXDM autologin: "
|
printf "%b" "Enter username for LXDM autologin: "
|
||||||
read -r user
|
read -r user
|
||||||
list_sessions # Show session options
|
list_sessions # Show session options
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ configure_or_remove_autologin() {
|
||||||
printf "%b\n" "Do you want to add or remove autologin?"
|
printf "%b\n" "Do you want to add or remove autologin?"
|
||||||
printf "%b\n" "1) Add autologin"
|
printf "%b\n" "1) Add autologin"
|
||||||
printf "%b\n" "2) Remove autologin"
|
printf "%b\n" "2) Remove autologin"
|
||||||
printf "%b\n" "Enter your choice [1-2]: "
|
printf "%b" "Enter your choice (1-2): "
|
||||||
read -r action_choice
|
read -r action_choice
|
||||||
|
|
||||||
if [ "$action_choice" = "1" ]; then
|
if [ "$action_choice" = "1" ]; then
|
||||||
|
@ -134,7 +134,7 @@ configure_or_remove_autologin() {
|
||||||
printf "%b\n" "2) GDM"
|
printf "%b\n" "2) GDM"
|
||||||
printf "%b\n" "3) SDDM"
|
printf "%b\n" "3) SDDM"
|
||||||
printf "%b\n" "4) LXDM"
|
printf "%b\n" "4) LXDM"
|
||||||
printf "%b\n" "Enter your choice [1-4]: "
|
printf "%b" "Enter your choice (1-4): "
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
|
@ -150,7 +150,7 @@ configure_or_remove_autologin() {
|
||||||
printf "%b\n" "2) GDM"
|
printf "%b\n" "2) GDM"
|
||||||
printf "%b\n" "3) SDDM"
|
printf "%b\n" "3) SDDM"
|
||||||
printf "%b\n" "4) LXDM"
|
printf "%b\n" "4) LXDM"
|
||||||
printf "%b\n" "Enter your choice [1-4]: "
|
printf "%b" "Enter your choice (1-4): "
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
|
|
|
@ -35,13 +35,13 @@ main_menu() {
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}Bluetooth Manager${RC}"
|
printf "%b\n" "${YELLOW}Bluetooth Manager${RC}"
|
||||||
printf "%b\n" "${YELLOW}=================${RC}"
|
printf "%b\n" "${YELLOW}=================${RC}"
|
||||||
printf "1. Scan for devices\n"
|
printf "%b\n" "1. Scan for devices"
|
||||||
printf "2. Pair with a device\n"
|
printf "%b\n" "2. Pair with a device"
|
||||||
printf "3. Connect to a device\n"
|
printf "%b\n" "3. Connect to a device"
|
||||||
printf "4. Disconnect from a device\n"
|
printf "%b\n" "4. Disconnect from a device"
|
||||||
printf "5. Remove a device\n"
|
printf "%b\n" "5. Remove a device"
|
||||||
printf "0. Exit\n"
|
printf "%b\n" "0. Exit"
|
||||||
printf "Choose an option: "
|
printf "%b" "Choose an option: "
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
|
@ -66,9 +66,9 @@ scan_devices() {
|
||||||
printf "%b\n" "${RED}No devices found.${RC}"
|
printf "%b\n" "${RED}No devices found.${RC}"
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Devices found:${RC}"
|
printf "%b\n" "${GREEN}Devices found:${RC}"
|
||||||
printf "%s\n" "$devices"
|
printf "%b\n" "$devices"
|
||||||
fi
|
fi
|
||||||
printf "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 dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ prompt_for_mac() {
|
||||||
devices=$(bluetoothctl devices)
|
devices=$(bluetoothctl devices)
|
||||||
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 "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 dummy
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -97,8 +97,8 @@ prompt_for_mac() {
|
||||||
printf "%d. %s\n" "$i" "$device"
|
printf "%d. %s\n" "$i" "$device"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
printf "0. Exit to main menu\n"
|
printf "%b\n" "0. Exit to main menu"
|
||||||
printf "%s\n" "$prompt_msg"
|
printf "%b\n" "$prompt_msg"
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
# Validate the choice
|
# Validate the choice
|
||||||
|
@ -106,7 +106,7 @@ 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" && {
|
bluetoothctl "$command" "$mac" && {
|
||||||
printf "%b\n" "${GREEN}$success_msg${RC}"
|
printf "%b\n" "${GREEN}$success_msg${RC}"
|
||||||
break
|
break
|
||||||
} || {
|
} || {
|
||||||
|
@ -121,7 +121,7 @@ prompt_for_mac() {
|
||||||
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf "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 dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ fetch_arch_older_isos() {
|
||||||
COUNTER=$((COUNTER + 1))
|
COUNTER=$((COUNTER + 1))
|
||||||
done
|
done
|
||||||
printf "\n" # New line after the last row
|
printf "\n" # New line after the last row
|
||||||
printf "Select an Arch Linux version (1-%d): " "$((COUNTER - 1))"
|
printf "%b" "Select an Arch Linux version (1-$((COUNTER - 1))): "
|
||||||
read -r ARCH_OPTION
|
read -r ARCH_OPTION
|
||||||
ARCH_DIR=$(echo "$ARCH_VERSIONS" | sed -n "${ARCH_OPTION}p")
|
ARCH_DIR=$(echo "$ARCH_VERSIONS" | sed -n "${ARCH_OPTION}p")
|
||||||
ARCH_URL="${ARCH_BASE_URL}${ARCH_DIR}/archlinux-${ARCH_DIR}-x86_64.iso"
|
ARCH_URL="${ARCH_BASE_URL}${ARCH_DIR}/archlinux-${ARCH_DIR}-x86_64.iso"
|
||||||
|
@ -72,7 +72,7 @@ choose_iso_source() {
|
||||||
printf "1) Download online\n"
|
printf "1) Download online\n"
|
||||||
printf "2) Use local ISO\n"
|
printf "2) Use local ISO\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "Select option (1-2): "
|
printf "%b" "Select option (1-2): "
|
||||||
read -r ISO_SOURCE_OPTION
|
read -r ISO_SOURCE_OPTION
|
||||||
|
|
||||||
case $ISO_SOURCE_OPTION in
|
case $ISO_SOURCE_OPTION in
|
||||||
|
@ -102,7 +102,7 @@ fetch_iso_urls() {
|
||||||
printf "%b\n" "2) Arch Linux (older versions)"
|
printf "%b\n" "2) Arch Linux (older versions)"
|
||||||
printf "%b\n" "3) Debian Linux (latest)"
|
printf "%b\n" "3) Debian Linux (latest)"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "Select the ISO you want to download (1-3): "
|
printf "%b" "Select the ISO you want to download (1-3): "
|
||||||
read -r ISO_OPTION
|
read -r ISO_OPTION
|
||||||
|
|
||||||
case $ISO_OPTION in
|
case $ISO_OPTION in
|
||||||
|
@ -144,7 +144,7 @@ write_iso(){
|
||||||
list_devices
|
list_devices
|
||||||
|
|
||||||
# Prompt user for USB device
|
# Prompt user for USB device
|
||||||
printf "Enter the USB device (e.g., /dev/sdX): "
|
printf "%b" "Enter the USB device (e.g. /dev/sdX): "
|
||||||
read -r USB_DEVICE
|
read -r USB_DEVICE
|
||||||
|
|
||||||
# Verify that the USB device exists
|
# Verify that the USB device exists
|
||||||
|
@ -154,7 +154,7 @@ write_iso(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirm the device selection with the user
|
# Confirm the device selection with the user
|
||||||
printf "%b\n" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (yes/no)${RC}"
|
printf "%b" "${RED}WARNING: This will erase all data on ${USB_DEVICE}. Are you sure you want to continue? (y/N): ${RC}"
|
||||||
read -r CONFIRMATION
|
read -r CONFIRMATION
|
||||||
|
|
||||||
if [ "$CONFIRMATION" != "yes" ]; then
|
if [ "$CONFIRMATION" != "yes" ]; then
|
||||||
|
|
|
@ -20,9 +20,8 @@ if ! command_exists openssl; then
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install openssl
|
"$ESCALATION_TOOL" "$PACKAGER" install openssl
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Your Linux distribution is not supported by this script.${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
printf "%b\n" "${YELLOW}You can try installing OpenSSL manually:${RC}"
|
exit 1
|
||||||
printf "%b\n" "1. Refer to your distribution's documentation."
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +42,7 @@ show_menu() {
|
||||||
|
|
||||||
# Function to encrypt a file
|
# Function to encrypt a file
|
||||||
encrypt_file() {
|
encrypt_file() {
|
||||||
printf "%b\n" "Enter the path to the file or directory to encrypt:"
|
printf "%b" "Enter the path to the file or directory to encrypt: "
|
||||||
read -r INPUT_PATH
|
read -r INPUT_PATH
|
||||||
|
|
||||||
if [ ! -e "$INPUT_PATH" ]; then
|
if [ ! -e "$INPUT_PATH" ]; then
|
||||||
|
@ -51,10 +50,10 @@ encrypt_file() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b\n" "Enter the path for the encrypted file or directory:"
|
printf "%b" "Enter the path for the encrypted file or directory: "
|
||||||
read -r OUTPUT_PATH
|
read -r OUTPUT_PATH
|
||||||
|
|
||||||
printf "%b\n" "Enter the encryption password: "
|
printf "%b" "Enter the encryption password: "
|
||||||
read -r PASSWORD
|
read -r PASSWORD
|
||||||
|
|
||||||
if [ -d "$INPUT_PATH" ]; then
|
if [ -d "$INPUT_PATH" ]; then
|
||||||
|
@ -88,7 +87,7 @@ encrypt_file() {
|
||||||
|
|
||||||
# Function to decrypt a file
|
# Function to decrypt a file
|
||||||
decrypt_file() {
|
decrypt_file() {
|
||||||
printf "%b\n" "Enter the path to the file or directory to decrypt:"
|
printf "%b" "Enter the path to the file or directory to decrypt: "
|
||||||
read -r INPUT_PATH
|
read -r INPUT_PATH
|
||||||
|
|
||||||
if [ ! -e "$INPUT_PATH" ]; then
|
if [ ! -e "$INPUT_PATH" ]; then
|
||||||
|
@ -96,10 +95,10 @@ decrypt_file() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b\n" "Enter the path for the decrypted file or directory:"
|
printf "%b" "Enter the path for the decrypted file or directory: "
|
||||||
read -r OUTPUT_PATH
|
read -r OUTPUT_PATH
|
||||||
|
|
||||||
printf "%b\n" "Enter the decryption password: "
|
printf "%b" "Enter the decryption password: "
|
||||||
read -r PASSWORD
|
read -r PASSWORD
|
||||||
|
|
||||||
if [ -d "$INPUT_PATH" ]; then
|
if [ -d "$INPUT_PATH" ]; then
|
||||||
|
@ -135,7 +134,7 @@ main(){
|
||||||
clear
|
clear
|
||||||
while true; do
|
while true; do
|
||||||
show_menu
|
show_menu
|
||||||
printf "%b\n" "Enter your choice:"
|
printf "%b" "Enter your choice: "
|
||||||
read -r CHOICE
|
read -r CHOICE
|
||||||
|
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
|
|
|
@ -18,8 +18,8 @@ auto_detect_displays() {
|
||||||
temp_common_resolutions=$(mktemp)
|
temp_common_resolutions=$(mktemp)
|
||||||
temp_resolutions=$(mktemp)
|
temp_resolutions=$(mktemp)
|
||||||
|
|
||||||
printf "%s" "$common_resolutions" > "$temp_common_resolutions"
|
printf "%b\n" "$common_resolutions" > "$temp_common_resolutions"
|
||||||
printf "%s" "$resolutions" > "$temp_resolutions"
|
printf "%b\n" "$resolutions" > "$temp_resolutions"
|
||||||
|
|
||||||
common_resolutions=$(comm -12 "$temp_common_resolutions" "$temp_resolutions")
|
common_resolutions=$(comm -12 "$temp_common_resolutions" "$temp_resolutions")
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ change_orientation() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
printf "%b\n" "${YELLOW} Change Monitor Orientation${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW}Choose a monitor to configure:${RC}"
|
printf "%b" "${YELLOW}Choose a monitor to configure: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the monitor: "
|
printf "%b" "Enter the number of the monitor: "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
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
|
||||||
|
@ -40,7 +40,7 @@ change_orientation() {
|
||||||
printf "%b\n" "3. ${GREEN}Right${RC}"
|
printf "%b\n" "3. ${GREEN}Right${RC}"
|
||||||
printf "%b\n" "4. ${GREEN}Inverted${RC}"
|
printf "%b\n" "4. ${GREEN}Inverted${RC}"
|
||||||
|
|
||||||
printf "Enter the number of the orientation: "
|
printf "%b" "Enter the number of the orientation: "
|
||||||
read -r orientation_choice
|
read -r orientation_choice
|
||||||
case $orientation_choice in
|
case $orientation_choice in
|
||||||
1) orientation="normal" ;;
|
1) orientation="normal" ;;
|
||||||
|
|
|
@ -13,14 +13,14 @@ disable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "Choose a monitor to disable:"
|
printf "%b" "Choose a monitor to disable: "
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "%b\n" "Enter the number of the monitor: "
|
printf "%b" "Enter the number of the monitor: "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
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
|
||||||
|
@ -45,7 +45,7 @@ disable_monitor() {
|
||||||
confirm_action() {
|
confirm_action() {
|
||||||
action="$1"
|
action="$1"
|
||||||
printf "%b\n" "${YELLOW}$action${RC}"
|
printf "%b\n" "${YELLOW}$action${RC}"
|
||||||
printf "%b\n" "Are you sure? (y/n): "
|
printf "%b" "Are you sure? (y/N): "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -13,7 +13,7 @@ enable_monitor() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
printf "%b\n" "${YELLOW} Enable Monitor${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW}Choose a monitor to enable:${RC}"
|
printf "%b" "${YELLOW}Choose a monitor to enable: ${RC}"
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
|
@ -21,7 +21,7 @@ enable_monitor() {
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the monitor: "
|
printf "%b" "Enter the number of the monitor: "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -13,14 +13,14 @@ manage_arrangement() {
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
printf "%b\n" "${YELLOW} Manage Monitor Arrangement${RC}"
|
||||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||||
printf "%b\n" "${YELLOW}Choose the monitor to arrange:${RC}"
|
printf "%b" "${YELLOW}Choose the monitor to arrange: ${RC}"
|
||||||
i=1
|
i=1
|
||||||
for monitor in $monitor_array; do
|
for monitor in $monitor_array; do
|
||||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the monitor to arrange: "
|
printf "%b" "Enter the number of the monitor to arrange: "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
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
|
||||||
|
@ -31,13 +31,13 @@ manage_arrangement() {
|
||||||
monitor_name=$(echo "$monitor_array" | cut -d' ' -f"$monitor_choice")
|
monitor_name=$(echo "$monitor_array" | cut -d' ' -f"$monitor_choice")
|
||||||
|
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}Choose position relative to other monitors:${RC}"
|
printf "%b" "${YELLOW}Choose position relative to other monitors: ${RC}"
|
||||||
printf "%b\n" "1. ${YELLOW}Left of${RC}"
|
printf "%b\n" "1. ${YELLOW}Left of${RC}"
|
||||||
printf "%b\n" "2. ${YELLOW}Right of${RC}"
|
printf "%b\n" "2. ${YELLOW}Right of${RC}"
|
||||||
printf "%b\n" "3. ${YELLOW}Above${RC}"
|
printf "%b\n" "3. ${YELLOW}Above${RC}"
|
||||||
printf "%b\n" "4. ${YELLOW}Below${RC}"
|
printf "%b\n" "4. ${YELLOW}Below${RC}"
|
||||||
|
|
||||||
printf "Enter the number of the position: "
|
printf "%b" "Enter the number of the position: "
|
||||||
read -r position_choice
|
read -r position_choice
|
||||||
|
|
||||||
case $position_choice in
|
case $position_choice in
|
||||||
|
@ -55,7 +55,7 @@ manage_arrangement() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the reference monitor: "
|
printf "%b" "Enter the number of the reference monitor: "
|
||||||
read -r ref_choice
|
read -r ref_choice
|
||||||
|
|
||||||
if ! echo "$ref_choice" | grep -qE '^[0-9]+$' || [ "$ref_choice" -lt 1 ] || [ "$ref_choice" -gt "$((i - 1))" ] || [ "$ref_choice" -eq "$monitor_choice" ]; then
|
if ! echo "$ref_choice" | grep -qE '^[0-9]+$' || [ "$ref_choice" -lt 1 ] || [ "$ref_choice" -gt "$((i - 1))" ] || [ "$ref_choice" -eq "$monitor_choice" ]; then
|
||||||
|
|
|
@ -7,7 +7,7 @@ adjust_monitor_brightness() {
|
||||||
while true; do
|
while true; do
|
||||||
monitor_list=$(detect_connected_monitors)
|
monitor_list=$(detect_connected_monitors)
|
||||||
monitor_array=$(echo "$monitor_list" | tr '\n' ' ')
|
monitor_array=$(echo "$monitor_list" | tr '\n' ' ')
|
||||||
set -- $monitor_array
|
set -- "$monitor_array"
|
||||||
count=1
|
count=1
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -20,7 +20,7 @@ adjust_monitor_brightness() {
|
||||||
count=$((count + 1))
|
count=$((count + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the monitor (or 'q' to quit): "
|
printf "%b" "Enter the number of the monitor (or 'q' to quit): "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
if [ "$monitor_choice" = "q" ]; then
|
if [ "$monitor_choice" = "q" ]; then
|
||||||
|
@ -50,7 +50,7 @@ adjust_monitor_brightness() {
|
||||||
printf "%b\n" "${YELLOW}Current brightness for $monitor_name${RC}: ${GREEN}$current_brightness_percentage%${RC}"
|
printf "%b\n" "${YELLOW}Current brightness for $monitor_name${RC}: ${GREEN}$current_brightness_percentage%${RC}"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
printf "Enter the new brightness value as a percentage (10 to 100, or 'q' to quit): "
|
printf "%b" "Enter the new brightness value as a percentage (10 to 100, or 'q' to quit): "
|
||||||
read -r new_brightness_percentage
|
read -r new_brightness_percentage
|
||||||
|
|
||||||
if [ "$new_brightness_percentage" = "q" ]; then
|
if [ "$new_brightness_percentage" = "q" ]; then
|
||||||
|
@ -67,7 +67,7 @@ adjust_monitor_brightness() {
|
||||||
# Convert percentage to xrandr brightness value (10% to 0.10)
|
# Convert percentage to xrandr brightness value (10% to 0.10)
|
||||||
new_brightness=$(awk "BEGIN {printf \"%.2f\", $new_brightness_percentage / 100}")
|
new_brightness=$(awk "BEGIN {printf \"%.2f\", $new_brightness_percentage / 100}")
|
||||||
|
|
||||||
printf "Set brightness for $monitor_name to $new_brightness_percentage%? (y/n): "
|
printf "%b" "Set brightness for $monitor_name to $new_brightness_percentage%? (y/N): "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
||||||
printf "%b\n" "${GREEN}Setting brightness for $monitor_name to $new_brightness_percentage%${RC}"
|
printf "%b\n" "${GREEN}Setting brightness for $monitor_name to $new_brightness_percentage%${RC}"
|
||||||
|
|
|
@ -20,7 +20,7 @@ set_primary_monitor() {
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the number of the monitor to arrange: "
|
printf "%b" "Enter the number of the monitor to arrange: "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -22,7 +22,7 @@ set_resolutions() {
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "%b\n" "Enter the choice (or 'q' to quit): "
|
printf "%b" "Enter the choice (or 'q' to quit): "
|
||||||
read -r monitor_choice
|
read -r monitor_choice
|
||||||
|
|
||||||
if [ "$monitor_choice" = "q" ]; then
|
if [ "$monitor_choice" = "q" ]; then
|
||||||
|
@ -56,7 +56,7 @@ set_resolutions() {
|
||||||
awk '{print $1 ". " $2}' "$temp_res_file"
|
awk '{print $1 ". " $2}' "$temp_res_file"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
printf "%b\n" "Enter the choice (or 'q' to quit): "
|
printf "%b" "Enter the choice (or 'q' to quit): "
|
||||||
read -r resolution_choice
|
read -r resolution_choice
|
||||||
|
|
||||||
if [ "$resolution_choice" = "q" ]; then
|
if [ "$resolution_choice" = "q" ]; then
|
||||||
|
@ -72,7 +72,7 @@ set_resolutions() {
|
||||||
|
|
||||||
selected_resolution=$(awk "NR==$resolution_choice" "$temp_res_file")
|
selected_resolution=$(awk "NR==$resolution_choice" "$temp_res_file")
|
||||||
|
|
||||||
printf "%b\n" "Set resolution for $monitor_name to $selected_resolution? (y/n): "
|
printf "%b" "Set resolution for $monitor_name to $selected_resolution? (y/N): "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||||
printf "%b\n" "${GREEN}Setting resolution for $monitor_name to $selected_resolution${RC}"
|
printf "%b\n" "${GREEN}Setting resolution for $monitor_name to $selected_resolution${RC}"
|
||||||
|
|
|
@ -48,7 +48,7 @@ numlockSetup() {
|
||||||
create_service
|
create_service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%b\n" "Do you want to enable Numlock on boot? (y/n): "
|
printf "%b" "Do you want to enable Numlock on boot? (y/N): "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
||||||
"$ESCALATION_TOOL" systemctl enable numlock.service --quiet
|
"$ESCALATION_TOOL" systemctl enable numlock.service --quiet
|
||||||
|
|
|
@ -24,7 +24,7 @@ list_models() {
|
||||||
show_model_info() {
|
show_model_info() {
|
||||||
clear
|
clear
|
||||||
list_models
|
list_models
|
||||||
printf "%b\n" "${YELLOW}Enter the name of the model you want to show information for (e.g., llama3.1):${RC}"
|
printf "%b" "Enter the name of the model you want to show information for (e.g., llama3.1): "
|
||||||
read -r model_name
|
read -r model_name
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Showing information for model '$model_name'...${RC}"
|
printf "%b\n" "${YELLOW}Showing information for model '$model_name'...${RC}"
|
||||||
|
@ -34,22 +34,22 @@ show_model_info() {
|
||||||
display_models() {
|
display_models() {
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${RED}Available Models${RC}"
|
printf "%b\n" "${RED}Available Models${RC}"
|
||||||
printf "1. Llama 3.1 - 8B (4.7GB)\n"
|
printf "%b\n" "1. Llama 3.1 - 8B (4.7GB)"
|
||||||
printf "2. Llama 3.1 - 70B (40GB)\n"
|
printf "%b\n" "2. Llama 3.1 - 70B (40GB)"
|
||||||
printf "3. Llama 3.1 - 405B (231GB)\n"
|
printf "%b\n" "3. Llama 3.1 - 405B (231GB)"
|
||||||
printf "4. Phi 3 Mini - 3.8B (2.3GB)\n"
|
printf "%b\n" "4. Phi 3 Mini - 3.8B (2.3GB)"
|
||||||
printf "5. Phi 3 Medium - 14B (7.9GB)\n"
|
printf "%b\n" "5. Phi 3 Medium - 14B (7.9GB)"
|
||||||
printf "6. Gemma 2 - 2B (1.6GB)\n"
|
printf "%b\n" "6. Gemma 2 - 2B (1.6GB)"
|
||||||
printf "7. Gemma 2 - 9B (5.5GB)\n"
|
printf "%b\n" "7. Gemma 2 - 9B (5.5GB)"
|
||||||
printf "8. Gemma 2 - 27B (16GB)\n"
|
printf "%b\n" "8. Gemma 2 - 27B (16GB)"
|
||||||
printf "9. Mistral - 7B (4.1GB)\n"
|
printf "%b\n" "9. Mistral - 7B (4.1GB)"
|
||||||
printf "10. Moondream 2 - 1.4B (829MB)\n"
|
printf "%b\n" "10. Moondream 2 - 1.4B (829MB)"
|
||||||
printf "11. Neural Chat - 7B (4.1GB)\n"
|
printf "%b\n" "11. Neural Chat - 7B (4.1GB)"
|
||||||
printf "12. Starling - 7B (4.1GB)\n"
|
printf "%b\n" "12. Starling - 7B (4.1GB)"
|
||||||
printf "13. Code Llama - 7B (3.8GB)\n"
|
printf "%b\n" "13. Code Llama - 7B (3.8GB)"
|
||||||
printf "14. Llama 2 Uncensored - 7B (3.8GB)\n"
|
printf "%b\n" "14. Llama 2 Uncensored - 7B (3.8GB)"
|
||||||
printf "15. LLaVA - 7B (4.5GB)\n"
|
printf "%b\n" "15. LLaVA - 7B (4.5GB)"
|
||||||
printf "16. Solar - 10.7B (6.1GB)\n"
|
printf "%b\n" "16. Solar - 10.7B (6.1GB)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to select model based on user input
|
# Function to select model based on user input
|
||||||
|
@ -87,8 +87,8 @@ run_model() {
|
||||||
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" "${YELLOW}Please select a model to run:${RC}"
|
printf "%b" "Select a model to run: "
|
||||||
printf "%b\n" "${YELLOW}Enter the number corresponding to the model or enter the name of a custom model:${RC}"
|
printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: "
|
||||||
|
|
||||||
read -r model_choice
|
read -r model_choice
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ create_model() {
|
||||||
display_models
|
display_models
|
||||||
|
|
||||||
# Prompt for base model
|
# Prompt for base model
|
||||||
printf "%b\n" "${YELLOW}Enter the base model (e.g. '13' for codellama):${RC}"
|
printf "%b" "Enter the base model (e.g. '13' for codellama): "
|
||||||
read -r base_model
|
read -r base_model
|
||||||
|
|
||||||
model=$(select_model "$base_model")
|
model=$(select_model "$base_model")
|
||||||
|
@ -113,11 +113,11 @@ create_model() {
|
||||||
ollama pull "$model"
|
ollama pull "$model"
|
||||||
|
|
||||||
# Prompt for custom model name
|
# Prompt for custom model name
|
||||||
printf "%b\n" "${YELLOW}Enter a name for the new customized model:${RC}"
|
printf "%b" "Enter a name for the new customized model: "
|
||||||
read -r custom_model_name
|
read -r custom_model_name
|
||||||
|
|
||||||
# Prompt for temperature setting
|
# Prompt for temperature setting
|
||||||
printf "%b\n" "${YELLOW}Enter the desired temperature (higher values are more creative, lower values are more coherent, e.g., 1):${RC}"
|
printf "%b" "Enter the desired temperature (higher values are more creative, lower values are more coherent, e.g., 1): "
|
||||||
read -r temperature
|
read -r temperature
|
||||||
|
|
||||||
if [ -z "$temperature" ]; then
|
if [ -z "$temperature" ]; then
|
||||||
|
@ -125,7 +125,7 @@ create_model() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prompt for system message
|
# Prompt for system message
|
||||||
printf "%b\n" "${YELLOW}Enter the system message for the model customization (e.g., 'You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.'):${RC}"
|
printf "%b" "Enter the system message for the model customization (e.g., 'You are Mario from Super Mario Bros. Answer as Mario, the assistant, only.'): "
|
||||||
read -r system_message
|
read -r system_message
|
||||||
|
|
||||||
# Create the Modelfile
|
# Create the Modelfile
|
||||||
|
@ -155,8 +155,8 @@ remove_model() {
|
||||||
installed_models=$(ollama list)
|
installed_models=$(ollama list)
|
||||||
printf "%b\n" "${installed_models}"
|
printf "%b\n" "${installed_models}"
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Please select a model to remove:${RC}"
|
printf "%b" "Please select a model to remove: "
|
||||||
printf "%b\n" "${YELLOW}Enter the name of the model you want to remove:${RC}"
|
printf "%b" "Enter the name of the model you want to remove: "
|
||||||
|
|
||||||
read -r model_to_remove
|
read -r model_to_remove
|
||||||
|
|
||||||
|
@ -174,14 +174,14 @@ menu() {
|
||||||
while true; do
|
while true; do
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}Please select an option:${RC}"
|
printf "%b\n" "${YELLOW}Please select an option:${RC}"
|
||||||
printf "1) List all models\n"
|
printf "%b\n" "1) List all models"
|
||||||
printf "2) Show model information\n"
|
printf "%b\n" "2) Show model information"
|
||||||
printf "3) Create a new model\n"
|
printf "%b\n" "3) Create a new model"
|
||||||
printf "4) Run a model\n"
|
printf "%b\n" "4) Run a model"
|
||||||
printf "5) Remove a model\n"
|
printf "%b\n" "5) Remove a model"
|
||||||
printf "6) Exit\n"
|
printf "%b\n" "6) Exit"
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Enter your choice (1-5): ${RC}"
|
printf "%b" "${YELLOW}Enter your choice (1-5): ${RC}"
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
|
|
|
@ -9,21 +9,21 @@ SCRIPT_DIR="./services"
|
||||||
# Function to show the main menu
|
# Function to show the main menu
|
||||||
show_menu() {
|
show_menu() {
|
||||||
clear
|
clear
|
||||||
printf "============================\n"
|
printf "%b\n" "============================"
|
||||||
printf " Service Management Menu\n"
|
printf "%b\n" "Service Management Menu"
|
||||||
printf "============================\n"
|
printf "%b\n" "============================"
|
||||||
printf "1. View all services\n"
|
printf "%b\n" "1. View all services"
|
||||||
printf "2. View enabled services\n"
|
printf "%b\n" "2. View enabled services"
|
||||||
printf "3. View disabled services\n"
|
printf "%b\n" "3. View disabled services"
|
||||||
printf "4. Add a new service\n"
|
printf "%b\n" "4. Add a new service"
|
||||||
printf "5. Remove a service\n"
|
printf "%b\n" "5. Remove a service"
|
||||||
printf "6. Start a service\n"
|
printf "%b\n" "6. Start a service"
|
||||||
printf "7. Stop a service\n"
|
printf "%b\n" "7. Stop a service"
|
||||||
printf "8. Enable a service\n"
|
printf "%b\n" "8. Enable a service"
|
||||||
printf "9. Disable a service\n"
|
printf "%b\n" "9. Disable a service"
|
||||||
printf "10. Create a service from external scripts\n"
|
printf "%b\n" "10. Create a service from external scripts"
|
||||||
printf "11. Exit\n"
|
printf "%b\n" "11. Exit"
|
||||||
printf "============================\n"
|
printf "%b\n" "============================"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to view all services
|
# Function to view all services
|
||||||
|
@ -53,27 +53,27 @@ view_started_services() {
|
||||||
# Function to add a new service
|
# Function to add a new service
|
||||||
add_service() {
|
add_service() {
|
||||||
while [ -z "$SERVICE_NAME" ]; do
|
while [ -z "$SERVICE_NAME" ]; do
|
||||||
printf "Enter the name of the new service (e.g., my_service):\n"
|
printf "%b" "Enter the name of the new service (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
if "$ESCALATION_TOOL" systemctl list-units --type=service --all --no-legend | grep -q "$SERVICE_NAME.service"; then
|
if "$ESCALATION_TOOL" systemctl list-units --type=service --all --no-legend | grep -q "$SERVICE_NAME.service"; then
|
||||||
printf "Service already exists!\n"
|
printf "%b\n" "${GREEN}Service already exists.${RC}"
|
||||||
SERVICE_NAME=""
|
SERVICE_NAME=""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the description of the service:\n"
|
printf "%b" "Enter the description of the service: "
|
||||||
read -r SERVICE_DESCRIPTION
|
read -r SERVICE_DESCRIPTION
|
||||||
|
|
||||||
printf "Enter the command to execute the service (e.g., /usr/local/bin/my_service.sh):\n"
|
printf "%b" "Enter the command to execute the service (e.g., /usr/local/bin/my_service.sh): "
|
||||||
read -r EXEC_START
|
read -r EXEC_START
|
||||||
|
|
||||||
printf "Enter the user to run the service as (leave empty for default):\n"
|
printf "%b" "Enter the user to run the service as (leave empty for default): "
|
||||||
read -r SERVICE_USER
|
read -r SERVICE_USER
|
||||||
|
|
||||||
printf "Enter the working directory for the service (leave empty for default):\n"
|
printf "%b" "Enter the working directory for the service (leave empty for default): "
|
||||||
read -r WORKING_DIRECTORY
|
read -r WORKING_DIRECTORY
|
||||||
|
|
||||||
printf "Enter the restart policy (e.g., always, on-failure; leave empty for no restart):\n"
|
printf "%b" "Enter the restart policy (e.g., always, on-failure; leave empty for no restart): "
|
||||||
read -r RESTART_POLICY
|
read -r RESTART_POLICY
|
||||||
|
|
||||||
# Create the service unit file
|
# Create the service unit file
|
||||||
|
@ -81,17 +81,17 @@ add_service() {
|
||||||
|
|
||||||
# Create the service file with conditionals for optional fields
|
# Create the service file with conditionals for optional fields
|
||||||
{
|
{
|
||||||
printf "[Unit]\n"
|
printf "%b\n" "[Unit]"
|
||||||
printf "Description=$SERVICE_DESCRIPTION\n"
|
printf "%b\n" "Description=$SERVICE_DESCRIPTION"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "[Service]\n"
|
printf "%b\n" "[Service]"
|
||||||
printf "ExecStart=$EXEC_START\n"
|
printf "%b\n" "ExecStart=$EXEC_START"
|
||||||
[ -n "$SERVICE_USER" ] && printf "%b\n" "User=$SERVICE_USER"
|
[ -n "$SERVICE_USER" ] && printf "%b\n" "User=$SERVICE_USER"
|
||||||
[ -n "$WORKING_DIRECTORY" ] && printf "%b\n" "WorkingDirectory=$WORKING_DIRECTORY"
|
[ -n "$WORKING_DIRECTORY" ] && printf "%b\n" "WorkingDirectory=$WORKING_DIRECTORY"
|
||||||
[ -n "$RESTART_POLICY" ] && printf "%b\n" "Restart=$RESTART_POLICY"
|
[ -n "$RESTART_POLICY" ] && printf "%b\n" "Restart=$RESTART_POLICY"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
printf "[Install]\n"
|
printf "%b\n" "[Install]"
|
||||||
printf "WantedBy=multi-user.target\n"
|
printf "%b\n" "WantedBy=multi-user.target"
|
||||||
} | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null
|
} | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null
|
||||||
|
|
||||||
# Set permissions and reload systemd
|
# Set permissions and reload systemd
|
||||||
|
@ -100,10 +100,10 @@ add_service() {
|
||||||
printf "%b\n" "Service $SERVICE_NAME has been created and is ready to be started."
|
printf "%b\n" "Service $SERVICE_NAME has been created and is ready to be started."
|
||||||
|
|
||||||
# Optionally, enable and start the service
|
# Optionally, enable and start the service
|
||||||
printf "Do you want to start and enable the service now? (y/n)\n"
|
printf "%b" "Do you want to start and enable the service now? (y/N): "
|
||||||
read -r START_ENABLE
|
read -r START_ENABLE
|
||||||
|
|
||||||
if [ "$START_ENABLE" = "y" ]; then
|
if [ "$START_ENABLE" = "y" ] || [ "$START_ENABLE" = "Y" ]; then
|
||||||
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||||
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||||
printf "%b\n" "Service $SERVICE_NAME has been started and enabled."
|
printf "%b\n" "Service $SERVICE_NAME has been started and enabled."
|
||||||
|
@ -114,7 +114,7 @@ add_service() {
|
||||||
|
|
||||||
# Function to remove a service
|
# Function to remove a service
|
||||||
remove_service() {
|
remove_service() {
|
||||||
printf "Enter the name of the service to remove (e.g., my_service):\n"
|
printf "%b" "Enter the name of the service to remove (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
||||||
|
@ -124,7 +124,7 @@ remove_service() {
|
||||||
"$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"
|
||||||
"$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"
|
"$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"
|
||||||
|
|
||||||
printf "%b\n" "Removing the service file...\n"
|
printf "%b\n" "Removing the service file..."
|
||||||
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
|
"$ESCALATION_TOOL" rm -f "$SERVICE_FILE"
|
||||||
"$ESCALATION_TOOL" systemctl daemon-reload
|
"$ESCALATION_TOOL" systemctl daemon-reload
|
||||||
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
||||||
|
@ -136,7 +136,7 @@ remove_service() {
|
||||||
# Function to start a service
|
# Function to start a service
|
||||||
start_service() {
|
start_service() {
|
||||||
view_disabled_services
|
view_disabled_services
|
||||||
printf "%b\n" "Enter the name of the service to start (e.g., my_service): "
|
printf "%b" "Enter the name of the service to start (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
|
||||||
|
@ -149,7 +149,7 @@ start_service() {
|
||||||
# Function to stop a service
|
# Function to stop a service
|
||||||
stop_service() {
|
stop_service() {
|
||||||
view_started_services
|
view_started_services
|
||||||
printf "Enter the name of the service to stop (e.g., my_service):\n"
|
printf "%b" "Enter the name of the service to stop (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
|
||||||
|
@ -162,7 +162,7 @@ stop_service() {
|
||||||
# Function to enable a service
|
# Function to enable a service
|
||||||
enable_service() {
|
enable_service() {
|
||||||
view_disabled_services
|
view_disabled_services
|
||||||
printf "Enter the name of the service to enable (e.g., my_service):\n"
|
printf "%b" "Enter the name of the service to enable (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
|
||||||
|
@ -175,7 +175,7 @@ enable_service() {
|
||||||
# Function to enable a service
|
# Function to enable a service
|
||||||
disable_service() {
|
disable_service() {
|
||||||
view_enabled_services
|
view_enabled_services
|
||||||
printf "Enter the name of the service to disable (e.g., my_service):\n"
|
printf "%b" "Enter the name of the service to disable (e.g., my_service): "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
|
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
|
||||||
|
@ -189,14 +189,14 @@ disable_service() {
|
||||||
create_service_from_external() {
|
create_service_from_external() {
|
||||||
|
|
||||||
# List all .service files in the SCRIPT_DIR
|
# List all .service files in the SCRIPT_DIR
|
||||||
printf "============================\n"
|
printf "%b\n" "============================"
|
||||||
printf "Listing available service files\n"
|
printf "%b\n" "Listing available service files"
|
||||||
printf "============================\n"
|
printf "%b\n" "============================"
|
||||||
for FILE in "$SCRIPT_DIR"/*.service; do
|
for FILE in "$SCRIPT_DIR"/*.service; do
|
||||||
printf "%s\n" "$(basename "$FILE")"
|
printf "%b\n" "$(basename "$FILE")"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Enter the filename (without the .service extension) of the service to create:\n"
|
printf "%b" "Enter the filename (without the .service extension) of the service to create: "
|
||||||
read -r SERVICE_NAME
|
read -r SERVICE_NAME
|
||||||
|
|
||||||
SERVICE_FILE="$SCRIPT_DIR/$SERVICE_NAME.service"
|
SERVICE_FILE="$SCRIPT_DIR/$SERVICE_NAME.service"
|
||||||
|
@ -206,7 +206,7 @@ create_service_from_external() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Enter the username to run the service as (leave empty for no specific user):\n"
|
printf "%b" "Enter the username to run the service as (leave empty for no specific user): "
|
||||||
read -r SERVICE_USER
|
read -r SERVICE_USER
|
||||||
|
|
||||||
# Create the systemd service file path
|
# Create the systemd service file path
|
||||||
|
@ -233,7 +233,7 @@ create_service_from_external() {
|
||||||
printf "%b\n" "Service $SERVICE_NAME has been created and is ready to be started."
|
printf "%b\n" "Service $SERVICE_NAME has been created and is ready to be started."
|
||||||
|
|
||||||
# Optionally, enable and start the service
|
# Optionally, enable and start the service
|
||||||
printf "Do you want to start and enable the service now? (y/n)\n"
|
printf "%b" "Do you want to start and enable the service now? (Y/n)"
|
||||||
read -r START_ENABLE
|
read -r START_ENABLE
|
||||||
|
|
||||||
if [ "$START_ENABLE" = "y" ]; then
|
if [ "$START_ENABLE" = "y" ]; then
|
||||||
|
@ -248,7 +248,7 @@ create_service_from_external() {
|
||||||
main() {
|
main() {
|
||||||
while true; do
|
while true; do
|
||||||
show_menu
|
show_menu
|
||||||
printf "Enter your choice:\n"
|
printf "%b" "Enter your choice: "
|
||||||
read -r CHOICE
|
read -r CHOICE
|
||||||
|
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
|
@ -262,11 +262,11 @@ main() {
|
||||||
8) enable_service ;;
|
8) enable_service ;;
|
||||||
9) disable_service ;;
|
9) disable_service ;;
|
||||||
10) create_service_from_external ;;
|
10) create_service_from_external ;;
|
||||||
11) printf "Exiting...\n"; exit 0 ;;
|
11) printf "%b\n" "Exiting..."; exit 0 ;;
|
||||||
*) printf "Invalid choice. Please try again.\n" ;;
|
*) printf "%b\n" "Invalid choice. Please try again." ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "Press [Enter] to continue...\n"
|
printf "%b\n" "Press [Enter] to continue..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@ show_available_hosts() {
|
||||||
|
|
||||||
# Function to ask for host details
|
# Function to ask for host details
|
||||||
ask_for_host_details() {
|
ask_for_host_details() {
|
||||||
printf "%b\n" "Enter Host Alias: "
|
printf "%b" "Enter Host Alias: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter Remote Host (hostname or IP): "
|
printf "%b" "Enter Remote Host (hostname or IP): "
|
||||||
read -r host
|
read -r host
|
||||||
printf "%b\n" "Enter Remote User: "
|
printf "%b" "Enter Remote User: "
|
||||||
read -r user
|
read -r user
|
||||||
{
|
{
|
||||||
printf "%b\n" "Host $host_alias"
|
printf "%b\n" "Host $host_alias"
|
||||||
|
@ -46,7 +46,7 @@ generate_ssh_key() {
|
||||||
|
|
||||||
# Function to share the SSH public key with the remote host
|
# Function to share the SSH public key with the remote host
|
||||||
share_ssh_key() {
|
share_ssh_key() {
|
||||||
printf "%b\n" "Enter the alias of the host to copy the key to: "
|
printf "%b" "Enter the alias of the host to copy the key to: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Copying SSH key to $host_alias..."
|
printf "%b\n" "Copying SSH key to $host_alias..."
|
||||||
ssh-copy-id "$host_alias"
|
ssh-copy-id "$host_alias"
|
||||||
|
@ -59,8 +59,8 @@ disable_password_auth() {
|
||||||
printf "%b\n" "Disabling SSH password authentication and enabling key-only login..."
|
printf "%b\n" "Disabling SSH password authentication and enabling key-only login..."
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b\n" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n"
|
printf "\n"
|
||||||
ssh $host_alias "
|
ssh "$host_alias" "
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config &&
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
|
||||||
|
@ -75,7 +75,7 @@ enable_password_auth() {
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b\n" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "\n"
|
printf "\n"
|
||||||
ssh $host_alias "
|
ssh "$host_alias" "
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
|
||||||
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
|
"$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
|
||||||
|
@ -87,63 +87,63 @@ enable_password_auth() {
|
||||||
|
|
||||||
# Function to check if password authentication is disabled
|
# Function to check if password authentication is disabled
|
||||||
check_password_auth() {
|
check_password_auth() {
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
ssh $host_alias "grep '^PasswordAuthentication' /etc/ssh/sshd_config"
|
ssh "$host_alias" "grep '^PasswordAuthentication' /etc/ssh/sshd_config"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to run a command on a remote server
|
# Function to run a command on a remote server
|
||||||
run_remote_command() {
|
run_remote_command() {
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the command to run: "
|
printf "%b" "Enter the command to run: "
|
||||||
read -r remote_command
|
read -r remote_command
|
||||||
ssh $host_alias "$remote_command"
|
ssh "$host_alias" "$remote_command"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to copy a file to a remote server
|
# Function to copy a file to a remote server
|
||||||
copy_file_to_remote() {
|
copy_file_to_remote() {
|
||||||
printf "%b\n" "Enter the local file path: "
|
printf "%b" "Enter the local file path: "
|
||||||
read -r local_file
|
read -r local_file
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the remote destination path: "
|
printf "%b" "Enter the remote destination path: "
|
||||||
read -r remote_path
|
read -r remote_path
|
||||||
scp $local_file $host_alias:$remote_path
|
scp "$local_file" "$host_alias:$remote_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to copy a directory to a remote server
|
# Function to copy a directory to a remote server
|
||||||
copy_directory_to_remote() {
|
copy_directory_to_remote() {
|
||||||
printf "%b\n" "Enter the local directory path: "
|
printf "%b" "Enter the local directory path: "
|
||||||
read -r local_dir
|
read -r local_dir
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the remote destination path: "
|
printf "%b" "Enter the remote destination path: "
|
||||||
read -r remote_path
|
read -r remote_path
|
||||||
scp -r $local_dir $host_alias:$remote_path
|
scp -r "$local_dir" "$host_alias:$remote_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to move a file to a remote server (copy and delete local)
|
# Function to move a file to a remote server (copy and delete local)
|
||||||
move_file_to_remote() {
|
move_file_to_remote() {
|
||||||
printf "%b\n" "Enter the local file path: "
|
printf "%b" "Enter the local file path: "
|
||||||
read -r local_file
|
read -r local_file
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the remote destination path: "
|
printf "%b" "Enter the remote destination path: "
|
||||||
read -r remote_path
|
read -r remote_path
|
||||||
scp $local_file $host_alias:$remote_path && rm $local_file
|
scp "$local_file" "$host_alias:$remote_path" && rm "$local_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to move a directory to a remote server (copy and delete local)
|
# Function to move a directory to a remote server (copy and delete local)
|
||||||
move_directory_to_remote() {
|
move_directory_to_remote() {
|
||||||
printf "%b\n" "Enter the local directory path: "
|
printf "%b" "Enter the local directory path: "
|
||||||
read -r local_dir
|
read -r local_dir
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the remote destination path: "
|
printf "%b" "Enter the remote destination path: "
|
||||||
read -r remote_path
|
read -r remote_path
|
||||||
scp -r $local_dir $host_alias:$remote_path && rm -r $local_dir
|
scp -r "$local_dir" "$host_alias:$remote_path" && rm -r "$local_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to remove a system from SSH configuration
|
# Function to remove a system from SSH configuration
|
||||||
|
@ -173,25 +173,25 @@ backup_files() {
|
||||||
read -r remote_files
|
read -r remote_files
|
||||||
printf "%b\n" "Enter the local backup directory path: "
|
printf "%b\n" "Enter the local backup directory path: "
|
||||||
read -r local_backup_dir
|
read -r local_backup_dir
|
||||||
scp -r $host_alias:$remote_files $local_backup_dir
|
scp -r "$host_alias:$remote_files" "$local_backup_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to sync directories with remote host
|
# Function to sync directories with remote host
|
||||||
sync_directories() {
|
sync_directories() {
|
||||||
printf "%b\n" "Enter the local directory path: "
|
printf "%b" "Enter the local directory path: "
|
||||||
read -r local_dir
|
read -r local_dir
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
printf "%b\n" "Enter the remote directory path: "
|
printf "%b" "Enter the remote directory path: "
|
||||||
read -r remote_dir
|
read -r remote_dir
|
||||||
rsync -avz $local_dir $host_alias:$remote_dir
|
rsync -avz "$local_dir" "$host_alias:$remote_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to check SSH key authentication status
|
# Function to check SSH key authentication status
|
||||||
check_ssh_key_authentication() {
|
check_ssh_key_authentication() {
|
||||||
printf "%b\n" "Enter the alias of the host: "
|
printf "%b\n" "Enter the alias of the host: "
|
||||||
read -r host_alias
|
read -r host_alias
|
||||||
ssh $host_alias "grep '^PubkeyAuthentication' /etc/ssh/sshd_config"
|
ssh "$host_alias" "grep '^PubkeyAuthentication' /etc/ssh/sshd_config"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to show options for the user
|
# Function to show options for the user
|
||||||
|
@ -215,7 +215,7 @@ show_menu() {
|
||||||
printf "%b\n" "16. Backup files from remote host"
|
printf "%b\n" "16. Backup files from remote host"
|
||||||
printf "%b\n" "17. Sync directories with remote host"
|
printf "%b\n" "17. Sync directories with remote host"
|
||||||
printf "%b\n" "18. Exit"
|
printf "%b\n" "18. Exit"
|
||||||
printf "%b\n" "Enter your choice: "
|
printf "%b" "Enter your choice: "
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to execute the selected SSH operation
|
# Function to execute the selected SSH operation
|
||||||
|
@ -225,7 +225,7 @@ main() {
|
||||||
read -r choice
|
read -r choice
|
||||||
case $choice in
|
case $choice in
|
||||||
1) ask_for_host_details ;;
|
1) ask_for_host_details ;;
|
||||||
2) show_available_hosts && printf "%b\n" "Enter the alias of the host to connect to: " && read -r host_alias; ssh $host_alias ;;
|
2) show_available_hosts && printf "%b" "Enter the alias of the host to connect to: " && read -r host_alias; ssh "$host_alias" ;;
|
||||||
3) generate_ssh_key ;;
|
3) generate_ssh_key ;;
|
||||||
4) share_ssh_key ;;
|
4) share_ssh_key ;;
|
||||||
5) disable_password_auth ;;
|
5) disable_password_auth ;;
|
||||||
|
|
|
@ -48,9 +48,9 @@ list_devices() {
|
||||||
|
|
||||||
# Function to create a new snapshot
|
# Function to create a new snapshot
|
||||||
create_snapshot() {
|
create_snapshot() {
|
||||||
printf "%b\n" "${CYAN}Enter a comment for the snapshot (optional): ${RC}"
|
printf "%b" "${CYAN}Enter a comment for the snapshot (optional): ${RC}"
|
||||||
read -r COMMENT
|
read -r COMMENT
|
||||||
printf "%b\n" "${CYAN}Enter snapshot tag (O,B,H,D,W,M) (leave empty for no tag): ${RC}"
|
printf "%b" "${CYAN}Enter snapshot tag (O,B,H,D,W,M) (leave empty for no tag): ${RC}"
|
||||||
read -r TAG
|
read -r TAG
|
||||||
|
|
||||||
if [ -z "$COMMENT" ] && [ -z "$TAG" ]; then
|
if [ -z "$COMMENT" ] && [ -z "$TAG" ]; then
|
||||||
|
@ -75,14 +75,14 @@ create_snapshot() {
|
||||||
restore_snapshot() {
|
restore_snapshot() {
|
||||||
list_snapshots
|
list_snapshots
|
||||||
|
|
||||||
printf "%b\n" "${CYAN}Enter the snapshot name you want to restore: ${RC}"
|
printf "%b" "${CYAN}Enter the snapshot name you want to restore: ${RC}"
|
||||||
read -r SNAPSHOT
|
read -r SNAPSHOT
|
||||||
printf "%b\n" "${CYAN}Enter the target device (e.g., /dev/sda1): ${RC}"
|
printf "%b" "${CYAN}Enter the target device (e.g., /dev/sda1): ${RC}"
|
||||||
read -r TARGET_DEVICE
|
read -r TARGET_DEVICE
|
||||||
printf "%b\n" "${CYAN}Do you want to skip GRUB reinstall? (yes/no): ${RC}"
|
printf "%b" "${CYAN}Do you want to skip GRUB reinstall? (y/N): ${RC}"
|
||||||
read -r SKIP_GRUB
|
read -r SKIP_GRUB
|
||||||
|
|
||||||
if [ "$SKIP_GRUB" = "yes" ]; then
|
if [ "$SKIP_GRUB" = "y" ] || [ "$SKIP_GRUB" = "Y" ]; then
|
||||||
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes
|
"$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes
|
||||||
else
|
else
|
||||||
printf "%b\n" "${CYAN}Enter GRUB device (e.g., /dev/sda): ${RC}"
|
printf "%b\n" "${CYAN}Enter GRUB device (e.g., /dev/sda): ${RC}"
|
||||||
|
@ -101,7 +101,7 @@ restore_snapshot() {
|
||||||
delete_snapshot() {
|
delete_snapshot() {
|
||||||
list_snapshots
|
list_snapshots
|
||||||
|
|
||||||
printf "%b\n" "${CYAN}Enter the snapshot name you want to delete: ${RC}"
|
printf "%b" "${CYAN}Enter the snapshot name you want to delete: ${RC}"
|
||||||
read -r SNAPSHOT
|
read -r SNAPSHOT
|
||||||
|
|
||||||
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
|
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
|
||||||
|
@ -117,10 +117,10 @@ delete_snapshot() {
|
||||||
# Function to delete all snapshots
|
# Function to delete all snapshots
|
||||||
delete_all_snapshots() {
|
delete_all_snapshots() {
|
||||||
printf "%b\n" "${RED}WARNING: This will delete all snapshots!${RC}"
|
printf "%b\n" "${RED}WARNING: This will delete all snapshots!${RC}"
|
||||||
printf "%b\n" "${CYAN}Are you sure? (yes/no): ${RC}"
|
printf "%b" "${CYAN}Are you sure? (y/N): ${RC}"
|
||||||
read -r CONFIRMATION
|
read -r CONFIRMATION
|
||||||
|
|
||||||
if [ "$CONFIRMATION" = "yes" ]; 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
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|
|
@ -35,7 +35,7 @@ execute_command() {
|
||||||
# Function to detect connected monitors
|
# Function to detect connected monitors
|
||||||
detect_connected_monitors() {
|
detect_connected_monitors() {
|
||||||
xrandr_output=$(xrandr)
|
xrandr_output=$(xrandr)
|
||||||
printf "%s\n" "$xrandr_output" | grep " connected" | awk '{print $1}'
|
printf "%b\n" "$xrandr_output" | grep " connected" | awk '{print $1}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the current brightness for a monitor
|
# Function to get the current brightness for a monitor
|
||||||
|
@ -75,7 +75,7 @@ get_unique_resolutions() {
|
||||||
confirm_action() {
|
confirm_action() {
|
||||||
action="$1"
|
action="$1"
|
||||||
printf "%b\n" "${CYAN}$action${RC}"
|
printf "%b\n" "${CYAN}$action${RC}"
|
||||||
printf "%b" "${CYAN}Are you sure? (y/n): ${RC}"
|
printf "%b" "${CYAN}Are you sure? (y/N): ${RC}"
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -38,14 +38,14 @@ main_menu() {
|
||||||
clear
|
clear
|
||||||
printf "%b\n" "${YELLOW}WiFi Manager${RC}"
|
printf "%b\n" "${YELLOW}WiFi Manager${RC}"
|
||||||
printf "%b\n" "${YELLOW}============${RC}"
|
printf "%b\n" "${YELLOW}============${RC}"
|
||||||
printf "1. Turn WiFi On\n"
|
printf "%b\n" "1. Turn WiFi On"
|
||||||
printf "2. Turn WiFi Off\n"
|
printf "%b\n" "2. Turn WiFi Off"
|
||||||
printf "3. Scan for WiFi networks\n"
|
printf "%b\n" "3. Scan for WiFi networks"
|
||||||
printf "4. Connect to a WiFi network\n"
|
printf "%b\n" "4. Connect to a WiFi network"
|
||||||
printf "5. Disconnect from a WiFi network\n"
|
printf "%b\n" "5. Disconnect from a WiFi network"
|
||||||
printf "6. Remove a WiFi connection\n"
|
printf "%b\n" "6. Remove a WiFi connection"
|
||||||
printf "0. Exit\n"
|
printf "%b\n" "0. Exit"
|
||||||
printf "Choose an option: "
|
printf "%b" "Choose an option: "
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
|
@ -72,7 +72,7 @@ scan_networks() {
|
||||||
printf "%b\n" "${GREEN}Top 10 Networks found:${RC}"
|
printf "%b\n" "${GREEN}Top 10 Networks found:${RC}"
|
||||||
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 "Press any key to return to the main menu...\n"
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ wifi_on() {
|
||||||
} || {
|
} || {
|
||||||
printf "%b\n" "${RED}Failed to turn on WiFi.${RC}"
|
printf "%b\n" "${RED}Failed to turn on WiFi.${RC}"
|
||||||
}
|
}
|
||||||
printf "Press any key to return to the main menu...\n"
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ wifi_off() {
|
||||||
} || {
|
} || {
|
||||||
printf "%b\n" "${RED}Failed to turn off WiFi.${RC}"
|
printf "%b\n" "${RED}Failed to turn off WiFi.${RC}"
|
||||||
}
|
}
|
||||||
printf "Press any key to return to the main menu...\n"
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ prompt_for_network() {
|
||||||
networks=$(nmcli -t -f SSID dev wifi list | awk -F: '!seen[$1]++' | grep -v '^$')
|
networks=$(nmcli -t -f SSID dev wifi list | awk -F: '!seen[$1]++' | grep -v '^$')
|
||||||
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 "Press any key to return to the main menu...\n"
|
printf "%b\n" "Press any key to return to the main menu..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
return
|
return
|
||||||
|
@ -126,18 +126,18 @@ prompt_for_network() {
|
||||||
i=1
|
i=1
|
||||||
while IFS= read -r network; do
|
while IFS= read -r network; do
|
||||||
ssid=$(echo "$network" | awk -F: '{print $1}')
|
ssid=$(echo "$network" | awk -F: '{print $1}')
|
||||||
printf "%d. SSID: %s\n" "$i" "$ssid"
|
printf "%b\n" "$i. SSID: " "$ssid"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done < "$temp_file"
|
done < "$temp_file"
|
||||||
|
|
||||||
printf "0. Exit to main menu\n"
|
printf "%b\n" "0. Exit to main menu"
|
||||||
printf "%s" "$prompt_msg"
|
printf "%b" "$prompt_msg"
|
||||||
read -r choice
|
read -r choice
|
||||||
|
|
||||||
if [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then
|
if [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then
|
||||||
ssid=$(sed -n "${choice}p" "$temp_file" | awk -F: '{print $1}')
|
ssid=$(sed -n "${choice}p" "$temp_file" | awk -F: '{print $1}')
|
||||||
if [ "$action" = "connect" ]; then
|
if [ "$action" = "connect" ]; then
|
||||||
printf "Enter password for SSID %s: " "$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" && {
|
nmcli dev wifi connect "$ssid" password "$password" && {
|
||||||
|
@ -150,7 +150,7 @@ prompt_for_network() {
|
||||||
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Press any key to return to the selection menu...\n"
|
printf "%b\n" "Press any key to return to the selection menu..."
|
||||||
read -r dummy
|
read -r dummy
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user