From a0b688fb43b26a36b98ed5cdfae34b0d6e1a82ad Mon Sep 17 00:00:00 2001 From: Hadi Chokr <158838697+silverhadch@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:33:12 +0200 Subject: [PATCH 1/2] Optimized Bash Script Execution Instead of pasting long lines it loops through the install_scripts folder and executes scripts whose name are provided. So if more scripts are added you simply put the name in the for loop and not bash blablabal then clear. Which is better and cleaner. --- install.sh | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index bc85f17..2b1a47e 100755 --- a/install.sh +++ b/install.sh @@ -42,32 +42,18 @@ echo " # chmod +x setup.sh packages.sh # Run the setup script -bash ~/sway/install_scripts/setup.sh - -clear - -# Run the extra packages -bash ~/sway/install_scripts/packages.sh - -clear - -echo "Make sure a Display Manager is installed" - -# make sure gdm3 is installed -bash ~/sway/install_scripts/gdm.sh - -clear - -# add bashrc question -bash ~/sway/install_scripts/add_bashrc.sh clear -bash ~/sway/install_scripts/printers.sh - -clear - -bash ~/sway/install_scripts/bluetooth.sh +for script in setup.sh packages.sh display_manager.sh add_bashrc.sh printers.sh bluetooth.sh ; do + script_path="$HOME/sway/install_scripts/$script" + if [ -x "$script_path" ]; then + bash "$script_path" + else + echo "Script $script_path not found or not executable. Skipping." + fi + clear +done sudo apt autoremove printf "\e[1;32mYou can now reboot! Thanks you.\e[0m\n" From 6973ebf50e4c520c11d57fa60397dc101614666b Mon Sep 17 00:00:00 2001 From: Hadi Chokr <158838697+silverhadch@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:56:35 +0200 Subject: [PATCH 2/2] Making it compatible with other PR --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 2b1a47e..8f7536f 100755 --- a/install.sh +++ b/install.sh @@ -45,7 +45,7 @@ echo " clear -for script in setup.sh packages.sh display_manager.sh add_bashrc.sh printers.sh bluetooth.sh ; do +for script in setup.sh packages.sh display_manager.sh add_bashrc.sh printers.sh bluetooth.sh addsession.sh; do script_path="$HOME/sway/install_scripts/$script" if [ -x "$script_path" ]; then bash "$script_path"