Move scripts around & refactor existing ones (#573)

* Refactor existing shell scripts & moving scripts around

* attempt to fix conflicts

* fix extra space

* fix lowercase Y issues

* Fix conflicts

* fix scattered stuff around toml

* fix syntax issue

---------

Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
Nyx 2024-09-22 13:59:39 -04:00 committed by GitHub
parent 072645bc9b
commit 64e8492c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 59 additions and 56 deletions

14
core/tabs/applications-setup/browser-setup.sh Normal file → Executable file
View File

@ -3,8 +3,8 @@
. ../common-script.sh . ../common-script.sh
install_chrome() { install_chrome() {
printf "%b\n" "${YELLOW}Installing Google Chrome..${RC}."
if ! command_exists google-chrome; then if ! command_exists google-chrome; then
printf "%b\n" "${YELLOW}Installing Google Chrome..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
@ -33,8 +33,8 @@ install_chrome() {
} }
install_thorium() { install_thorium() {
printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}"
if ! command_exists thorium-browser; then if ! command_exists thorium-browser; then
printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list "$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list
@ -59,8 +59,8 @@ install_thorium() {
} }
install_firefox() { install_firefox() {
printf "%b\n" "${YELLOW}Installing Mozilla Firefox...${RC}"
if ! command_exists firefox; then if ! command_exists firefox; then
printf "%b\n" "${YELLOW}Installing Mozilla Firefox...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y firefox-esr "$ESCALATION_TOOL" "$PACKAGER" install -y firefox-esr
@ -85,8 +85,8 @@ install_firefox() {
} }
install_librewolf() { install_librewolf() {
printf "%b\n" "${YELLOW}Installing Librewolf...${RC}"
if ! command_exists librewolf; then if ! command_exists librewolf; then
printf "%b\n" "${YELLOW}Installing Librewolf...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates "$ESCALATION_TOOL" "$PACKAGER" install -y gnupg lsb-release apt-transport-https ca-certificates
@ -124,8 +124,8 @@ Signed-By: /usr/share/keyrings/librewolf.gpg" | "$ESCALATION_TOOL" tee /etc/apt/
} }
install_brave() { install_brave() {
printf "%b\n" "${YELLOW}Installing Brave...${RC}"
if ! command_exists brave; then if ! command_exists brave; then
printf "%b\n" "${YELLOW}Installing Brave...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y curl "$ESCALATION_TOOL" "$PACKAGER" install -y curl
@ -173,8 +173,8 @@ install_vivaldi() {
} }
install_chromium() { install_chromium() {
printf "%b\n" "${YELLOW}Installing Chromium...${RC}"
if ! command_exists chromium; then if ! command_exists chromium; then
printf "%b\n" "${YELLOW}Installing Chromium...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala|zypper) apt-get|nala|zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y chromium "$ESCALATION_TOOL" "$PACKAGER" install -y chromium
@ -197,8 +197,8 @@ install_chromium() {
} }
install_lynx() { install_lynx() {
printf "%b\n" "${YELLOW}Installing Lynx...${RC}"
if ! command_exists lynx; then if ! command_exists lynx; then
printf "%b\n" "${YELLOW}Installing Lynx...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm lynx "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm lynx

View File

@ -9,7 +9,7 @@ choose_installation() {
printf "%b\n" "1. ${YELLOW}Docker${RC}" printf "%b\n" "1. ${YELLOW}Docker${RC}"
printf "%b\n" "2. ${YELLOW}Docker Compose${RC}" printf "%b\n" "2. ${YELLOW}Docker Compose${RC}"
printf "%b\n" "3. ${YELLOW}Both${RC}" printf "%b\n" "3. ${YELLOW}Both${RC}"
printf "Enter your choice [1-3]: " printf "%b" "Enter your choice [1-3]: "
read -r CHOICE read -r CHOICE
case "$CHOICE" in case "$CHOICE" in

View File

@ -3,8 +3,8 @@
. ../common-script.sh . ../common-script.sh
install_onlyoffice() { install_onlyoffice() {
printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
if ! command_exists onlyoffice-desktopeditors; then if ! command_exists onlyoffice-desktopeditors; then
printf "%b\n" "${YELLOW}Installing Only Office..${RC}."
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb curl -O https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb
@ -28,8 +28,8 @@ install_onlyoffice() {
} }
install_libreoffice() { install_libreoffice() {
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
if ! command_exists libreoffice; then if ! command_exists libreoffice; then
printf "%b\n" "${YELLOW}Installing Libre Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core "$ESCALATION_TOOL" "$PACKAGER" install -y libreoffice-core
@ -52,8 +52,8 @@ install_libreoffice() {
} }
install_wpsoffice() { install_wpsoffice() {
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
if ! command_exists com.wps.Office; then if ! command_exists com.wps.Office; then
printf "%b\n" "${YELLOW}Installing WPS Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$AUR_HELPER" -S --noconfirm wps-office "$AUR_HELPER" -S --noconfirm wps-office
@ -70,6 +70,7 @@ install_wpsoffice() {
# needs to be updated every year for latest version # needs to be updated every year for latest version
install_freeoffice() { install_freeoffice() {
if ! command_exists softmaker-freeoffice-2024 freeoffice softmaker; then
printf "%b\n" "${YELLOW}Installing Free Office...${RC}" printf "%b\n" "${YELLOW}Installing Free Office...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
apt-get|nala) apt-get|nala)
@ -93,11 +94,14 @@ install_freeoffice() {
exit 1 exit 1
;; ;;
esac esac
else
printf "%b\n" "${GREEN}Free Office is already installed.${RC}"
fi
} }
install_evince() { install_evince() {
printf "%b\n" "${YELLOW}Installing Evince...${RC}"
if ! command_exists evince; then if ! command_exists evince; then
printf "%b\n" "${YELLOW}Installing Evince...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm evince "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm evince
@ -112,8 +116,8 @@ install_evince() {
} }
install_okular() { install_okular() {
printf "%b\n" "${YELLOW}Installing Evince...${RC}"
if ! command_exists okular; then if ! command_exists okular; then
printf "%b\n" "${YELLOW}Installing Okular...${RC}"
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm okular "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm okular
@ -128,8 +132,8 @@ install_okular() {
} }
install_pdfstudioviewer() { install_pdfstudioviewer() {
printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}"
if ! command_exists pdfstudioviewer2024/pdfstudioviewer2024; then if ! command_exists pdfstudioviewer2024/pdfstudioviewer2024; then
printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}"
curl -O https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.sh curl -O https://download.qoppa.com/pdfstudioviewer/PDFStudioViewer_linux64.sh
"$ESCALATION_TOOL" chmod +x PDFStudioViewer_linux64.sh "$ESCALATION_TOOL" chmod +x PDFStudioViewer_linux64.sh
if sh PDFStudioViewer_linux64.sh; then if sh PDFStudioViewer_linux64.sh; then
@ -144,8 +148,8 @@ install_pdfstudioviewer() {
} }
install_pdfstudio() { install_pdfstudio() {
printf "%b\n" "${YELLOW}Installing PDF Studio Viewer...${RC}"
if ! command_exists pdfstudio2024/pdfstudio2024; then if ! command_exists pdfstudio2024/pdfstudio2024; then
printf "%b\n" "${YELLOW}Installing PDF Studio...${RC}"
curl -O https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh curl -O https://download.qoppa.com/pdfstudio/PDFStudio_linux64.sh
"$ESCALATION_TOOL" chmod +x PDFStudio_linux64.sh "$ESCALATION_TOOL" chmod +x PDFStudio_linux64.sh
if sh PDFStudio_linux64.sh; then if sh PDFStudio_linux64.sh; then
@ -159,7 +163,6 @@ install_pdfstudio() {
fi fi
} }
officeSuiteSetup() { officeSuiteSetup() {
clear clear
printf "%b\n" "Office Suite Setup Script" printf "%b\n" "Office Suite Setup Script"

14
core/tabs/applications-setup/setup-flatpak.sh Normal file → Executable file
View File

@ -25,24 +25,14 @@ setup_flatpak() {
pacman) pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak
;; ;;
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak # Fedora should have flatpak already installed, this is just a failsafe
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak
exit 1
;; ;;
esac esac
printf "%b\n" "Adding Flathub remote..." printf "%b\n" "Adding Flathub remote..."
"$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
else else
if command -v flatpak >/dev/null 2>&1; then if command_exists flatpak; then
if ! flatpak remotes | grep -q "flathub"; then if ! flatpak remotes | grep -q "flathub"; then
printf "%b" "${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

View File

@ -124,6 +124,11 @@ description = "DWM is a dynamic window manager for X.\nIt manages windows in til
script = "dwmtitus-setup.sh" script = "dwmtitus-setup.sh"
task_list = "installation, privileged file modification, systemd actions" task_list = "installation, privileged file modification, systemd actions"
[[data]]
name = "Docker"
script = "docker-setup.sh"
task_list = "installation, systemd actions"
[[data]] [[data]]
name = "Fastfetch" name = "Fastfetch"
description = "Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.\nIt is written mainly in C, with performance and customizability in mind.\nThis command installs fastfetch and configures from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash" description = "Fastfetch is a neofetch-like tool for fetching system information and displaying it prettily.\nIt is written mainly in C, with performance and customizability in mind.\nThis command installs fastfetch and configures from CTT's mybash repository.\nhttps://github.com/ChrisTitusTech/mybash"
@ -136,6 +141,11 @@ description = "Flatpak is a universal application sandbox for Linux that uses is
script = "setup-flatpak.sh" script = "setup-flatpak.sh"
task_list = "installation" task_list = "installation"
[[data]]
name = "Grub Theme"
script = "grub-theme.sh"
task_list = "privileged file modification"
[[data]] [[data]]
name = "Kitty" name = "Kitty"
description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty." description = "kitty is a free and open-source GPU-accelerated terminal emulator for Linux, macOS, and some BSD distributions, focused on performance and features.\nkitty is written in a mix of C and Python programming languages.\n This command installs and configures kitty."

View File

@ -40,7 +40,7 @@ common_cleanup() {
} }
clean_data() { clean_data() {
printf "%b\n" "${YELLOW}Clean up old cache files and empty the trash? (y/N): ${RC}" printf "%b" "${YELLOW}Clean up old cache files and empty the trash? (y/N): ${RC}"
read -r clean_response read -r clean_response
case $clean_response in case $clean_response in
y|Y) y|Y)

View File

@ -63,11 +63,6 @@ description = "Enables Virtualization through dnf"
script = "fedora/virtualization.sh" script = "fedora/virtualization.sh"
task_list = "installation" task_list = "installation"
[[data]]
name = "Auto Mount Drive"
script = "auto-mount.sh"
task_list = "privileged file modification"
[[data]] [[data]]
name = "Build Prerequisites" name = "Build Prerequisites"
description = "This script is designed to handle the installation of various software dependencies across different Linux distributions" description = "This script is designed to handle the installation of various software dependencies across different Linux distributions"
@ -102,11 +97,6 @@ description = "This script is designed to handle the installation and configurat
script = "global-theme.sh" script = "global-theme.sh"
task_list = "installation, privileged file modification" task_list = "installation, privileged file modification"
[[data]]
name = "Grub Theme"
script = "grub-theme.sh"
task_list = "privileged file modification"
[[data]] [[data]]
name = "Remove Snaps" name = "Remove Snaps"
description = "This script is designed to remove snap" description = "This script is designed to remove snap"

View File

@ -68,16 +68,16 @@ setup_samba() {
if [ -f "$SAMBA_CONFIG" ]; then if [ -f "$SAMBA_CONFIG" ]; then
printf "%b\n" "${YELLOW}Samba configuration file already exists in $SAMBA_CONFIG.${RC}" printf "%b\n" "${YELLOW}Samba configuration file already exists in $SAMBA_CONFIG.${RC}"
printf "Do you want to modify the existing Samba configuration? (yes/no): " printf "%b" "Do you want to modify the existing Samba configuration? (Y/n): "
read -r MODIFY_SAMBA read -r MODIFY_SAMBA
if [ "$MODIFY_SAMBA" = "yes" ]; then if [ "$MODIFY_SAMBA" = "Y" ] || [ "$MODIFY_SAMBA" = "y" ]; then
"$ESCALATION_TOOL" "$EDITOR" "$SAMBA_CONFIG" "$ESCALATION_TOOL" "$EDITOR" "$SAMBA_CONFIG"
fi fi
else else
printf "%b\n" "${YELLOW}No existing Samba configuration found. Setting up a new one...${RC}" printf "%b\n" "${YELLOW}No existing Samba configuration found. Setting up a new one...${RC}"
# Prompt user for shared directory path # Prompt user for shared directory path
printf "Enter the path for the Samba share (default: /srv/samba/share): " printf "%b" "Enter the path for the Samba share (default: /srv/samba/share): "
read -r SHARED_DIR read -r SHARED_DIR
SHARED_DIR=${SHARED_DIR:-/srv/samba/share} SHARED_DIR=${SHARED_DIR:-/srv/samba/share}
@ -86,7 +86,7 @@ setup_samba() {
"$ESCALATION_TOOL" chmod -R 0777 "$SHARED_DIR" "$ESCALATION_TOOL" chmod -R 0777 "$SHARED_DIR"
# Add a new Samba user # Add a new Samba user
printf "Enter Samba username: " printf "%b" "Enter Samba username: "
read -r SAMBA_USER read -r SAMBA_USER
# Loop until the passwords match # Loop until the passwords match
@ -97,7 +97,7 @@ setup_samba() {
stty echo stty echo
printf "Confirm Samba password: " printf "Confirm Samba password: "
stty -echo stty -echo
read SAMBA_PASSWORD_CONFIRM read -r SAMBA_PASSWORD_CONFIRM
stty echo stty echo
printf "\n" printf "\n"
if [ "$SAMBA_PASSWORD" = "$SAMBA_PASSWORD_CONFIRM" ]; then if [ "$SAMBA_PASSWORD" = "$SAMBA_PASSWORD_CONFIRM" ]; then
@ -163,12 +163,12 @@ setup_ssh_samba(){
clear clear
# Display menu # Display menu
printf "Select an option:\n" printf "%b\n" "Select an option:"
printf "1. Setup SSH\n" printf "%b\n" "1. Setup SSH"
printf "2. Setup Samba\n" printf "%b\n" "2. Setup Samba"
printf "3. Configure Firewall\n" printf "%b\n" "3. Configure Firewall"
printf "4. Setup All\n" printf "%b\n" "4. Setup All"
printf "5. Exit\n" printf "%b\n" "5. Exit"
printf "%b" "Enter your choice (1-5): " printf "%b" "Enter your choice (1-5): "
read CHOICE read CHOICE

View File

@ -19,6 +19,11 @@ name = "Auto Detect Displays"
description = "This utility is designed to detect and apply recommended configuration for monitors connected with your system" description = "This utility is designed to detect and apply recommended configuration for monitors connected with your system"
script = "monitor-control/auto_detect_displays.sh" script = "monitor-control/auto_detect_displays.sh"
[[data]]
name = "Auto Mount Drive"
script = "auto-mount.sh"
task_list = "privileged file modification"
[[data.entries]] [[data.entries]]
name = "Change Orientation" name = "Change Orientation"
description = "This utility is designed to change the orientation of monitors in your system" description = "This utility is designed to change the orientation of monitors in your system"
@ -55,6 +60,11 @@ description = "This utility is designed to reset scaling of a monitor in your sy
script = "monitor-control/reset_scaling.sh" script = "monitor-control/reset_scaling.sh"
matches = true matches = true
[[data]]
name = "SSH-Samba"
script = "samba-ssh-setup.sh"
task_list = "installation, systemd actions, privileged file modification"
[[data.entries]] [[data.entries]]
name = "Scale Monitors" name = "Scale Monitors"
description = "This utility is designed to change the scaling of monitors in your system" description = "This utility is designed to change the scaling of monitors in your system"