Radix cross Linux

Radix Linux distribution for embedded systems.

637 Commits   4 Branches   3 Tags
author: Andrey V.Kosteltsev <kx@radix.pro> 2016-07-19 22:01:05 +0000 committer: Andrey V.Kosteltsev <kx@radix.pro> 2016-07-19 22:01:05 +0000 commit: 41968606a23cf837fb3a8fe181efe54fc704ed78 parent: ff5865e03ff832042353a19204df6d325a77c26a
Commit Summary:
radix-setup: more respect for the signals INT and TERM
Diffstat:
1 file changed, 38 insertions, 6 deletions
diff --git a/base/install-tools/sbin/radix-setup.in b/base/install-tools/sbin/radix-setup.in
index 8a62f8141..abb2de403 100644
--- a/base/install-tools/sbin/radix-setup.in
+++ b/base/install-tools/sbin/radix-setup.in
@@ -26,12 +26,18 @@ if [ ! -f /etc/system-installer ] ; then
     mkdir -p /tmp/radix/mnt
     MNT=/tmp/radix/mnt
   fi
-  trap 'for dir in "`find $MNT -type d -mindepth 1 -maxdepth 1`" ; do \
-          umount $dir 2> /dev/null ; \
-        done ; \
-        rm -rf $TMP' EXIT INT QUIT TERM
 fi
 
+trap 'for dir in "`find $MNT -type d -mindepth 1 -maxdepth 1`" ; do \
+        umount $dir 2> /dev/null ; \
+      done ; \
+      rm -rf $TMP ; \
+      clear ; \
+      head -c 100 /dev/zero | tr "\0" "\n" ; \
+      echo "ERROR: $program - has been terminated." ; \
+      echo "" ; \
+      exit 1' INT TERM
+
 
 default_toolchain=@TOOLCHAIN@
 default_hardware=@HARDWARE@
@@ -396,7 +402,7 @@ EOF
     elif [ "$RETVAL" = "Device" ]; then
       INSTALLTYPE=dev
       cat > $TMP/device-help$$ << EOF
---colors \\
+--colors --clear \\
 --backtitle "\Z7Radix\Zn \Z1Pro\Zn\Z7, Ltd.\Zn" \\
 --title " \Z0\ZbSelect the destination\ZB\Zn \Z1\ZbDEVICE:\ZB\Zn " \\
 --menu "\\n\\
@@ -424,7 +430,10 @@ EOF
       if [ $? = 1 -o $? = 255 ]; then
         rm -f $TMP/devmame$$
         rm -f $TMP/device-help$$
-        exit
+        usage
+        echo "ERROR: Destination should be specified."
+        EXITSTATUS=16
+        exit $EXITSTATUS
       fi
       result=`cat $TMP/devmame$$`
       rm -f $TMP/devmame$$
@@ -848,6 +857,13 @@ EOF
                        "$TMP/dd-output.$$"                       \
                        "$dosboot"
     fi
+    #
+    # NOTE:
+    # ====
+    #   If user chosed <No> or pressed Esc Button then next dialog
+    #   will allow him to continue ordinary setup or Exit Setup by
+    #   select corresponded menu item.
+    #
   fi
 }
 
@@ -1625,7 +1641,23 @@ ROOTFS_MPOINT=${MNT}/root
 if [ "$INSTALLTYPE" == "dev" ] ; then
   check_target_device
   prepare_target_disk
-  prepare_partitions "$TARGET_ROOT_DEVICE"
+
+  while [ 0 ] ; do
+    prepare_partitions "$TARGET_ROOT_DEVICE"
+    ret=$?
+    if [ $ret = 255 ]; then
+      # User can interrupt format partitions cycle by press Esc button
+      # on keyboard. In this case we have to exit setup because we not
+      # sure that user done all needs.  If user say Esc again, then we
+      # will return him back to the cycle until user press <Continue>.
+      exit_setup
+      continue
+    fi
+    if [ $ret = 1 ]; then
+      break
+    fi
+  done
+
   prepare_etc_fstab
 
   #