OSDN Git Service

Version 3.0.5+toward_3.0.6_20140527113705
[portsreinstall/current.git] / bin / portsreinstall
index a84051b..d4ed120 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 # ==================================================================================
 # portsreinstall main script
-# Copyright (C) 2010-2013 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
 # This software is distributed under the 2-Clause BSD License.
 # ==================================================================================
 
 # ============ Set up of environment =============
 APPNAME=`basename "$0"`
 
-# MYVERSION=3.0.1
+# MYVERSION=3.0.6
 # COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$'
 # Template for development versions
-MYVERSION=3.0.1+toward_3.0.2_20130708212202
-COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.1_[0-9]+|3\.0\.[0-9]+)$'
+MYVERSION=3.0.5+toward_3.0.6_20140527113705
+COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.0\.[0-9]+)$'
 MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
 MYPREFIX=${MYPREFIX:-/usr/local}
 LIBDIR=${MYPREFIX}/lib/${APPNAME}
@@ -45,7 +45,6 @@ DBDIR=/var/tmp/${APPNAME}.db
 CONFFILE=${MYPREFIX}/etc/${APPNAME}.conf
 PKGTOOLSCONF=${MYPREFIX}/etc/pkgtools.conf
 
-
 # ==================================================
 # ========= PARSING OPTIONS AND ARGUMENTS ==========
 # ==================================================
@@ -109,6 +108,45 @@ shift "${COMMAND_SHIFT}"
 # ================== TOOLS SET UP ==================
 # ==================================================
 
+# ============= Termination messages during construction of the temporary database =============
+
+# Set termination messages
+temp_terminate_process_common ()
+{
+       local msg_where
+       [ $opt_batch_mode = yes ] && return
+       msg_where=`temp_get_msg_current_stage`
+       [ -n "$msg_where" ] && msg_where=" during $msg_where"
+       echo
+       if [ $errno -eq 130 ]
+       then
+               echo "INFO: Terminated at `message_timestamp`$msg_where."
+               echo
+               echo " You can restart this process from the terminated point by"
+       else
+               echo "INFO: Aborted at `message_timestamp`$msg_where."
+               echo
+               echo " You may restart this process from the aborted point by"
+       fi
+       echo "executing without options or arguments as:"
+       if [ -n "$COMMAND_RESTART" ]
+       then
+               echo "  ${APPNAME} $COMMAND_RESTART"
+       else
+               echo "  ${APPNAME}"
+       fi
+}
+
+temp_terminate_process ()
+{
+       [ $errno -eq 0 -o $opt_batch_mode = yes ] && return
+       temp_terminate_process_common
+       [ -n "$COMMAND_RESTART" ] || message_cat 3<< eof
+ Instead, if you only want to construct the temporary database so as to stop before the actual reinstallation, execute as:
+  ${APPNAME} prepare
+eof
+}
+
 # ============= Opening title =============
 
 message_credit
@@ -169,45 +207,6 @@ then
        message_echo
 fi
 
-# ============= Termination messages during construction of the temporary database =============
-
-# Set termination messages
-temp_terminate_process_common ()
-{
-       local msg_where
-       [ $opt_batch_mode = yes ] && return
-       msg_where=`temp_get_msg_current_stage`
-       [ -n "$msg_where" ] && msg_where=" during $msg_where"
-       echo
-       if [ $errno -eq 130 ]
-       then
-               echo "INFO: Terminated at `message_timestamp`$msg_where."
-               echo
-               echo " You can restart this process from the terminated point by"
-       else
-               echo "INFO: Aborted at `message_timestamp`$msg_where."
-               echo
-               echo " You may restart this process from the aborted point by"
-       fi
-       echo "executing without options or arguments as:"
-       if [ -n "$COMMAND_RESTART" ]
-       then
-               echo "  ${APPNAME} $COMMAND_RESTART"
-       else
-               echo "  ${APPNAME}"
-       fi
-}
-
-temp_terminate_process ()
-{
-       [ $errno -eq 0 -o $opt_batch_mode = yes ] && return
-       temp_terminate_process_common
-       [ -n "$COMMAND_RESTART" ] || message_cat 3<< eof
- Instead, if you only want to construct the temporary database so as to stop before the actual reinstallation, execute as:
-  ${APPNAME} prepare
-eof
-}
-
 # ============= Configurations =============
 
 # Save the previous configuration if exists
@@ -229,7 +228,7 @@ _program_exec_and_record_completion__operation ()
        need_msg=no
        rm -rf "${DBDIR}/conf"
        mkdir -p "${DBDIR}/conf"
-       [ "x`options_get_effective_opt_load_pkgtoolsconf`" != xno -a $opt_batch_mode = no ] \
+       [ "x`options_get_effective_opt_load_pkgtoolsconf 2> /dev/null`" != xno -a $opt_batch_mode = no ] \
                && need_msg=yes
        [ $need_msg = yes ] && \
                message_section_title "Parsing pkgtools.conf (by using installed portupgrade)"
@@ -345,6 +344,7 @@ then
                reinstall_exec ports-mgmt/pkg
                reinstall_restore_conflicts
                rm -f "${DBDIR}/target_all"
+               temp_set_msg_current_stage
                message_echo
        }
        program_exec_and_record_completion UPGRADE_PKGNG
@@ -367,6 +367,7 @@ then
                reinstall_exec ports-mgmt/dialog4ports
                reinstall_restore_conflicts
                rm -f "${DBDIR}/target_all"
+               temp_set_msg_current_stage
                message_echo
        }
        program_exec_and_record_completion UPGRADE_DIALOG4PORTS
@@ -389,6 +390,7 @@ then
                reinstall_exec "$MYPORTORIGIN"
                reinstall_restore_conflicts
                rm -f "${DBDIR}/target_all"
+               temp_set_msg_current_stage
                message_echo
        }
        program_exec_and_record_completion UPGRADE_SELF
@@ -1269,7 +1271,7 @@ _program_exec_and_record_completion__operation ()
 program_exec_and_record_completion LIST_DEINST_PKGS
 
 # Collect entire distfiles list
-if [ $opt_suppress_inspect_entire_distinfo = yes ]
+if [ $opt_inspect_entire_distinfo = yes ]
 then
        PROGRAM_DEPENDS=''
        _program_exec_and_record_completion__operation ()
@@ -1343,6 +1345,7 @@ _program_exec_and_record_completion__operation ()
        message_section_title "Reinstallation"
        program_exec_restartable_loop_operation reinst_todo
        reinstall_restore_conflicts
+       temp_set_msg_current_stage
        message_echo
 }
 program_exec_and_record_completion REINSTALLATION