OSDN Git Service

Termination messages are simplified.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 21 Aug 2018 17:32:42 +0000 (01:32 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 21 Aug 2018 17:32:42 +0000 (01:32 +0800)
The full coiurse mode operation of portsreinstall-chroot is corrected to resume rationally.

 Changes to be committed:
modified:   lib/chroot/libcommand_do.sh
modified:   lib/chroot/libfs.sh
modified:   lib/libmain.sh
modified:   lib/libtemp.sh
modified:   lib/main/libmain.sh

lib/chroot/libcommand_do.sh
lib/chroot/libfs.sh
lib/libmain.sh
lib/libtemp.sh
lib/main/libmain.sh

index 98f0f77..bc25789 100644 (file)
@@ -53,6 +53,7 @@ eof
 command_do_chroot_enter_fullcourse ()
 {
        local shellcmd exitstatus
+       message_section_title "Full course main: Continue the reinstallation process"
        [ $opt_batch_mode = yes ] && opt_quiet='-a '
        chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -S $opt_quiet
 }
@@ -180,7 +181,7 @@ command_do_starter_portsnap ()
                local mode stdout
                [ $opt_fullcourse = no ] && return
                message_section_title "Full course starter: Update the ports tree"
-               if [ -e "$opt_basedir/var/db/portsnap/INDEX" ]
+               if [ -e "$opt_basedir/builder/var/db/portsnap/INDEX" ]
                then
                        mode=update
                else
@@ -252,24 +253,25 @@ command_do_main_init_resinst ()
                local exitstatus
                [ $opt_fullcourse = no ] && return
                message_section_title "Full course main: Initiate the reinstallation process"
-               if [ -e "$opt_basedir/builder/${DBDIR_PROG}/saved_options.sh" ]
+               if [ -e "$opt_basedir/builder/${DBDIR_PROG}/saved_options.sh" ]
                then
-                       opts=
-               elif [ $opt_batch_mode = no ]
-               then
-                       opts='-CGjqx'
-               else
-                       opts='-CGYajqx'
-               fi
-               if ! chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -S $opts
-               then
-                       exitstatus=$?
-                       message_echo "INFO: The last exit status in the builder chroot environment was non-zero." >&2
-                       command_do_chk_unionfs_error_at_chroot && \
-                               message_echo "INFO: Executing ${APPNAME} again may be sufficient for the troubleshooting." >&2
-                       exit $exitstatus
+                       if [ $opt_batch_mode = no ]
+                       then
+                               opts='-CGjqx'
+                       else
+                               opts='-CGYajqx'
+                       fi
+                       if ! chroot "$opt_basedir"/builder /usr/bin/env ${PROGRAM} -S $opts
+                       then
+                               exitstatus=$?
+                               program_register_stage_complete UPGRADE_GUEST
+                               message_echo "INFO: The last exit status in the builder chroot environment was non-zero." >&2
+                               command_do_chk_unionfs_error_at_chroot && \
+                                       message_echo "INFO: Executing ${APPNAME} again may be sufficient for the troubleshooting." >&2
+                               exit $exitstatus
+                       fi
+                       command_do_chroot_postprocess
                fi
-               command_do_chroot_postprocess
                program_register_stage_complete UPGRADE_GUEST
                message_echo
        }
index 59ae98f..0198b02 100644 (file)
@@ -480,11 +480,20 @@ fs_unmount ()
        [ ! -e "${DBDIR}/mount_manifest" ] && return
        if fs_chk_unmount > /dev/null
        then
-               message_echo "The builder chroot environment is already unmounted."
-               message_echo
+               if [ $TEMP_IN_TRAP = no ]
+               then
+                       message_echo "The builder chroot environment is already unmounted."
+                       message_echo
+               fi
                return
        fi
-       message_section_title "Unmounting the file systems for builder chroot."
+       if [ $TEMP_IN_TRAP = no ]
+       then
+               message_section_title "Unmounting the file systems for builder chroot."
+       else
+               message_echo
+               message_echo "Unmounting the file systems for builder chroot."
+       fi
        fs_gen_fstab unmount
        umount -F "${DBDIR}/fstab" -af 2> /dev/null || :
        itrial=${FS_UNMOUNT_RETIAL_MAXNUM}
index 272a598..b5ed502 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180822003807
+       MYVERSION=4.0.0+toward_4.1.0_20180822013227
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index 354b9cd..05e0e50 100644 (file)
@@ -16,19 +16,47 @@ temp_terminate_process () { :; }
 # ============= Warn when the temporary database is obsolete =============
 temp_warn_obsolete_temp_db () { :; }
 
+# ============= Creation of temporary work directories: Trap operation =============
+temp_trap_init__opetration ()
+{
+       local errno
+       errno=$1
+       set +x
+       TEMP_IN_TRAP=yes
+       temp_warn_obsolete_temp_db >&2 || :
+       temp_warn_obsolete_temp_db () { :; }
+       temp_terminate_process $errno >&2 || :
+       temp_terminate_process () { :; }
+       rm -rf "${TMPDIR}" 2> /dev/null
+       [ -n "${DBDIR}" -a x`cat "${DBDIR}/.lock" 2> /dev/null` = x$$ ] && rm -f "${DBDIR}/.lock"
+       [ $errno -gt 0 -a $errno -ne 130 -a $opt_batch_mode = no -a $opt_no_opening_message = no ] && echo "(Exit code: $errno)" >&2
+       exit $errno
+}
+
 # ============= Creation of temporary work directories =============
 temp_trap_init ()
 {
-       trap 'errno=$?; set +x; TEMP_IN_TRAP=yes; temp_warn_obsolete_temp_db >&2 || :; temp_warn_obsolete_temp_db () { :; }; temp_terminate_process $errno >&2 || :; temp_terminate_process () { :; }; rm -rf "${TMPDIR}" 2> /dev/null; [ -n "${DBDIR}" -a x`cat "${DBDIR}/.lock" 2> /dev/null` = x$$ ] && rm -f "${DBDIR}/.lock"; [ $errno -gt 0 -a $errno -ne 130 ] && message_echo "(Exit code: $errno)" >&2; exit $errno' 0 1 2 3 9 15 17 18
+       trap 'temp_trap_init__opetration $?' 0 1 2 3 9 15 17 18
        { until TMPDIR=`mktemp -dq /tmp/"${APPNAME}".XXXXXXXX` ; do : ; done ; }
        chgrp "`id -gn`" "${TMPDIR}"
 }
 
+# ============= Set the signal trap to be friendly for invoking a new version: Trap operation =============
+temp_trap_for_invoking_new_version__opetration ()
+{
+       local errno
+       errno=$1
+       set +x
+       rm -rf "${TMPDIR}" 2> /dev/null
+       [ $errno -gt 0 -a $errno -ne 130 -a $opt_batch_mode = no -a $opt_no_opening_message = no ] && echo "(Exit code: $errno)" >&2
+       exit $errno
+}
+
 # ============= Set the signal trap to be friendly for invoking a new version =============
 temp_trap_for_invoking_new_version ()
 {
        [ x`cat "${DBDIR}/.lock" 2> /dev/null` = x$$ ] && rm -f "${DBDIR}/.lock"
-       trap 'errno=$?; rm -rf "${TMPDIR}" 2> /dev/null; [ $errno -gt 0 -a $errno -ne 130 ] && echo "(Error exit by $errno)" >&2; exit $errno' 0 1 2 3 9 15 17 18
+       trap 'temp_trap_for_invoking_new_version__opetration $?' 0 1 2 3 9 15 17 18
 }
 
 # ============= Set the message telling the current stage =============
index 49609f4..8651f3f 100644 (file)
@@ -17,7 +17,7 @@ main_set_termination_messages_special ()
                tmp_msg=${TMPDIR}/temp_terminate_process:msg
                [ $errno -eq 0 -o $opt_batch_mode = yes ] && return
                temp_terminate_process_common "$errno"
-               [ -n "$COMMAND_RESTART" ] && return
+               [ $opt_no_opening_message = yes -o -n "$COMMAND_RESTART" ] && return
                cat > $tmp_msg << eof
 Instead, if you only want to construct the temporary database so as to stop before the actual reinstallation, execute as:
 ${APPNAME} prepare