diff mbox series

[[meta-arago,tisdk-setup-scripts,master] ] setup.sh : Make Linux SDK setup script interactive

Message ID 20220919111446.21263-1-p-bhagat@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [[meta-arago,tisdk-setup-scripts,master] ] setup.sh : Make Linux SDK setup script interactive | expand

Commit Message

Paresh Bhagat Sept. 19, 2022, 11:14 a.m. UTC
- Add functionality to tell what setup.sh is about to run and give option to either select or skip that step.
- Jira - https://jira.itg.ti.com/browse/SITREQ-795

Signed-off-by: Paresh Bhagat <p-bhagat@ti.com>
---
 setup.sh | 133 ++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 98 insertions(+), 35 deletions(-)
diff mbox series

Patch

diff --git a/setup.sh b/setup.sh
index fc4c6c7..f002e72 100644
--- a/setup.sh
+++ b/setup.sh
@@ -50,6 +50,58 @@  how to develop software on the EVM
 EOF
 }
 
+
+
+run_package_install() {
+	if [ -f $cwd/bin/setup-package-install.sh ]; then
+     		$cwd/bin/setup-package-install.sh
+     		check_status
+	else
+    		echo "setup-package-install.sh does not exist in the bin directory"
+    		exit 1
+	fi
+}
+
+run_target_nfs() {
+	if [ -f $cwd/bin/setup-targetfs-nfs.sh ]; then
+    		$cwd/bin/setup-targetfs-nfs.sh
+    		check_status
+	else
+    		echo "setup-targetfs-nfs.sh does not exist in the bin directory"
+    		exit 1
+	fi
+}
+
+run_tftp() {
+	if [ -f $cwd/bin/setup-tftp.sh ]; then
+    		$cwd/bin/setup-tftp.sh
+    		check_status
+	else
+    		echo "setup-tftp.sh does not exist in the bin directory"
+    		exit 1
+	fi
+}
+
+run_minicom() {
+	if [ -f $cwd/bin/setup-minicom.sh ]; then
+    		$cwd/bin/setup-minicom.sh
+    		check_status
+	else
+    		echo "setup-minicom.sh does not exist in the bin directory"
+    		exit 1
+	fi
+}
+
+run_uboot() {
+	if [ -f $cwd/bin/setup-uboot-env.sh ]; then
+    		$cwd/bin/setup-uboot-env.sh
+    		check_status
+	else
+    		echo "setup-uboot-env.sh does not exist in the bin directory"
+    		exit 1
+	fi
+}
+
 cwd=`dirname $0`
 # Minimum major Linux version for running add-to-group script
 min_ver_upper=12
@@ -86,45 +138,56 @@  if [ "$host_upper" -gt "$min_ver_upper" -o "$host_upper" -eq "$min_ver_upper" ];
     fi
 fi
 
-if [ -f $cwd/bin/setup-package-install.sh ]; then
-     $cwd/bin/setup-package-install.sh
-     check_status
-else
-    echo "setup-package-install.sh does not exist in the bin directory"
-    exit 1
-fi
 
-if [ -f $cwd/bin/setup-targetfs-nfs.sh ]; then
-    $cwd/bin/setup-targetfs-nfs.sh
-    check_status
-else
-    echo "setup-targetfs-nfs.sh does not exist in the bin directory"
-    exit 1
-fi
+while true; do
+    read -p "Do you wish to install required host packages (Press (Y) to run, (n) to skip)? " -r response
+    case $response in
+        [Yy]* ) run_package_install; break;;
+        [Nn]* ) echo "host packages installation skipped"; break;;
+	   "" ) run_package_install; break;; 
+	    * )  echo "Enter Y/n";;
+    esac
+done
 
-if [ -f $cwd/bin/setup-tftp.sh ]; then
-    $cwd/bin/setup-tftp.sh
-    check_status
-else
-    echo "setup-tftp.sh does not exist in the bin directory"
-    exit 1
-fi
+while true; do
+    read -p "Do you wish to run nfs setup (Press (Y) to run, (n) to skip) ? " -r response
+    case $response in
+        [Yy]* ) run_target_nfs; break;;
+        [Nn]* ) echo "nfs setup skipped"; break;;
+	   "" ) run_target_nfs; break;;
+	    * )  echo "Enter Y/n";;
+    esac
+done
 
-if [ -f $cwd/bin/setup-minicom.sh ]; then
-    $cwd/bin/setup-minicom.sh
-    check_status
-else
-    echo "setup-minicom.sh does not exist in the bin directory"
-    exit 1
-fi
+while true; do
+    read -p "Do you wish to run tftp setup (Press (Y) to run, (n) to skip) ? " -r response
+    case $response in
+        [Yy]* ) run_tftp; break;;
+        [Nn]* ) echo "tftp setup skipped"; break;;
+	   "" ) run_tftp; break;;
+	    * )  echo "Enter Y/n";;
+    esac
+done
 
-if [ -f $cwd/bin/setup-uboot-env.sh ]; then
-    $cwd/bin/setup-uboot-env.sh
-    check_status
-else
-    echo "setup-uboot-env.sh does not exist in the bin directory"
-    exit 1
-fi
+while true; do
+    read -p "Do you wish to run minicom setup (Press (Y) to run, (n) to skip) ? " -r response
+    case $response in
+        [Yy]* ) run_minicom; break;;
+        [Nn]* ) echo "minicom setup skipped"; break;;
+	   "" ) run_minicom; break;;
+	    * )  echo "Enter Y/n";;
+    esac
+done
+
+while true; do
+    read -p "Do you wish to run uboot setup (Press (Y) to run, (n) to skip) ? " -r response
+    case $response in
+        [Yy]* ) run_uboot; break;;
+        [Nn]* ) echo "uboot setup skipped"; break;;
+	   "" ) run_uboot; break;;
+	    * )  echo "Enter Y/n";;
+    esac
+done
 
 # Publish the TISDK exit header
 exit_footer