X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=bin%2Fportsreinstall;h=718585528883cfdc6f4b735e720b71f976b8e3ef;hb=3a2d404f261f0ce5add8f546c4a704054e8800c5;hp=9e2600317c788955e8dfd59d3373987d14ea42f6;hpb=5ccb429c21cbdddd1ce6efa3d6d0167a47d0aff4;p=portsreinstall%2Fcurrent.git diff --git a/bin/portsreinstall b/bin/portsreinstall index 9e26003..7185855 100755 --- a/bin/portsreinstall +++ b/bin/portsreinstall @@ -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. # ================================================================================== @@ -12,11 +12,11 @@ # ============ Set up of environment ============= APPNAME=`basename "$0"` -MYVERSION=3.0.4 -COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$' +# MYVERSION=3.0.6 +# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+)$' # Template for development versions -# MYVERSION=3.0.3+toward_3.0.4_20131115074959 -# COMPATIBLE_VERSIONS='^(3\.0\.[0-9]+\+toward_3\.0\.[0-9]+_[0-9]+|3\.0\.[0-9]+)$' +MYVERSION=3.0.5+toward_3.0.6_20140531202509 +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} @@ -40,12 +40,10 @@ LIBDIR=${MYPREFIX}/lib/${APPNAME} misc_init_vardefs temp_trap_init -conf_setup_envs DBDIR=/var/tmp/${APPNAME}.db CONFFILE=${MYPREFIX}/etc/${APPNAME}.conf PKGTOOLSCONF=${MYPREFIX}/etc/pkgtools.conf - # ================================================== # ========= PARSING OPTIONS AND ARGUMENTS ========== # ================================================== @@ -94,6 +92,10 @@ then exit fi +# ============= Set up variables for environment of ports and packages ============= +conf_setup_ports_envs +conf_setup_packages_envs + # ============= Execute command operations before getting the temporary database ready ============= command_exec_before_db_creation "$@" @@ -109,6 +111,49 @@ 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 () +{ + local tmp_msg + tmp_msg=${TMPDIR}/temp_terminate_process:msg + [ $errno -eq 0 -o $opt_batch_mode = yes ] && return + temp_terminate_process_common + [ -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 +eof + message_cat "$tmp_msg" +} + # ============= Opening title ============= message_credit @@ -169,45 +214,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