# ================================================
APPNAME=`basename "$0"`
-MYVERSION=1.1.0+toward_2.0.0_20120808022938
+MYVERSION=1.1.0+toward_2.0.0_20120810130509
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
echo " the currently installed ${APPNAME}."
echo " -c : Suppress cleaning the temporal database even if its obsolete."
echo " By default, the temporal database is automatically cleaned up if"
- echo " it is older than the ports tree."
+ echo " it is older than the ports tree or ${APPNAME} itself is to be"
+ echo " updated."
echo " This option replace this behavior with termination with warnings."
+ echo " This option should not be used unless the user has special"
+ echo " intentions."
echo
echo "[ARGUMENTS]"
echo " command: (For optional operations or confirmation)"
fi
command=$1
-[ -n "$command" ] && shift
+[ -z "$command" ] || shift
# ====================================================
# ================== FUNCTIONS =======================
then
add_a_line_if_new "$origin" "${DBDIR}/success.list"
rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed.list"
- [ -e "${DBDIR}/requires/$origin/necessary_update" ] && mv "${DBDIR}/requires/$origin/necessary_update" "${DBDIR}/requires/$origin/necessary_update_completed"
+ [ ! -e "${DBDIR}/requires/$origin/necessary_update" ] || mv "${DBDIR}/requires/$origin/necessary_update" "${DBDIR}/requires/$origin/necessary_update_completed"
else
rm_a_line "$origin" "${DBDIR}/success.list"
add_a_line_if_new "$origin" "${DBDIR}/success_but_dependencies_failed.list"
do
if expr "@$glob" : '^@[^/][^/]*/[^/][^/]*$' > /dev/null 2> /dev/null
then
- [ -d "${PORTSDIR}/$glob" ] && { echo $glob; continue; }
+ [ ! -d "${PORTSDIR}/$glob" ] || { echo $glob; continue; }
fi
ports_glob "$glob" > ${TMPDIR}/register_globs:ports_glob
origin=`ports_glob "$glob"`
origin_src=$1
recursedb_in=$2
recursedb=${recursedb_in:-${PORTS_MOVED_DB}}
- [ -d "${PORTSDIR}/$origin" ] && return
+ [ ! -d "${PORTSDIR}/$origin" ] || return 0
add_to_obsolete_if_not_yet "$origin"
grep -n -m 1 -E "^`str_escape_regexp $origin`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || :
if [ `cat "${TMPDIR}/moved.info" | wc -l` -eq 0 ]
else
echo "${DEPTH_INDEX} ===> Nonexistent port (your original?)"
fi
- [ -n "$origin_src" ] && add_to_obsolete_if_not_yet "$origin_src"
+ [ -z "$origin_src" ] || add_to_obsolete_if_not_yet "$origin_src"
return 1
else
iline_db=`cut -d : -f 1 "${TMPDIR}/moved.info"`
MAKE_ENVS=`cat "$target_dir/MENV.conflist" 2> /dev/null || :`
env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
pkg=`pkg_info -qO "$origin"`
- [ -n "$pkg" ] && echo $pkg > $target_dir/installed_version
+ [ -z "$pkg" ] || echo $pkg > $target_dir/installed_version
pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
do
origin_dependency=`sed -n ${iline}p "${TMPDIR}/missing.$origin_id"`
iline=$(($iline+1))
- grep -m 1 -E "^`str_escape_regexp $origin_dependency`$" "${DBDIR}/target.inspected.list" > /dev/null 2> /dev/null && continue
- inspect_dependencies "$origin_dependency"
+ if grep -m 1 -E "^`str_escape_regexp $origin_dependency`$" "${DBDIR}/target.inspected.list" > /dev/null 2> /dev/null
+ then
+ :
+ else
+ inspect_dependencies "$origin_dependency"
+ fi
done
rm "${TMPDIR}/missing.$origin_id"
env ${MAKE_ENVS} make fetch-urlall-list ${MAKE_ARGS} | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
warn_update_ports ()
{
- [ ${_STATUS_DB_OBSOLETE} = no ] && return
+ [ ${_STATUS_DB_OBSOLETE} = yes ] || return 0
echo "WARNING: The Ports tree was updated after construction of the temporal database for ${APPNAME}." >&2
echo " You should consider executing " >&2
echo " ${APPNAME} clean" >&2
[ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
# Check whether the temporal database is newer than the ports tree
-if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}" ]
+if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
then
if [ $supress_obsolete_db_clean = no ]
then
if ( cd "${PORTSDIR}/$self_origin" && make reinstall )
then
( cd "${PORTSDIR}/$self_origin" && make clean )
- echo "INFO: Cleaning the temporal database by the new version..."
- rm -rf "${DBDIR}"
- echo
+ if [ $supress_obsolete_db_clean = yes -a -d "${DBDIR}" ]
+ then
+ echo "INFO: Cleaning the temporal database..."
+ rm -rf "${DBDIR}"
+ echo
+ fi
echo "INFO: Restarting with the new version..."
echo
. "${TMPDIR}"/restart_command.sh
;;
esac
echo "Now the following ports have been manually resolved:"
- [ -r "${DBDIR}/manually_done.list" ] && cat "${DBDIR}/manually_done.list"
+ [ ! -r "${DBDIR}/manually_done.list" ] || cat "${DBDIR}/manually_done.list"
exit
;;
taboo)
;;
esac
[ -n "${_for_each_matching_port}" -o -r "${DBDIR}/$list" ] || exit 0
- [ -e "${DBDIR}"/saved_options.sh ] && . "${DBDIR}"/saved_options.sh
+ [ ! -e "${DBDIR}"/saved_options.sh ] || . "${DBDIR}"/saved_options.sh
if [ -n "${_for_each_matching_port}" ]
then
shift
warn_update_ports
touch "${DBDIR}/MODE_REDO"
rm -f "${DBDIR}/COMPLETE_CLEANUP_REINST_STATUS"
- [ $renew_options = yes ] && rm -f "${DBDIR}/COMPLETE_SAVE_OPTIONS"
+ [ $renew_options = no ] || rm -f "${DBDIR}/COMPLETE_SAVE_OPTIONS"
if [ -n "$target_required_ports$target_dependent_ports$target_required_ports_form2$target_dependent_ports_form2" ]
then
rm -f "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS"
;;
esac
+# ------- Termination messages during construction of the temporal database -------
+
+terminate_process_common ()
+{
+ local msg_where
+ [ -z "${_MSG_CURRENT_STAGE}" ] || msg_where=" during ${_MSG_CURRENT_STAGE}"
+ echo
+ if [ $errno -eq 130 ]
+ then
+ echo "INFO: Terminated at `timestamp`$msg_where"
+ echo
+ echo " You can restart this process from the terminated point by"
+ else
+ echo "INFO: Aborted at `timestamp`$msg_where"
+ echo
+ echo " You may restart this process from the aborted point by"
+ fi
+ echo "executing without options or arguments as:"
+ echo " ${APPNAME}"
+}
+
+terminate_process ()
+{
+ terminate_process_common
+ echo " Instead, if you only want to construct the temporal database so as to stop"
+ echo "before the actual reinstallation, execute as:"
+ echo " ${APPNAME} prepare"
+ terminate_process ()
+ {
+ }
+}
+
# ------- Load from pkgtools.conf(5) -------
if [ ! -e "${DBDIR}/COMPLETE_SAVE_OPTIONS" ]
then
- [ -e "${DBDIR}"/saved_options.sh ] && echo "(Previous option settings for '-s', '-q' and '-d' are reset.)"
+ [ ! -e "${DBDIR}"/saved_options.sh ] || echo "(Previous option settings for '-s', '-q' and '-d' are reset.)"
cat > ${DBDIR}/saved_options.sh << eof
target_dependent_ports=$target_dependent_ports
target_required_ports=$target_required_ports
echo "-- Starting to parse pkgtools.conf at `timestamp` (by using installed portupgrade)"
portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade`
[ -n "$portupgrade_pkg" ] || portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade-devel`
- [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -ne 0 ] && echo "WARNING: Combination with portupgrade-devel-* has not tested."
+ [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -eq 0 ] || echo "WARNING: Combination with portupgrade-devel-* has not tested."
istart=`grep -m 1 -n -e '^def init_global$' "${PORTUPGRADE}" | cut -d : -f 1` || :
[ -n "$istart" ] || { echo "ERROR: The current installed version of portupgrade is unsupported." >&2; }
sed 1,$(($istart-1))d "${PORTUPGRADE}" > ${TMPDIR}/portupgrade.0
done
touch "${DBDIR}/COMPLETE_REFLECTCONF_ALT_MOVED"
fi
- [ "${DBDIR}/MOVED.conflist" -nt "${PORTS_MOVED_DB}" ] && PORTS_MOVED_DB=${DBDIR}/MOVED.conflist
+ if [ "${DBDIR}/MOVED.conflist" -nt "${PORTS_MOVED_DB}" ]
+ then
+ PORTS_MOVED_DB=${DBDIR}/MOVED.conflist
+ fi
build_conflist_target_list HOLD
build_conflist_target_list TABOO
# ------- Database construction -------
-terminate_process_common ()
-{
- local msg_where
- [ -n "${_MSG_CURRENT_STAGE}" ] && msg_where=" during ${_MSG_CURRENT_STAGE}"
- echo
- if [ $errno -eq 130 ]
- then
- echo "INFO: Terminated at `timestamp`$msg_where"
- echo
- echo " You can restart this process from the terminated point by"
- else
- echo "INFO: Aborted at `timestamp`$msg_where"
- echo
- echo " You may restart this process from the aborted point by"
- fi
- echo "executing without options or arguments as:"
- echo " ${APPNAME}"
-}
-
-terminate_process ()
-{
- terminate_process_common
- echo " Instead, if you only want to construct the temporal database so as to stop"
- echo "before the actual reinstallation, execute as:"
- echo " ${APPNAME} prepare"
- terminate_process ()
- {
- }
-}
-
# Target ports
if [ ! -e "${DBDIR}/COMPLETE_INSTALLED_PORTS" ]
then
if [ ! -e "${DBDIR}/COMPLETE_ORDERED_ALL_DEPENDENCIES" ]
then
echo "Starting order of dependencies at `timestamp`"
- [ -f "${DBDIR}/reinst_order.list.tmp" ] && echo "INFO: Restarting from the previously terminated point"
+ [ ! -f "${DBDIR}/reinst_order.list.tmp" ] || echo "INFO: Restarting from the previously terminated point"
touch "${DBDIR}/reinst_order.list.tmp"
cd "${DBDIR}/requires"
cat > ${TMPDIR}/order_dependencies.awk << eof
echo "========== Starting deinstallation process for obsolete port $origin as $currentpkg =========="
if [ -z "${currentorigin_is_all}" -a -n "${currentorigin_is_relevant}" ]
then
- [ "${currentorigin_is_target}" = y ] && echo "(Target port)"
- [ "${currentorigin_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
- [ "${currentorigin_is_required}" = y ] && echo "(Requirement of the target port(s))"
- [ "${currentorigin_is_former_dependent}" = y ] && echo "(Former dependent of the target port(s))"
- [ "${currentorigin_is_former_required}" = y ] && echo "(Former requirement of the target port(s))"
+ [ -z "${currentorigin_is_target}" ] || echo "(Target port)"
+ [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))"
+ [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))"
+ [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))"
+ [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))"
fi
echo "-- (Creating backup package for $origin as $currentpkg)"
tag=`echo $origin | sed 's|/|.|'`
fi
# Reinstallation of remained ports
-[ -e "${DBDIR}/MODE_REDO" ] && rm -f "${DBDIR}/COMPLETE_REINSTALLATION" "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" "${DBDIR}/COMPLETE_REBUILD_PKGDB"
+[ ! -e "${DBDIR}/MODE_REDO" ] || rm -f "${DBDIR}/COMPLETE_REINSTALLATION" "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" "${DBDIR}/COMPLETE_REBUILD_PKGDB"
if [ ! -e "${DBDIR}/COMPLETE_REINSTALLATION" ]
then
_MSG_CURRENT_STAGE_general="reinstallation"
then
if [ -n "${currentorigin_is_relevant}" ]
then
- [ "${currentorigin_is_target}" = y ] && echo "(Target port)" > ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_dependent}" = y ] && echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_required}" = y ] && echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_former_dependent}" = y ] && echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_former_required}" = y ] && echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_target}" ] || echo "(Target port)" > ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
else
echo "========== $counter (Skipping an irrelevant package for port $position_msg at `timestamp`) =========="
echo
.TP
\fB\-c\fR
Suppress cleaning the temporal database even if its obsolete.
-By default, the temporal database is automatically cleaned up if it is older than the ports tree.
+By default, the temporal database is automatically cleaned up if it is older than the ports tree or portsreinstall itself is to be updated.
This option replace this behavior with termination with warnings.
+This option should not be used unless the user has special intentions.
.SH DETAILS
This utility realizes smart reinstallation of a large number of ports by allowing you to run when when the machine is free and terminate when busy.
Concretely, you can stop the process by CTRL+C anytime and restart quickly.
[CHANGED] The specification of \fBshow\fR command is changed to exclude irrelevant packages/ports and output messages about the matching targets when options \fB\-r\fR, \fB\-R\fR, \fB\-t\fR and \fB\-T\fR are enabled.
-[CHANGED] The default behavior in case that the temporal database is older than the ports tree is changed from warnings to automatic reconstruction.
+[CHANGED] The default behavior in case that the temporal database is older than the ports tree is changed from warnings to automatic reconstruction; the old behavior is recovered by option \fB\-c\fR.
[BUG FIX] Termination message is corrected (portsreinstall ok => portsreinstall ok add).
.TP
\fB\-c\fR
Suppress cleaning the temporal database even if its obsolete.
-By default, the temporal database is automatically cleaned up if it is older than the ports tree.
+By default, the temporal database is automatically cleaned up if it is older than the ports tree or portsreinstall itself is to be updated.
This option replace this behavior with termination with warnings.
+This option should not be used unless the user has special intentions.
.SH DETAILS
This utility realizes smart reinstallation of a large number of ports by allowing you to run when when the machine is free and terminate when busy.
Concretely, you can stop the process by CTRL+C anytime and restart quickly.
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-1.2.0 (7 August 2012)
+2.0.0 (8 August 2012)
[NEW] Options \fB\-X\fR, \fB\-r\fR and \fB\-R\fR are added so as to compensate a fact that \fB\-x\fR, \fB\-t\fR and \fB\-T\fR cannot specify package names with commas.
[NEW] Commands of \fBshow requirements\fR and \fBshow dependents\fR are added.
# ================================================
APPNAME=`basename "$0"`
-MYVERSION=1.1.0+toward_1.2.0_20120807154627
+MYVERSION=1.1.0+toward_2.0.0_20120808081529
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
echo " the currently installed ${APPNAME}."
echo " -c : Suppress cleaning the temporal database even if its obsolete."
echo " By default, the temporal database is automatically cleaned up if"
- echo " it is older than the ports tree."
+ echo " it is older than the ports tree or ${APPNAME} itself is to be"
+ echo " updated."
echo " This option replace this behavior with termination with warnings."
+ echo " This option should not be used unless the user has special"
+ echo " intentions."
echo
echo "[ARGUMENTS]"
echo " command: (For optional operations or confirmation)"
fi
command=$1
-[ -n "$command" ] && shift
+[ -z "$command" ] || shift
# ====================================================
# ================== FUNCTIONS =======================
then
add_a_line_if_new "$origin" "${DBDIR}/success.list"
rm_a_line "$origin" "${DBDIR}/success_but_dependencies_failed.list"
- [ -e "${DBDIR}/requires/$origin/necessary_update" ] && mv "${DBDIR}/requires/$origin/necessary_update" "${DBDIR}/requires/$origin/necessary_update_completed"
+ [ ! -e "${DBDIR}/requires/$origin/necessary_update" ] || mv "${DBDIR}/requires/$origin/necessary_update" "${DBDIR}/requires/$origin/necessary_update_completed"
else
rm_a_line "$origin" "${DBDIR}/success.list"
add_a_line_if_new "$origin" "${DBDIR}/success_but_dependencies_failed.list"
do
if expr "@$glob" : '^@[^/][^/]*/[^/][^/]*$' > /dev/null 2> /dev/null
then
- [ -d "${PORTSDIR}/$glob" ] && { echo $glob; continue; }
+ [ ! -d "${PORTSDIR}/$glob" ] || { echo $glob; continue; }
fi
ports_glob "$glob" > ${TMPDIR}/register_globs:ports_glob
origin=`ports_glob "$glob"`
origin_src=$1
recursedb_in=$2
recursedb=${recursedb_in:-${PORTS_MOVED_DB}}
- [ -d "${PORTSDIR}/$origin" ] && return
+ [ ! -d "${PORTSDIR}/$origin" ] || return 0
add_to_obsolete_if_not_yet "$origin"
grep -n -m 1 -E "^`str_escape_regexp $origin`\|" "$recursedb" 2> /dev/null > ${TMPDIR}/moved.info || :
if [ `cat "${TMPDIR}/moved.info" | wc -l` -eq 0 ]
else
echo "${DEPTH_INDEX} ===> Nonexistent port (your original?)"
fi
- [ -n "$origin_src" ] && add_to_obsolete_if_not_yet "$origin_src"
+ [ -z "$origin_src" ] || add_to_obsolete_if_not_yet "$origin_src"
return 1
else
iline_db=`cut -d : -f 1 "${TMPDIR}/moved.info"`
MAKE_ENVS=`cat "$target_dir/MENV.conflist" 2> /dev/null || :`
env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
pkg=`pkg_info -qO "$origin"`
- [ -n "$pkg" ] && echo $pkg > $target_dir/installed_version
+ [ -z "$pkg" ] || echo $pkg > $target_dir/installed_version
pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
do
origin_dependency=`sed -n ${iline}p "${TMPDIR}/missing.$origin_id"`
iline=$(($iline+1))
- grep -m 1 -E "^`str_escape_regexp $origin_dependency`$" "${DBDIR}/target.inspected.list" > /dev/null 2> /dev/null && continue
- inspect_dependencies "$origin_dependency"
+ if grep -m 1 -E "^`str_escape_regexp $origin_dependency`$" "${DBDIR}/target.inspected.list" > /dev/null 2> /dev/null
+ then
+ :
+ else
+ inspect_dependencies "$origin_dependency"
+ fi
done
rm "${TMPDIR}/missing.$origin_id"
env ${MAKE_ENVS} make fetch-urlall-list ${MAKE_ARGS} | sed -E 's|.*/([^/]+)$|\1|' | sort | uniq >> ${DBDIR}/distfiles.list
warn_update_ports ()
{
- [ ${_STATUS_DB_OBSOLETE} = no ] && return
+ [ ${_STATUS_DB_OBSOLETE} = yes ] || return 0
echo "WARNING: The Ports tree was updated after construction of the temporal database for ${APPNAME}." >&2
echo " You should consider executing " >&2
echo " ${APPNAME} clean" >&2
[ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
# Check whether the temporal database is newer than the ports tree
-if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}" ]
+if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
then
if [ $supress_obsolete_db_clean = no ]
then
if ( cd "${PORTSDIR}/$self_origin" && make reinstall )
then
( cd "${PORTSDIR}/$self_origin" && make clean )
- echo "INFO: Cleaning the temporal database by the new version..."
- rm -rf "${DBDIR}"
- echo
+ if [ $supress_obsolete_db_clean = yes -a -d "${DBDIR}" ]
+ then
+ echo "INFO: Cleaning the temporal database..."
+ rm -rf "${DBDIR}"
+ echo
+ fi
echo "INFO: Restarting with the new version..."
echo
. "${TMPDIR}"/restart_command.sh
;;
esac
echo "Now the following ports have been manually resolved:"
- [ -r "${DBDIR}/manually_done.list" ] && cat "${DBDIR}/manually_done.list"
+ [ ! -r "${DBDIR}/manually_done.list" ] || cat "${DBDIR}/manually_done.list"
exit
;;
taboo)
;;
esac
[ -n "${_for_each_matching_port}" -o -r "${DBDIR}/$list" ] || exit 0
- [ -e "${DBDIR}"/saved_options.sh ] && . "${DBDIR}"/saved_options.sh
+ [ ! -e "${DBDIR}"/saved_options.sh ] || . "${DBDIR}"/saved_options.sh
if [ -n "${_for_each_matching_port}" ]
then
shift
warn_update_ports
touch "${DBDIR}/MODE_REDO"
rm -f "${DBDIR}/COMPLETE_CLEANUP_REINST_STATUS"
- [ $renew_options = yes ] && rm -f "${DBDIR}/COMPLETE_SAVE_OPTIONS"
+ [ $renew_options = no ] || rm -f "${DBDIR}/COMPLETE_SAVE_OPTIONS"
if [ -n "$target_required_ports$target_dependent_ports$target_required_ports_form2$target_dependent_ports_form2" ]
then
rm -f "${DBDIR}/COMPLETE_PARSE_OPTION_TARGET_PORTS"
;;
esac
+# ------- Termination messages during construction of the temporal database -------
+
+terminate_process_common ()
+{
+ local msg_where
+ [ -z "${_MSG_CURRENT_STAGE}" ] || msg_where=" during ${_MSG_CURRENT_STAGE}"
+ echo
+ if [ $errno -eq 130 ]
+ then
+ echo "INFO: Terminated at `timestamp`$msg_where"
+ echo
+ echo " You can restart this process from the terminated point by"
+ else
+ echo "INFO: Aborted at `timestamp`$msg_where"
+ echo
+ echo " You may restart this process from the aborted point by"
+ fi
+ echo "executing without options or arguments as:"
+ echo " ${APPNAME}"
+}
+
+terminate_process ()
+{
+ terminate_process_common
+ echo " Instead, if you only want to construct the temporal database so as to stop"
+ echo "before the actual reinstallation, execute as:"
+ echo " ${APPNAME} prepare"
+ terminate_process ()
+ {
+ }
+}
+
# ------- Load from pkgtools.conf(5) -------
if [ ! -e "${DBDIR}/COMPLETE_SAVE_OPTIONS" ]
then
- [ -e "${DBDIR}"/saved_options.sh ] && echo "(Previous option settings for '-s', '-q' and '-d' are reset.)"
+ [ ! -e "${DBDIR}"/saved_options.sh ] || echo "(Previous option settings for '-s', '-q' and '-d' are reset.)"
cat > ${DBDIR}/saved_options.sh << eof
target_dependent_ports=$target_dependent_ports
target_required_ports=$target_required_ports
echo "-- Starting to parse pkgtools.conf at `timestamp` (by using installed portupgrade)"
portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade`
[ -n "$portupgrade_pkg" ] || portupgrade_pkg=`pkg_info -qO ports-mgmt/portupgrade-devel`
- [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -ne 0 ] && echo "WARNING: Combination with portupgrade-devel-* has not tested."
+ [ `expr "$portupgrade_pkg" : '^portupgrade-devel-'` -eq 0 ] || echo "WARNING: Combination with portupgrade-devel-* has not tested."
istart=`grep -m 1 -n -e '^def init_global$' "${PORTUPGRADE}" | cut -d : -f 1` || :
[ -n "$istart" ] || { echo "ERROR: The current installed version of portupgrade is unsupported." >&2; }
sed 1,$(($istart-1))d "${PORTUPGRADE}" > ${TMPDIR}/portupgrade.0
done
touch "${DBDIR}/COMPLETE_REFLECTCONF_ALT_MOVED"
fi
- [ "${DBDIR}/MOVED.conflist" -nt "${PORTS_MOVED_DB}" ] && PORTS_MOVED_DB=${DBDIR}/MOVED.conflist
+ if [ "${DBDIR}/MOVED.conflist" -nt "${PORTS_MOVED_DB}" ]
+ then
+ PORTS_MOVED_DB=${DBDIR}/MOVED.conflist
+ fi
build_conflist_target_list HOLD
build_conflist_target_list TABOO
# ------- Database construction -------
-terminate_process_common ()
-{
- local msg_where
- [ -n "${_MSG_CURRENT_STAGE}" ] && msg_where=" during ${_MSG_CURRENT_STAGE}"
- echo
- if [ $errno -eq 130 ]
- then
- echo "INFO: Terminated at `timestamp`$msg_where"
- echo
- echo " You can restart this process from the terminated point by"
- else
- echo "INFO: Aborted at `timestamp`$msg_where"
- echo
- echo " You may restart this process from the aborted point by"
- fi
- echo "executing without options or arguments as:"
- echo " ${APPNAME}"
-}
-
-terminate_process ()
-{
- terminate_process_common
- echo " Instead, if you only want to construct the temporal database so as to stop"
- echo "before the actual reinstallation, execute as:"
- echo " ${APPNAME} prepare"
- terminate_process ()
- {
- }
-}
-
# Target ports
if [ ! -e "${DBDIR}/COMPLETE_INSTALLED_PORTS" ]
then
if [ ! -e "${DBDIR}/COMPLETE_ORDERED_ALL_DEPENDENCIES" ]
then
echo "Starting order of dependencies at `timestamp`"
- [ -f "${DBDIR}/reinst_order.list.tmp" ] && echo "INFO: Restarting from the previously terminated point"
+ [ ! -f "${DBDIR}/reinst_order.list.tmp" ] || echo "INFO: Restarting from the previously terminated point"
touch "${DBDIR}/reinst_order.list.tmp"
cd "${DBDIR}/requires"
cat > ${TMPDIR}/order_dependencies.awk << eof
echo "========== Starting deinstallation process for obsolete port $origin as $currentpkg =========="
if [ -z "${currentorigin_is_all}" -a -n "${currentorigin_is_relevant}" ]
then
- [ "${currentorigin_is_target}" = y ] && echo "(Target port)"
- [ "${currentorigin_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
- [ "${currentorigin_is_required}" = y ] && echo "(Requirement of the target port(s))"
- [ "${currentorigin_is_former_dependent}" = y ] && echo "(Former dependent of the target port(s))"
- [ "${currentorigin_is_former_required}" = y ] && echo "(Former requirement of the target port(s))"
+ [ -z "${currentorigin_is_target}" ] || echo "(Target port)"
+ [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))"
+ [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))"
+ [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))"
+ [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))"
fi
echo "-- (Creating backup package for $origin as $currentpkg)"
tag=`echo $origin | sed 's|/|.|'`
fi
# Reinstallation of remained ports
-[ -e "${DBDIR}/MODE_REDO" ] && rm -f "${DBDIR}/COMPLETE_REINSTALLATION" "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" "${DBDIR}/COMPLETE_REBUILD_PKGDB"
+[ ! -e "${DBDIR}/MODE_REDO" ] || rm -f "${DBDIR}/COMPLETE_REINSTALLATION" "${DBDIR}/COMPLETE_CLEANUP_OBSLETE_DISTFILES" "${DBDIR}/COMPLETE_REBUILD_PKGDB"
if [ ! -e "${DBDIR}/COMPLETE_REINSTALLATION" ]
then
_MSG_CURRENT_STAGE_general="reinstallation"
then
if [ -n "${currentorigin_is_relevant}" ]
then
- [ "${currentorigin_is_target}" = y ] && echo "(Target port)" > ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_dependent}" = y ] && echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_required}" = y ] && echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_former_dependent}" = y ] && echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
- [ "${currentorigin_is_former_required}" = y ] && echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_target}" ] || echo "(Target port)" > ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_dependent}" ] || echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_required}" ] || echo "(Requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_dependent}" ] || echo "(Former dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ -z "${currentorigin_is_former_required}" ] || echo "(Former requirement of the target port(s))" >> ${TMPDIR}/msg_if_target
else
echo "========== $counter (Skipping an irrelevant package for port $position_msg at `timestamp`) =========="
echo