mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 13:15:21 +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
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager. Please install Github Desktop manually.${RC}"
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -30,7 +30,7 @@ installNeovim() {
|
|||
"$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
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -27,7 +27,8 @@ installSublime() {
|
|||
"$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
|
||||
else
|
||||
|
|
|
@ -28,7 +28,8 @@ installVsCode() {
|
|||
"$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
|
||||
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" "${RED}The script does not support your Distro. Install manually..${RC}"
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
|
|
@ -24,7 +24,7 @@ install_chrome() {
|
|||
"$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
|
||||
else
|
||||
|
@ -43,15 +43,14 @@ install_thorium() {
|
|||
;;
|
||||
zypper|dnf)
|
||||
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
|
||||
;;
|
||||
pacman)
|
||||
"$AUR_HELPER" -S --needed --noconfirm thorium-browser-bin
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager. Please install Thorium manually.${RC}"
|
||||
exit 1
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
@ -76,7 +75,8 @@ install_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
|
||||
else
|
||||
|
@ -117,7 +117,7 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
|
|||
"$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
|
||||
;;
|
||||
esac
|
||||
|
@ -152,7 +152,8 @@ install_brave() {
|
|||
"$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
|
||||
else
|
||||
|
@ -189,7 +190,8 @@ install_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
|
||||
else
|
||||
|
@ -227,7 +229,7 @@ browserSetup() {
|
|||
printf "%b\n" "7. Thorium"
|
||||
printf "%b\n" "8. Lynx"
|
||||
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
|
||||
for ch in $choice; do
|
||||
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"
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -27,7 +27,7 @@ installLinutil() {
|
|||
;;
|
||||
*)
|
||||
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
|
||||
case $choice in
|
||||
y|Y)
|
||||
|
|
|
@ -21,7 +21,7 @@ installDepend() {
|
|||
"$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
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -18,7 +18,8 @@ install_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
|
||||
else
|
||||
|
@ -30,20 +31,20 @@ install_libreoffice() {
|
|||
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
|
||||
if ! command_exists libreoffice; then
|
||||
case "$PACKAGER" in
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
|
||||
;;
|
||||
zypper|dnf)
|
||||
. ./setup-flatpak.sh
|
||||
flatpak install -y flathub org.libreoffice.LibreOffice
|
||||
;;
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
||||
;;
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
|
||||
;;
|
||||
zypper|dnf)
|
||||
. ./setup-flatpak.sh
|
||||
flatpak install -y flathub org.libreoffice.LibreOffice
|
||||
;;
|
||||
pacman)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libreoffice-fresh
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager. Please install Thorium manually.${RC}"
|
||||
exit 1
|
||||
;;
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "%b\n" "${GREEN}Libre Office is already installed.${RC}"
|
||||
|
@ -88,7 +89,8 @@ install_freeoffice() {
|
|||
"$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
|
||||
}
|
||||
|
@ -174,7 +176,7 @@ officeSuiteSetup() {
|
|||
printf "%b\n" "7. PDF Studio Viewer"
|
||||
printf "%b\n" "8. PDF Studio (Paid Software)"
|
||||
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
|
||||
for ch in $choice; do
|
||||
case $ch in
|
||||
|
|
|
@ -41,7 +41,7 @@ setup_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
|
||||
;;
|
||||
esac
|
||||
|
@ -50,7 +50,7 @@ setup_flatpak() {
|
|||
else
|
||||
if command -v flatpak >/dev/null 2>&1; 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
|
||||
case "$add_remote" in
|
||||
[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.
|
||||
# So in case the user wants to use a GUI siftware manager they can setup it here
|
||||
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
|
||||
if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak
|
||||
fi
|
||||
# Useful for Debian KDE spin as well
|
||||
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
|
||||
if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then
|
||||
"$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
|
||||
|
||||
# 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
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
# Check for required commands
|
||||
for cmd in find curl unzip stty; do
|
||||
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
|
||||
fi
|
||||
done
|
||||
|
||||
# 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)
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
# 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=""
|
||||
i=0
|
||||
IFS='
|
||||
|
@ -42,7 +42,7 @@ print_menu() {
|
|||
if [ $((start + max_display)) -gt $total ]; then start=$((total - max_display)); 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
|
||||
echo "$paths_string" | tr '|' '\n' | while IFS= read -r path; do
|
||||
if [ $i -ge $start ] && [ $i -lt $((start + max_display)) ]; then
|
||||
|
@ -95,7 +95,7 @@ select_path
|
|||
|
||||
# Validate the path
|
||||
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
|
||||
fi
|
||||
|
||||
|
@ -104,29 +104,29 @@ mods_path="$d2r_path/mods"
|
|||
mkdir -p "$mods_path"
|
||||
|
||||
# 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
|
||||
printf "%s\n" "Error: Failed to download the loot filter."
|
||||
printf "%b\n" "Error: Failed to download the loot filter."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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
|
||||
printf "%s\n" "Error: Failed to extract the loot filter."
|
||||
printf "%b\n" "Error: Failed to extract the loot filter."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
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 "1. Open the Battle.net launcher\n"
|
||||
printf "2. Select Diablo II: Resurrected\n"
|
||||
printf "3. Click the gear icon next to the 'Play' button\n"
|
||||
printf "4. Select 'Game Settings'\n"
|
||||
printf "5. In the 'Additional command line arguments' field, enter: -mod lootfilter -txt\n"
|
||||
printf "6. Click 'Done' to save the changes\n"
|
||||
printf "\nAfter completing these steps, launch Diablo II: Resurrected through Battle.net to use the loot filter.\n"
|
||||
printf "%b\n" "To complete the setup, please follow these steps to add launch options in Battle.net:"
|
||||
printf "%b\n" "1. Open the Battle.net launcher"
|
||||
printf "%b\n" "2. Select Diablo II: Resurrected"
|
||||
printf "%b\n" "3. Click the gear icon next to the 'Play' button"
|
||||
printf "%b\n" "4. Select 'Game Settings'"
|
||||
printf "%b\n" "5. In the 'Additional command line arguments' field, enter: -mod lootfilter -txt"
|
||||
printf "%b\n" "6. Click 'Done' to save the changes"
|
||||
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
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ installDepend() {
|
|||
fi
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ installDepend() {
|
|||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" dpkg --add-architecture i386
|
||||
"$ESCALATION_TOOL" "$PACKAGER" update
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES" "$COMPILEDEPS"
|
||||
;;
|
||||
dnf)
|
||||
COMPILEDEPS='@development-tools'
|
||||
|
@ -34,11 +34,11 @@ installDepend() {
|
|||
zypper)
|
||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||
"$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" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y "$DEPENDENCIES"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ install_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
|
||||
;;
|
||||
esac
|
||||
|
@ -56,7 +56,7 @@ install_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
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -68,7 +68,7 @@ installDriver() {
|
|||
|
||||
# NOTE: A confirmation option to proceed or not
|
||||
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
|
||||
case "$choice" in
|
||||
y | Y)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
. ../common-script.sh
|
||||
|
||||
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
|
||||
apt-get|nala)
|
||||
"$ESCALATION_TOOL" "$PACKAGER" install -y qt6ct kvantum
|
||||
|
@ -18,14 +18,14 @@ install_theme_tools() {
|
|||
"$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
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_qt6ct() {
|
||||
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}\n"
|
||||
printf "%b\n" "${YELLOW}Configuring qt6ct...${RC}"
|
||||
mkdir -p "$HOME/.config/qt6ct"
|
||||
cat <<EOF > "$HOME/.config/qt6ct/qt6ct.conf"
|
||||
[Appearance]
|
||||
|
@ -33,15 +33,15 @@ style=kvantum
|
|||
color_scheme=default
|
||||
icon_theme=breeze
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ configure_kvantum() {
|
|||
[General]
|
||||
theme=Breeze
|
||||
EOF
|
||||
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}\n"
|
||||
printf "%b\n" "${GREEN}Kvantum configured successfully.${RC}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
|
|
|
@ -20,7 +20,8 @@ removeSnaps() {
|
|||
"$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
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ setup_ssh_samba(){
|
|||
printf "4. Setup All\n"
|
||||
printf "5. Exit\n"
|
||||
|
||||
printf "Enter your choice [1-5]: "
|
||||
printf "%b" "Enter your choice (1-5): "
|
||||
read CHOICE
|
||||
|
||||
case "$CHOICE" in
|
||||
|
|
|
@ -26,7 +26,7 @@ cleanup_system() {
|
|||
"$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
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -15,7 +15,7 @@ list_sessions() {
|
|||
printf "%b\n" "8) Openbox (openbox.desktop)"
|
||||
printf "%b\n" "9) i3 (i3.desktop)"
|
||||
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
|
||||
|
||||
case "$session_choice" in
|
||||
|
@ -29,7 +29,7 @@ list_sessions() {
|
|||
8) session="openbox.desktop" ;;
|
||||
9) session="i3.desktop" ;;
|
||||
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 ;;
|
||||
*)
|
||||
printf "%b\n" "Invalid option selected."
|
||||
|
@ -40,7 +40,7 @@ list_sessions() {
|
|||
# Function to configure LightDM
|
||||
configure_lightdm() {
|
||||
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
|
||||
|
||||
"$ESCALATION_TOOL" "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf"
|
||||
|
@ -60,7 +60,7 @@ remove_lightdm_autologin() {
|
|||
# Function to configure GDM
|
||||
configure_gdm() {
|
||||
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
|
||||
|
||||
"$ESCALATION_TOOL" "printf '[daemon]' > /etc/gdm/custom.conf"
|
||||
|
@ -81,7 +81,7 @@ remove_gdm_autologin() {
|
|||
# Function to configure SDDM
|
||||
configure_sddm() {
|
||||
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
|
||||
list_sessions # Show session options
|
||||
|
||||
|
@ -102,7 +102,7 @@ remove_sddm_autologin() {
|
|||
# Function to configure LXDM
|
||||
configure_lxdm() {
|
||||
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
|
||||
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" "1) Add 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
|
||||
|
||||
if [ "$action_choice" = "1" ]; then
|
||||
|
@ -134,7 +134,7 @@ configure_or_remove_autologin() {
|
|||
printf "%b\n" "2) GDM"
|
||||
printf "%b\n" "3) SDDM"
|
||||
printf "%b\n" "4) LXDM"
|
||||
printf "%b\n" "Enter your choice [1-4]: "
|
||||
printf "%b" "Enter your choice (1-4): "
|
||||
read -r choice
|
||||
|
||||
case "$choice" in
|
||||
|
@ -150,7 +150,7 @@ configure_or_remove_autologin() {
|
|||
printf "%b\n" "2) GDM"
|
||||
printf "%b\n" "3) SDDM"
|
||||
printf "%b\n" "4) LXDM"
|
||||
printf "%b\n" "Enter your choice [1-4]: "
|
||||
printf "%b" "Enter your choice (1-4): "
|
||||
read -r choice
|
||||
|
||||
case "$choice" in
|
||||
|
|
|
@ -35,13 +35,13 @@ main_menu() {
|
|||
clear
|
||||
printf "%b\n" "${YELLOW}Bluetooth Manager${RC}"
|
||||
printf "%b\n" "${YELLOW}=================${RC}"
|
||||
printf "1. Scan for devices\n"
|
||||
printf "2. Pair with a device\n"
|
||||
printf "3. Connect to a device\n"
|
||||
printf "4. Disconnect from a device\n"
|
||||
printf "5. Remove a device\n"
|
||||
printf "0. Exit\n"
|
||||
printf "Choose an option: "
|
||||
printf "%b\n" "1. Scan for devices"
|
||||
printf "%b\n" "2. Pair with a device"
|
||||
printf "%b\n" "3. Connect to a device"
|
||||
printf "%b\n" "4. Disconnect from a device"
|
||||
printf "%b\n" "5. Remove a device"
|
||||
printf "%b\n" "0. Exit"
|
||||
printf "%b" "Choose an option: "
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
|
@ -66,9 +66,9 @@ scan_devices() {
|
|||
printf "%b\n" "${RED}No devices found.${RC}"
|
||||
else
|
||||
printf "%b\n" "${GREEN}Devices found:${RC}"
|
||||
printf "%s\n" "$devices"
|
||||
printf "%b\n" "$devices"
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ prompt_for_mac() {
|
|||
devices=$(bluetoothctl devices)
|
||||
if [ -z "$devices" ]; then
|
||||
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
|
||||
return
|
||||
fi
|
||||
|
@ -97,8 +97,8 @@ prompt_for_mac() {
|
|||
printf "%d. %s\n" "$i" "$device"
|
||||
i=$((i + 1))
|
||||
done
|
||||
printf "0. Exit to main menu\n"
|
||||
printf "%s\n" "$prompt_msg"
|
||||
printf "%b\n" "0. Exit to main menu"
|
||||
printf "%b\n" "$prompt_msg"
|
||||
read -r choice
|
||||
|
||||
# Validate the choice
|
||||
|
@ -106,7 +106,7 @@ prompt_for_mac() {
|
|||
device=$(echo "$device_list" | sed -n "${choice}p")
|
||||
mac=$(echo "$device" | awk '{print $2}')
|
||||
if bluetoothctl info "$mac" > /dev/null 2>&1; then
|
||||
bluetoothctl $command "$mac" && {
|
||||
bluetoothctl "$command" "$mac" && {
|
||||
printf "%b\n" "${GREEN}$success_msg${RC}"
|
||||
break
|
||||
} || {
|
||||
|
@ -121,7 +121,7 @@ prompt_for_mac() {
|
|||
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ fetch_arch_older_isos() {
|
|||
COUNTER=$((COUNTER + 1))
|
||||
done
|
||||
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
|
||||
ARCH_DIR=$(echo "$ARCH_VERSIONS" | sed -n "${ARCH_OPTION}p")
|
||||
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 "2) Use local ISO\n"
|
||||
printf "\n"
|
||||
printf "Select option (1-2): "
|
||||
printf "%b" "Select option (1-2): "
|
||||
read -r ISO_SOURCE_OPTION
|
||||
|
||||
case $ISO_SOURCE_OPTION in
|
||||
|
@ -102,7 +102,7 @@ fetch_iso_urls() {
|
|||
printf "%b\n" "2) Arch Linux (older versions)"
|
||||
printf "%b\n" "3) Debian Linux (latest)"
|
||||
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
|
||||
|
||||
case $ISO_OPTION in
|
||||
|
@ -144,7 +144,7 @@ write_iso(){
|
|||
list_devices
|
||||
|
||||
# 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
|
||||
|
||||
# Verify that the USB device exists
|
||||
|
@ -154,7 +154,7 @@ write_iso(){
|
|||
fi
|
||||
|
||||
# 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
|
||||
|
||||
if [ "$CONFIRMATION" != "yes" ]; then
|
||||
|
|
|
@ -20,9 +20,8 @@ if ! command_exists openssl; then
|
|||
"$ESCALATION_TOOL" "$PACKAGER" install openssl
|
||||
;;
|
||||
*)
|
||||
printf "%b\n" "${RED}Your Linux distribution is not supported by this script.${RC}"
|
||||
printf "%b\n" "${YELLOW}You can try installing OpenSSL manually:${RC}"
|
||||
printf "%b\n" "1. Refer to your distribution's documentation."
|
||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -43,7 +42,7 @@ show_menu() {
|
|||
|
||||
# Function to encrypt a 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
|
||||
|
||||
if [ ! -e "$INPUT_PATH" ]; then
|
||||
|
@ -51,10 +50,10 @@ encrypt_file() {
|
|||
return
|
||||
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
|
||||
|
||||
printf "%b\n" "Enter the encryption password: "
|
||||
printf "%b" "Enter the encryption password: "
|
||||
read -r PASSWORD
|
||||
|
||||
if [ -d "$INPUT_PATH" ]; then
|
||||
|
@ -88,7 +87,7 @@ encrypt_file() {
|
|||
|
||||
# Function to decrypt a 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
|
||||
|
||||
if [ ! -e "$INPUT_PATH" ]; then
|
||||
|
@ -96,10 +95,10 @@ decrypt_file() {
|
|||
return
|
||||
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
|
||||
|
||||
printf "%b\n" "Enter the decryption password: "
|
||||
printf "%b" "Enter the decryption password: "
|
||||
read -r PASSWORD
|
||||
|
||||
if [ -d "$INPUT_PATH" ]; then
|
||||
|
@ -135,7 +134,7 @@ main(){
|
|||
clear
|
||||
while true; do
|
||||
show_menu
|
||||
printf "%b\n" "Enter your choice:"
|
||||
printf "%b" "Enter your choice: "
|
||||
read -r CHOICE
|
||||
|
||||
case $CHOICE in
|
||||
|
|
|
@ -18,8 +18,8 @@ auto_detect_displays() {
|
|||
temp_common_resolutions=$(mktemp)
|
||||
temp_resolutions=$(mktemp)
|
||||
|
||||
printf "%s" "$common_resolutions" > "$temp_common_resolutions"
|
||||
printf "%s" "$resolutions" > "$temp_resolutions"
|
||||
printf "%b\n" "$common_resolutions" > "$temp_common_resolutions"
|
||||
printf "%b\n" "$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} Change Monitor Orientation${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
|
||||
for monitor in $monitor_array; do
|
||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
printf "Enter the number of the monitor: "
|
||||
printf "%b" "Enter the number of the monitor: "
|
||||
read -r monitor_choice
|
||||
|
||||
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" "4. ${GREEN}Inverted${RC}"
|
||||
|
||||
printf "Enter the number of the orientation: "
|
||||
printf "%b" "Enter the number of the orientation: "
|
||||
read -r orientation_choice
|
||||
case $orientation_choice in
|
||||
1) orientation="normal" ;;
|
||||
|
|
|
@ -13,14 +13,14 @@ disable_monitor() {
|
|||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||
printf "%b\n" "${YELLOW} Disable Monitor${RC}"
|
||||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||
printf "%b\n" "Choose a monitor to disable:"
|
||||
printf "%b" "Choose a monitor to disable: "
|
||||
i=1
|
||||
for monitor in $monitor_array; do
|
||||
printf "%b\n" "$i. ${GREEN}$monitor${RC}"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
printf "%b\n" "Enter the number of the monitor: "
|
||||
printf "%b" "Enter the number of the monitor: "
|
||||
read -r monitor_choice
|
||||
|
||||
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() {
|
||||
action="$1"
|
||||
printf "%b\n" "${YELLOW}$action${RC}"
|
||||
printf "%b\n" "Are you sure? (y/n): "
|
||||
printf "%b" "Are you sure? (y/N): "
|
||||
read -r confirm
|
||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||
return 0
|
||||
|
|
|
@ -13,7 +13,7 @@ enable_monitor() {
|
|||
printf "%b\n" "${YELLOW}=========================================${RC}"
|
||||
printf "%b\n" "${YELLOW} Enable Monitor${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
|
||||
for monitor in $monitor_array; do
|
||||
|
@ -21,7 +21,7 @@ enable_monitor() {
|
|||
i=$((i + 1))
|
||||
done
|
||||
|
||||
printf "Enter the number of the monitor: "
|
||||
printf "%b" "Enter the number of the monitor: "
|
||||
read -r monitor_choice
|
||||
|
||||
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} Manage Monitor Arrangement${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
|
||||
for monitor in $monitor_array; do
|
||||
printf "%b\n" "$i. ${YELLOW}$monitor${RC}"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
printf "Enter the number of the monitor to arrange: "
|
||||
printf "%b" "Enter the number of the monitor to arrange: "
|
||||
read -r monitor_choice
|
||||
|
||||
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")
|
||||
|
||||
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" "2. ${YELLOW}Right of${RC}"
|
||||
printf "%b\n" "3. ${YELLOW}Above${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
|
||||
|
||||
case $position_choice in
|
||||
|
@ -55,7 +55,7 @@ manage_arrangement() {
|
|||
fi
|
||||
done
|
||||
|
||||
printf "Enter the number of the reference monitor: "
|
||||
printf "%b" "Enter the number of the reference monitor: "
|
||||
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
|
||||
|
|
|
@ -7,7 +7,7 @@ adjust_monitor_brightness() {
|
|||
while true; do
|
||||
monitor_list=$(detect_connected_monitors)
|
||||
monitor_array=$(echo "$monitor_list" | tr '\n' ' ')
|
||||
set -- $monitor_array
|
||||
set -- "$monitor_array"
|
||||
count=1
|
||||
|
||||
clear
|
||||
|
@ -20,7 +20,7 @@ adjust_monitor_brightness() {
|
|||
count=$((count + 1))
|
||||
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
|
||||
|
||||
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}"
|
||||
|
||||
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
|
||||
|
||||
if [ "$new_brightness_percentage" = "q" ]; then
|
||||
|
@ -67,7 +67,7 @@ adjust_monitor_brightness() {
|
|||
# Convert percentage to xrandr brightness value (10% to 0.10)
|
||||
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
|
||||
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
||||
printf "%b\n" "${GREEN}Setting brightness for $monitor_name to $new_brightness_percentage%${RC}"
|
||||
|
|
|
@ -20,7 +20,7 @@ set_primary_monitor() {
|
|||
i=$((i + 1))
|
||||
done
|
||||
|
||||
printf "Enter the number of the monitor to arrange: "
|
||||
printf "%b" "Enter the number of the monitor to arrange: "
|
||||
read -r monitor_choice
|
||||
|
||||
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))
|
||||
done
|
||||
|
||||
printf "%b\n" "Enter the choice (or 'q' to quit): "
|
||||
printf "%b" "Enter the choice (or 'q' to quit): "
|
||||
read -r monitor_choice
|
||||
|
||||
if [ "$monitor_choice" = "q" ]; then
|
||||
|
@ -56,7 +56,7 @@ set_resolutions() {
|
|||
awk '{print $1 ". " $2}' "$temp_res_file"
|
||||
|
||||
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
|
||||
|
||||
if [ "$resolution_choice" = "q" ]; then
|
||||
|
@ -72,7 +72,7 @@ set_resolutions() {
|
|||
|
||||
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
|
||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||
printf "%b\n" "${GREEN}Setting resolution for $monitor_name to $selected_resolution${RC}"
|
||||
|
|
|
@ -48,7 +48,7 @@ numlockSetup() {
|
|||
create_service
|
||||
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
|
||||
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
|
||||
"$ESCALATION_TOOL" systemctl enable numlock.service --quiet
|
||||
|
|
|
@ -24,7 +24,7 @@ list_models() {
|
|||
show_model_info() {
|
||||
clear
|
||||
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
|
||||
|
||||
printf "%b\n" "${YELLOW}Showing information for model '$model_name'...${RC}"
|
||||
|
@ -34,22 +34,22 @@ show_model_info() {
|
|||
display_models() {
|
||||
clear
|
||||
printf "%b\n" "${RED}Available Models${RC}"
|
||||
printf "1. Llama 3.1 - 8B (4.7GB)\n"
|
||||
printf "2. Llama 3.1 - 70B (40GB)\n"
|
||||
printf "3. Llama 3.1 - 405B (231GB)\n"
|
||||
printf "4. Phi 3 Mini - 3.8B (2.3GB)\n"
|
||||
printf "5. Phi 3 Medium - 14B (7.9GB)\n"
|
||||
printf "6. Gemma 2 - 2B (1.6GB)\n"
|
||||
printf "7. Gemma 2 - 9B (5.5GB)\n"
|
||||
printf "8. Gemma 2 - 27B (16GB)\n"
|
||||
printf "9. Mistral - 7B (4.1GB)\n"
|
||||
printf "10. Moondream 2 - 1.4B (829MB)\n"
|
||||
printf "11. Neural Chat - 7B (4.1GB)\n"
|
||||
printf "12. Starling - 7B (4.1GB)\n"
|
||||
printf "13. Code Llama - 7B (3.8GB)\n"
|
||||
printf "14. Llama 2 Uncensored - 7B (3.8GB)\n"
|
||||
printf "15. LLaVA - 7B (4.5GB)\n"
|
||||
printf "16. Solar - 10.7B (6.1GB)\n"
|
||||
printf "%b\n" "1. Llama 3.1 - 8B (4.7GB)"
|
||||
printf "%b\n" "2. Llama 3.1 - 70B (40GB)"
|
||||
printf "%b\n" "3. Llama 3.1 - 405B (231GB)"
|
||||
printf "%b\n" "4. Phi 3 Mini - 3.8B (2.3GB)"
|
||||
printf "%b\n" "5. Phi 3 Medium - 14B (7.9GB)"
|
||||
printf "%b\n" "6. Gemma 2 - 2B (1.6GB)"
|
||||
printf "%b\n" "7. Gemma 2 - 9B (5.5GB)"
|
||||
printf "%b\n" "8. Gemma 2 - 27B (16GB)"
|
||||
printf "%b\n" "9. Mistral - 7B (4.1GB)"
|
||||
printf "%b\n" "10. Moondream 2 - 1.4B (829MB)"
|
||||
printf "%b\n" "11. Neural Chat - 7B (4.1GB)"
|
||||
printf "%b\n" "12. Starling - 7B (4.1GB)"
|
||||
printf "%b\n" "13. Code Llama - 7B (3.8GB)"
|
||||
printf "%b\n" "14. Llama 2 Uncensored - 7B (3.8GB)"
|
||||
printf "%b\n" "15. LLaVA - 7B (4.5GB)"
|
||||
printf "%b\n" "16. Solar - 10.7B (6.1GB)"
|
||||
}
|
||||
|
||||
# Function to select model based on user input
|
||||
|
@ -87,8 +87,8 @@ run_model() {
|
|||
printf "%b\n" "${YELLOW}Custom Models${RC}"
|
||||
custom_models=$(ollama list | grep 'custom-model-prefix')
|
||||
|
||||
printf "%b\n" "${YELLOW}Please select a model to run:${RC}"
|
||||
printf "%b\n" "${YELLOW}Enter the number corresponding to the model or enter the name of a custom model:${RC}"
|
||||
printf "%b" "Select a model to run: "
|
||||
printf "%b" "Enter the number corresponding to the model or enter the name of a custom model: "
|
||||
|
||||
read -r model_choice
|
||||
|
||||
|
@ -104,7 +104,7 @@ create_model() {
|
|||
display_models
|
||||
|
||||
# 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
|
||||
|
||||
model=$(select_model "$base_model")
|
||||
|
@ -113,11 +113,11 @@ create_model() {
|
|||
ollama pull "$model"
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
if [ -z "$temperature" ]; then
|
||||
|
@ -125,7 +125,7 @@ create_model() {
|
|||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# Create the Modelfile
|
||||
|
@ -155,8 +155,8 @@ remove_model() {
|
|||
installed_models=$(ollama list)
|
||||
printf "%b\n" "${installed_models}"
|
||||
|
||||
printf "%b\n" "${YELLOW}Please select a model to remove:${RC}"
|
||||
printf "%b\n" "${YELLOW}Enter the name of the model you want to remove:${RC}"
|
||||
printf "%b" "Please select a model to remove: "
|
||||
printf "%b" "Enter the name of the model you want to remove: "
|
||||
|
||||
read -r model_to_remove
|
||||
|
||||
|
@ -174,14 +174,14 @@ menu() {
|
|||
while true; do
|
||||
clear
|
||||
printf "%b\n" "${YELLOW}Please select an option:${RC}"
|
||||
printf "1) List all models\n"
|
||||
printf "2) Show model information\n"
|
||||
printf "3) Create a new model\n"
|
||||
printf "4) Run a model\n"
|
||||
printf "5) Remove a model\n"
|
||||
printf "6) Exit\n"
|
||||
printf "%b\n" "1) List all models"
|
||||
printf "%b\n" "2) Show model information"
|
||||
printf "%b\n" "3) Create a new model"
|
||||
printf "%b\n" "4) Run a model"
|
||||
printf "%b\n" "5) Remove a model"
|
||||
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
|
||||
|
||||
case $choice in
|
||||
|
|
|
@ -74,7 +74,7 @@ apply_or_remove_auto_cpufreq() {
|
|||
# Prompt user for action
|
||||
printf "%b\n" "${YELLOW}Do you want to apply the auto-cpufreq tweak or remove it?${RC}"
|
||||
printf "%b\n" "${YELLOW}1) Apply tweak${RC}"
|
||||
printf "%b\n" "${YELLOW}2) Remove tweak${RC}"
|
||||
printf "%b\n" "${YELLOW}2) Remove tweak${RC}"
|
||||
printf "%b" "Enter your choice [1/2]: "
|
||||
read -r choice
|
||||
|
||||
|
|
|
@ -9,21 +9,21 @@ SCRIPT_DIR="./services"
|
|||
# Function to show the main menu
|
||||
show_menu() {
|
||||
clear
|
||||
printf "============================\n"
|
||||
printf " Service Management Menu\n"
|
||||
printf "============================\n"
|
||||
printf "1. View all services\n"
|
||||
printf "2. View enabled services\n"
|
||||
printf "3. View disabled services\n"
|
||||
printf "4. Add a new service\n"
|
||||
printf "5. Remove a service\n"
|
||||
printf "6. Start a service\n"
|
||||
printf "7. Stop a service\n"
|
||||
printf "8. Enable a service\n"
|
||||
printf "9. Disable a service\n"
|
||||
printf "10. Create a service from external scripts\n"
|
||||
printf "11. Exit\n"
|
||||
printf "============================\n"
|
||||
printf "%b\n" "============================"
|
||||
printf "%b\n" "Service Management Menu"
|
||||
printf "%b\n" "============================"
|
||||
printf "%b\n" "1. View all services"
|
||||
printf "%b\n" "2. View enabled services"
|
||||
printf "%b\n" "3. View disabled services"
|
||||
printf "%b\n" "4. Add a new service"
|
||||
printf "%b\n" "5. Remove a service"
|
||||
printf "%b\n" "6. Start a service"
|
||||
printf "%b\n" "7. Stop a service"
|
||||
printf "%b\n" "8. Enable a service"
|
||||
printf "%b\n" "9. Disable a service"
|
||||
printf "%b\n" "10. Create a service from external scripts"
|
||||
printf "%b\n" "11. Exit"
|
||||
printf "%b\n" "============================"
|
||||
}
|
||||
|
||||
# Function to view all services
|
||||
|
@ -53,27 +53,27 @@ view_started_services() {
|
|||
# Function to add a new service
|
||||
add_service() {
|
||||
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
|
||||
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=""
|
||||
fi
|
||||
done
|
||||
|
||||
printf "Enter the description of the service:\n"
|
||||
printf "%b" "Enter the description of the service: "
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
# Create the service unit file
|
||||
|
@ -81,17 +81,17 @@ add_service() {
|
|||
|
||||
# Create the service file with conditionals for optional fields
|
||||
{
|
||||
printf "[Unit]\n"
|
||||
printf "Description=$SERVICE_DESCRIPTION\n"
|
||||
printf "%b\n" "[Unit]"
|
||||
printf "%b\n" "Description=$SERVICE_DESCRIPTION"
|
||||
printf "\n"
|
||||
printf "[Service]\n"
|
||||
printf "ExecStart=$EXEC_START\n"
|
||||
printf "%b\n" "[Service]"
|
||||
printf "%b\n" "ExecStart=$EXEC_START"
|
||||
[ -n "$SERVICE_USER" ] && printf "%b\n" "User=$SERVICE_USER"
|
||||
[ -n "$WORKING_DIRECTORY" ] && printf "%b\n" "WorkingDirectory=$WORKING_DIRECTORY"
|
||||
[ -n "$RESTART_POLICY" ] && printf "%b\n" "Restart=$RESTART_POLICY"
|
||||
printf "\n"
|
||||
printf "[Install]\n"
|
||||
printf "WantedBy=multi-user.target\n"
|
||||
printf "%b\n" "[Install]"
|
||||
printf "%b\n" "WantedBy=multi-user.target"
|
||||
} | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null
|
||||
|
||||
# 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."
|
||||
|
||||
# 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
|
||||
|
||||
if [ "$START_ENABLE" = "y" ]; then
|
||||
if [ "$START_ENABLE" = "y" ] || [ "$START_ENABLE" = "Y" ]; then
|
||||
"$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"
|
||||
"$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"
|
||||
printf "%b\n" "Service $SERVICE_NAME has been started and enabled."
|
||||
|
@ -114,7 +114,7 @@ add_service() {
|
|||
|
||||
# Function to remove a 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
|
||||
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME.service"
|
||||
|
@ -124,7 +124,7 @@ remove_service() {
|
|||
"$ESCALATION_TOOL" systemctl stop "$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" systemctl daemon-reload
|
||||
printf "%b\n" "Service $SERVICE_NAME has been removed."
|
||||
|
@ -136,7 +136,7 @@ remove_service() {
|
|||
# Function to start a service
|
||||
start_service() {
|
||||
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
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then
|
||||
|
@ -149,7 +149,7 @@ start_service() {
|
|||
# Function to stop a service
|
||||
stop_service() {
|
||||
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
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then
|
||||
|
@ -162,7 +162,7 @@ stop_service() {
|
|||
# Function to enable a service
|
||||
enable_service() {
|
||||
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
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then
|
||||
|
@ -175,7 +175,7 @@ enable_service() {
|
|||
# Function to enable a service
|
||||
disable_service() {
|
||||
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
|
||||
|
||||
if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then
|
||||
|
@ -189,14 +189,14 @@ disable_service() {
|
|||
create_service_from_external() {
|
||||
|
||||
# List all .service files in the SCRIPT_DIR
|
||||
printf "============================\n"
|
||||
printf "Listing available service files\n"
|
||||
printf "============================\n"
|
||||
printf "%b\n" "============================"
|
||||
printf "%b\n" "Listing available service files"
|
||||
printf "%b\n" "============================"
|
||||
for FILE in "$SCRIPT_DIR"/*.service; do
|
||||
printf "%s\n" "$(basename "$FILE")"
|
||||
printf "%b\n" "$(basename "$FILE")"
|
||||
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
|
||||
|
||||
SERVICE_FILE="$SCRIPT_DIR/$SERVICE_NAME.service"
|
||||
|
@ -206,7 +206,7 @@ create_service_from_external() {
|
|||
return
|
||||
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
|
||||
|
||||
# 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."
|
||||
|
||||
# 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
|
||||
|
||||
if [ "$START_ENABLE" = "y" ]; then
|
||||
|
@ -248,7 +248,7 @@ create_service_from_external() {
|
|||
main() {
|
||||
while true; do
|
||||
show_menu
|
||||
printf "Enter your choice:\n"
|
||||
printf "%b" "Enter your choice: "
|
||||
read -r CHOICE
|
||||
|
||||
case $CHOICE in
|
||||
|
@ -262,11 +262,11 @@ main() {
|
|||
8) enable_service ;;
|
||||
9) disable_service ;;
|
||||
10) create_service_from_external ;;
|
||||
11) printf "Exiting...\n"; exit 0 ;;
|
||||
*) printf "Invalid choice. Please try again.\n" ;;
|
||||
11) printf "%b\n" "Exiting..."; exit 0 ;;
|
||||
*) printf "%b\n" "Invalid choice. Please try again." ;;
|
||||
esac
|
||||
|
||||
printf "Press [Enter] to continue...\n"
|
||||
printf "%b\n" "Press [Enter] to continue..."
|
||||
read -r dummy
|
||||
done
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ show_available_hosts() {
|
|||
|
||||
# Function to ask for host details
|
||||
ask_for_host_details() {
|
||||
printf "%b\n" "Enter Host Alias: "
|
||||
printf "%b" "Enter 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
|
||||
printf "%b\n" "Enter Remote User: "
|
||||
printf "%b" "Enter Remote User: "
|
||||
read -r user
|
||||
{
|
||||
printf "%b\n" "Host $host_alias"
|
||||
|
@ -46,7 +46,7 @@ generate_ssh_key() {
|
|||
|
||||
# Function to share the SSH public key with the remote host
|
||||
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
|
||||
printf "%b\n" "Copying SSH key to $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" "Enter the alias of the host: "
|
||||
read -r host_alias
|
||||
printf "%b\n"
|
||||
ssh $host_alias "
|
||||
printf "\n"
|
||||
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/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config &&
|
||||
|
@ -75,7 +75,7 @@ enable_password_auth() {
|
|||
printf "%b\n" "Enter the alias of the host: "
|
||||
read -r host_alias
|
||||
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/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config &&
|
||||
|
@ -87,63 +87,63 @@ enable_password_auth() {
|
|||
|
||||
# Function to check if password authentication is disabled
|
||||
check_password_auth() {
|
||||
printf "%b\n" "Enter the alias of the host: "
|
||||
printf "%b" "Enter the alias of the host: "
|
||||
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
|
||||
run_remote_command() {
|
||||
printf "%b\n" "Enter the alias of the host: "
|
||||
printf "%b" "Enter the alias of the host: "
|
||||
read -r host_alias
|
||||
printf "%b\n" "Enter the command to run: "
|
||||
printf "%b" "Enter the command to run: "
|
||||
read -r remote_command
|
||||
ssh $host_alias "$remote_command"
|
||||
ssh "$host_alias" "$remote_command"
|
||||
}
|
||||
|
||||
# Function to copy a file to a remote server
|
||||
copy_file_to_remote() {
|
||||
printf "%b\n" "Enter the local file path: "
|
||||
printf "%b" "Enter the local file path: "
|
||||
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
|
||||
printf "%b\n" "Enter the remote destination path: "
|
||||
printf "%b" "Enter the remote destination 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
|
||||
copy_directory_to_remote() {
|
||||
printf "%b\n" "Enter the local directory path: "
|
||||
printf "%b" "Enter the local directory path: "
|
||||
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
|
||||
printf "%b\n" "Enter the remote destination path: "
|
||||
printf "%b" "Enter the remote destination 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)
|
||||
move_file_to_remote() {
|
||||
printf "%b\n" "Enter the local file path: "
|
||||
printf "%b" "Enter the local file path: "
|
||||
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
|
||||
printf "%b\n" "Enter the remote destination path: "
|
||||
printf "%b" "Enter the remote destination 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)
|
||||
move_directory_to_remote() {
|
||||
printf "%b\n" "Enter the local directory path: "
|
||||
printf "%b" "Enter the local directory path: "
|
||||
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
|
||||
printf "%b\n" "Enter the remote destination path: "
|
||||
printf "%b" "Enter the remote destination 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
|
||||
|
@ -173,25 +173,25 @@ backup_files() {
|
|||
read -r remote_files
|
||||
printf "%b\n" "Enter the local backup directory path: "
|
||||
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
|
||||
sync_directories() {
|
||||
printf "%b\n" "Enter the local directory path: "
|
||||
printf "%b" "Enter the local directory path: "
|
||||
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
|
||||
printf "%b\n" "Enter the remote directory path: "
|
||||
printf "%b" "Enter the remote directory path: "
|
||||
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
|
||||
check_ssh_key_authentication() {
|
||||
printf "%b\n" "Enter the alias of the host: "
|
||||
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
|
||||
|
@ -215,7 +215,7 @@ show_menu() {
|
|||
printf "%b\n" "16. Backup files from remote host"
|
||||
printf "%b\n" "17. Sync directories with remote host"
|
||||
printf "%b\n" "18. Exit"
|
||||
printf "%b\n" "Enter your choice: "
|
||||
printf "%b" "Enter your choice: "
|
||||
}
|
||||
|
||||
# Function to execute the selected SSH operation
|
||||
|
@ -225,7 +225,7 @@ main() {
|
|||
read -r choice
|
||||
case $choice in
|
||||
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 ;;
|
||||
4) share_ssh_key ;;
|
||||
5) disable_password_auth ;;
|
||||
|
@ -249,4 +249,4 @@ done
|
|||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
main
|
||||
main
|
|
@ -48,9 +48,9 @@ list_devices() {
|
|||
|
||||
# Function to create a new 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
|
||||
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
|
||||
|
||||
if [ -z "$COMMENT" ] && [ -z "$TAG" ]; then
|
||||
|
@ -75,14 +75,14 @@ create_snapshot() {
|
|||
restore_snapshot() {
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
else
|
||||
printf "%b\n" "${CYAN}Enter GRUB device (e.g., /dev/sda): ${RC}"
|
||||
|
@ -101,7 +101,7 @@ restore_snapshot() {
|
|||
delete_snapshot() {
|
||||
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
|
||||
|
||||
printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}"
|
||||
|
@ -117,10 +117,10 @@ delete_snapshot() {
|
|||
# Function to delete all snapshots
|
||||
delete_all_snapshots() {
|
||||
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
|
||||
|
||||
if [ "$CONFIRMATION" = "yes" ]; then
|
||||
if [ "$CONFIRMATION" = "y" ] || [ "$CONFIRMATION" = "Y" ]; then
|
||||
printf "%b\n" "${CYAN}Deleting all snapshots...${RC}"
|
||||
"$ESCALATION_TOOL" timeshift --delete-all --yes
|
||||
if [ $? -eq 0 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ execute_command() {
|
|||
# Function to detect connected monitors
|
||||
detect_connected_monitors() {
|
||||
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
|
||||
|
@ -75,7 +75,7 @@ get_unique_resolutions() {
|
|||
confirm_action() {
|
||||
action="$1"
|
||||
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
|
||||
if echo "$confirm" | grep -qE '^[Yy]$'; then
|
||||
return 0
|
||||
|
|
|
@ -38,14 +38,14 @@ main_menu() {
|
|||
clear
|
||||
printf "%b\n" "${YELLOW}WiFi Manager${RC}"
|
||||
printf "%b\n" "${YELLOW}============${RC}"
|
||||
printf "1. Turn WiFi On\n"
|
||||
printf "2. Turn WiFi Off\n"
|
||||
printf "3. Scan for WiFi networks\n"
|
||||
printf "4. Connect to a WiFi network\n"
|
||||
printf "5. Disconnect from a WiFi network\n"
|
||||
printf "6. Remove a WiFi connection\n"
|
||||
printf "0. Exit\n"
|
||||
printf "Choose an option: "
|
||||
printf "%b\n" "1. Turn WiFi On"
|
||||
printf "%b\n" "2. Turn WiFi Off"
|
||||
printf "%b\n" "3. Scan for WiFi networks"
|
||||
printf "%b\n" "4. Connect to a WiFi network"
|
||||
printf "%b\n" "5. Disconnect from a WiFi network"
|
||||
printf "%b\n" "6. Remove a WiFi connection"
|
||||
printf "%b\n" "0. Exit"
|
||||
printf "%b" "Choose an option: "
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
|
@ -72,7 +72,7 @@ scan_networks() {
|
|||
printf "%b\n" "${GREEN}Top 10 Networks found:${RC}"
|
||||
echo "$networks" | awk -F: '{printf("%d. SSID: %-25s \n", NR, $1)}'
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ wifi_on() {
|
|||
} || {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ wifi_off() {
|
|||
} || {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ prompt_for_network() {
|
|||
networks=$(nmcli -t -f SSID dev wifi list | awk -F: '!seen[$1]++' | grep -v '^$')
|
||||
if [ -z "$networks" ]; then
|
||||
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
|
||||
rm -f "$temp_file"
|
||||
return
|
||||
|
@ -126,18 +126,18 @@ prompt_for_network() {
|
|||
i=1
|
||||
while IFS= read -r network; do
|
||||
ssid=$(echo "$network" | awk -F: '{print $1}')
|
||||
printf "%d. SSID: %s\n" "$i" "$ssid"
|
||||
printf "%b\n" "$i. SSID: " "$ssid"
|
||||
i=$((i + 1))
|
||||
done < "$temp_file"
|
||||
|
||||
printf "0. Exit to main menu\n"
|
||||
printf "%s" "$prompt_msg"
|
||||
printf "%b\n" "0. Exit to main menu"
|
||||
printf "%b" "$prompt_msg"
|
||||
read -r choice
|
||||
|
||||
if [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then
|
||||
ssid=$(sed -n "${choice}p" "$temp_file" | awk -F: '{print $1}')
|
||||
if [ "$action" = "connect" ]; then
|
||||
printf "Enter password for SSID %s: " "$ssid"
|
||||
printf "%b" "Enter password for SSID: " "$ssid"
|
||||
read -r password
|
||||
printf "\n"
|
||||
nmcli dev wifi connect "$ssid" password "$password" && {
|
||||
|
@ -150,7 +150,7 @@ prompt_for_network() {
|
|||
printf "%b\n" "${RED}Invalid choice. Please try again.${RC}"
|
||||
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
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user