Provide debug mode before recovery 59/242259/2 accepted/tizen/unified/20200828.121425 submit/tizen/20200828.071117
authorJeon Sang-Heon <sh95.jeon@samsung.com>
Tue, 25 Aug 2020 16:55:41 +0000 (16:55 +0000)
committerJeon Sang-Heon <sh95.jeon@samsung.com>
Fri, 28 Aug 2020 16:10:13 +0000 (16:10 +0000)
- Debug mode file : /opt/usr/.recovery_debug

Change-Id: I575848838d27bc18ee212c028168b1c677220f13
Signed-off-by: Jeon Sang-Heon <sh95.jeon@samsung.com>
scripts/recovery-init.in

index c0cb1590751c00b800674eb15c8dec6b0bc82028..7f7dd9e03aaf2051cba903f209ac8b3e9dce011f 100644 (file)
@@ -88,6 +88,24 @@ mount_partitions() {
     mount_usb_partitions
 }
 
+check_debug_file() {
+    echo "check debug files"
+    DEBUG_MODE_FILE=${FAKE_ROOT}/opt/usr/.recovery_debug
+    if [ -f ${DEBUG_MODE_FILE} ]; then
+        DEBUG_MODE_FILE_OWNER=$(${LS} -l ${DEBUG_MODE_FILE} | ${CUT} -d " " -f 3)
+        if [ "${DEBUG_MODE_FILE_OWNER}" = "0" ]; then
+            echo "Enter recovery debug mode"
+            echo "If you want to continue recovery, please remove ${DEBUG_MODE_FILE}"
+            # Wait until debug mode file is removed
+            while [ -f ${DEBUG_MODE_FILE} ]; do
+                sleep 3
+            done
+        else
+            echo "Warning: somebody make non-root debug mode file... ignore it"
+        fi
+    fi
+}
+
 #------------------------------------------------
 #       umount_usb_partitions
 #------------------------------------------------
@@ -136,7 +154,9 @@ echo "Starting system recovery."
 mount_partitions
 
 # For debugging - It should be deleted on Release
-/sbin/agetty -l /bin/sh -n --keep-baud 115200,38400,9600 ttyS1 linux &
+/sbin/agetty -l /bin/sh -n --keep-baud 115200,38400,9600 ttyS0 linux &
+
+check_debug_file
 
 [ -x "${SYSTEM_RECOVERY_GUI}" ] && "${SYSTEM_RECOVERY_GUI}" &
 [ -x "${SYSTEM_RECOVERY}" ] && "${SYSTEM_RECOVERY}"