# ================================================
APPNAME=`basename $0`
-MYVERSION=1.1.0+toward_1.1.1_20120604171436
+MYVERSION=1.1.0+toward_1.1.1_20120722233957
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
done < ${DBDIR}/failed.list
}
+_chk_if_target ()
+{
+ _is_all=y
+ _is_target=
+ _is_dependent=
+ if [ `cat "${DBDIR}/target_required_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
+ then
+ _is_all=
+ if [ ! -f "${DBDIR}/requires/$origin/dependents.pattern" ]
+ then
+ str_escape_regexp_filter < "${DBDIR}/requires/$origin/dependents" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/dependents.pattern" 2> /dev/null || :
+ fi
+ if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_target=y
+ elif grep -m 1 -E -f "${DBDIR}/requires/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_required=y
+ fi
+ fi
+ _is_required=
+ if [ `cat "${DBDIR}/target_dependent_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
+ then
+ _is_all=
+ if [ ! -f "${DBDIR}/requires/$origin/requires.pattern" ]
+ then
+ str_escape_regexp_filter < "${DBDIR}/requires/$origin/requires" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/requires.pattern" 2> /dev/null || :
+ fi
+ if [ -n "${_is_target}" ] || grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_target=y
+ elif grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_dependent=y
+ fi
+ fi
+}
+
# ==================================================
# ==================== MAIN ========================
# ==================================================
iline=$(($iline+1))
currentpkg=`pkg_info -qO "$origin" 2> /dev/null`
[ -n "$currentpkg" ] || continue
+ _chk_if_target "$origin"
+ if [ -z "${_is_all}" -a -z "${_is_target}${_is_dependent}${_is_required}" ]
+ then
+ echo "-- (Skipping an irrelative package for obsolete port $origin as $currentpkg)"
+ continue
+ fi
origin_ptn=`str_escape_regexp ${origin}`
if [ `grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null | wc -l` -gt 0 ]
then
- echo "-- (Skipping a hold package for port $origin as $currentpkg)"
+ echo "-- (Skipping a hold package for obsolete port $origin as $currentpkg)"
continue
fi
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
+ echo "========== Starting deinstallation process for obsolete port $origin as $currentpkg =========="
+ if [ -z "${_is_all}" -a -n "${_is_target}${_is_dependent}${_is_required}" ]
+ then
+ [ "${_is_target}" = y ] && echo "(Target port)"
+ [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
+ [ "${_is_required}" = y ] && echo "(Required by the target port(s))"
+ fi
echo "-- (Creating backup package for $origin as $currentpkg)"
tag=`echo $origin | sed 's|/|.|'`
if [ ! -e "${DBDIR}/status_deinst/$tag.backup" ]
pkg_create -b "$currentpkg" || { echo "*** Continuating forcibly by hoping success..."; continue; }
touch "${DBDIR}/status_deinst/$tag.backup"
fi
+ echo "-- (Deleting package for $origin as $currentpkg)"
pkg_delete -f "$currentpkg" || { echo "*** Continuating forcibly by hoping success..."; continue; }
rm_a_line "$origin" "${DBDIR}/moved_or_lost.list.remained"
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- _is_all=y
- _is_target=
- _is_dependent=
- if [ `cat "${DBDIR}/target_required_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
- then
- _is_all=
- if [ ! -f "${DBDIR}/requires/$origin/dependents.pattern" ]
- then
- str_escape_regexp_filter < "${DBDIR}/requires/$origin/dependents" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/dependents.pattern" 2> /dev/null || :
- fi
- if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
- then
- _is_target=y
- elif grep -m 1 -E -f "${DBDIR}/requires/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
- then
- _is_required=y
- fi
- fi
- _is_required=
- if [ `cat "${DBDIR}/target_dependent_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
- then
- _is_all=
- if [ ! -f "${DBDIR}/requires/$origin/requires.pattern" ]
- then
- str_escape_regexp_filter < "${DBDIR}/requires/$origin/requires" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/requires.pattern" 2> /dev/null || :
- fi
- if [ -n "${_is_target}" ] || grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
- then
- _is_target=y
- elif grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
- then
- _is_dependent=y
- fi
- fi
+ _chk_if_target "$origin"
+ cp /dev/null "${TMPDIR}"/msg_if_target
if [ -z "${_is_all}" ]
then
if [ -n "${_is_target}${_is_dependent}${_is_required}" ]
then
- [ "${_is_target}" = y ] && echo "(Target port)"
- [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
- [ "${_is_required}" = y ] && echo "(Required by the target port(s))"
+ [ "${_is_target}" = y ] && echo "(Target port)" > ${TMPDIR}/msg_if_target
+ [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ "${_is_required}" = y ] && echo "(Required by the target port(s))" >> ${TMPDIR}/msg_if_target
else
echo "========== $counter (Skipping an irrelative package for port $position_msg at `timestamp`) =========="
echo
if grep -m 1 -E "^`str_escape_regexp ${origin}`$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null > /dev/null
then
echo "========== $counter (Skipping a hold package for port $position_msg at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/taboo.all.list" 2> /dev/null > /dev/null
then
echo "========== $counter (Ignored a taboo port $position_msg at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/manually_done.list" 2> /dev/null > /dev/null
then
echo "========== $counter (Marking a manually-done port $position_msg as success at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
record_success $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
fi
_MSG_CURRENT_STAGE="$instdesc process for $position_msg $counter"
echo "========== $counter Starting $instdesc process for $position_msg at `timestamp` =========="
- [ "${_is_target}" = y ] && echo '(Target port)'
- [ "${_is_dependent}" = y ] && echo '(Dependent of the target port(s))'
- [ "${_is_required}" = y ] && echo '(Required by the target port(s))'
+ cat ${TMPDIR}/msg_if_target
cd "${PORTSDIR}/$origin"
if [ -e "${DBDIR}/requires/$origin/status/in_build" ]
then
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-1.1.1 (04 June 2012)
+1.1.1 (22 July 2012)
[BUG FIX] Termination message is corrected (portsreinstall ok => portsreinstall ok add).
+
+[CHANGE] Functionalities of options -t and -T are changed so as to prevent deinstallation of irrelevant packages.
.TP
1.1.0 (28 April 2012)
[NEW] Command of show deleted is newly added.
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-1.1.0 (26 April 2012)
+1.1.1 (04 June 2012)
+[BUG FIX] Termination message is corrected (portsreinstall ok => portsreinstall ok add).
+
+[CHANGE] Functionalities of options -t and -T are changed so as to prevent deinstallation of irrelevant packages.
+.TP
+1.1.0 (28 April 2012)
[NEW] Command of show deleted is newly added.
[CHANGE] Origin names in messages and results of show command are changed to be accompanied with package names.
# ================================================
APPNAME=`basename $0`
-MYVERSION=1.0.0+toward_1.1.0_20120428010646
+MYVERSION=1.1.0+toward_1.1.1_20120604171436
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
done < ${DBDIR}/failed.list
}
+_chk_if_target ()
+{
+ _is_all=y
+ _is_target=
+ _is_dependent=
+ if [ `cat "${DBDIR}/target_required_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
+ then
+ _is_all=
+ if [ ! -f "${DBDIR}/requires/$origin/dependents.pattern" ]
+ then
+ str_escape_regexp_filter < "${DBDIR}/requires/$origin/dependents" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/dependents.pattern" 2> /dev/null || :
+ fi
+ if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_target=y
+ elif grep -m 1 -E -f "${DBDIR}/requires/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_required=y
+ fi
+ fi
+ _is_required=
+ if [ `cat "${DBDIR}/target_dependent_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
+ then
+ _is_all=
+ if [ ! -f "${DBDIR}/requires/$origin/requires.pattern" ]
+ then
+ str_escape_regexp_filter < "${DBDIR}/requires/$origin/requires" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/requires.pattern" 2> /dev/null || :
+ fi
+ if [ -n "${_is_target}" ] || grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_target=y
+ elif grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
+ then
+ _is_dependent=y
+ fi
+ fi
+}
+
# ==================================================
# ==================== MAIN ========================
# ==================================================
iline=$(($iline+1))
currentpkg=`pkg_info -qO "$origin" 2> /dev/null`
[ -n "$currentpkg" ] || continue
+ _chk_if_target "$origin"
+ if [ -z "${_is_all}" -a -z "${_is_target}${_is_dependent}${_is_required}" ]
+ then
+ echo "-- (Skipping an irrelative package for obsolete port $origin as $currentpkg)"
+ continue
+ fi
origin_ptn=`str_escape_regexp ${origin}`
if [ `grep -m 1 -E "^${origin_ptn}$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null | wc -l` -gt 0 ]
then
- echo "-- (Skipping a hold package for port $origin as $currentpkg)"
+ echo "-- (Skipping a hold package for obsolete port $origin as $currentpkg)"
continue
fi
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
+ echo "========== Starting deinstallation process for obsolete port $origin as $currentpkg =========="
+ if [ -z "${_is_all}" -a -n "${_is_target}${_is_dependent}${_is_required}" ]
+ then
+ [ "${_is_target}" = y ] && echo "(Target port)"
+ [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
+ [ "${_is_required}" = y ] && echo "(Required by the target port(s))"
+ fi
echo "-- (Creating backup package for $origin as $currentpkg)"
tag=`echo $origin | sed 's|/|.|'`
if [ ! -e "${DBDIR}/status_deinst/$tag.backup" ]
pkg_create -b "$currentpkg" || { echo "*** Continuating forcibly by hoping success..."; continue; }
touch "${DBDIR}/status_deinst/$tag.backup"
fi
+ echo "-- (Deleting package for $origin as $currentpkg)"
pkg_delete -f "$currentpkg" || { echo "*** Continuating forcibly by hoping success..."; continue; }
rm_a_line "$origin" "${DBDIR}/moved_or_lost.list.remained"
_MSG_CURRENT_STAGE=${_MSG_CURRENT_STAGE_general}
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
fi
- _is_all=y
- _is_target=
- _is_dependent=
- if [ `cat "${DBDIR}/target_required_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
- then
- _is_all=
- if [ ! -f "${DBDIR}/requires/$origin/dependents.pattern" ]
- then
- str_escape_regexp_filter < "${DBDIR}/requires/$origin/dependents" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/dependents.pattern" 2> /dev/null || :
- fi
- if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
- then
- _is_target=y
- elif grep -m 1 -E -f "${DBDIR}/requires/$origin/dependents.pattern" "${DBDIR}/target_required_ports.specified" > /dev/null 2> /dev/null
- then
- _is_required=y
- fi
- fi
- _is_required=
- if [ `cat "${DBDIR}/target_dependent_ports.specified" 2> /dev/null | wc -l` -gt 0 ]
- then
- _is_all=
- if [ ! -f "${DBDIR}/requires/$origin/requires.pattern" ]
- then
- str_escape_regexp_filter < "${DBDIR}/requires/$origin/requires" | sed 's/^/^/;s/$/$/' > "${DBDIR}/requires/$origin/requires.pattern" 2> /dev/null || :
- fi
- if [ -n "${_is_target}" ] || grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
- then
- _is_target=y
- elif grep -m 1 -E -f "${DBDIR}/requires/$origin/requires.pattern" "${DBDIR}/target_dependent_ports.specified" > /dev/null 2> /dev/null
- then
- _is_dependent=y
- fi
- fi
+ _chk_if_target "$origin"
+ cp /dev/null "${TMPDIR}"/msg_if_target
if [ -z "${_is_all}" ]
then
if [ -n "${_is_target}${_is_dependent}${_is_required}" ]
then
- [ "${_is_target}" = y ] && echo "(Target port)"
- [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))"
- [ "${_is_required}" = y ] && echo "(Required by the target port(s))"
+ [ "${_is_target}" = y ] && echo "(Target port)" > ${TMPDIR}/msg_if_target
+ [ "${_is_dependent}" = y ] && echo "(Dependent of the target port(s))" >> ${TMPDIR}/msg_if_target
+ [ "${_is_required}" = y ] && echo "(Required by the target port(s))" >> ${TMPDIR}/msg_if_target
else
echo "========== $counter (Skipping an irrelative package for port $position_msg at `timestamp`) =========="
echo
if grep -m 1 -E "^`str_escape_regexp ${origin}`$" "${DBDIR}/HOLD_PORTS.conflist" 2> /dev/null > /dev/null
then
echo "========== $counter (Skipping a hold package for port $position_msg at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/taboo.all.list" 2> /dev/null > /dev/null
then
echo "========== $counter (Ignored a taboo port $position_msg at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
continue
if grep -m 1 -E "^`str_escape_regexp $origin`$" "${DBDIR}/manually_done.list" 2> /dev/null > /dev/null
then
echo "========== $counter (Marking a manually-done port $position_msg as success at `timestamp`) =========="
+ cat ${TMPDIR}/msg_if_target
echo
record_success $origin
rm_a_line "$origin" "${DBDIR}/reinst_todo.list"
fi
_MSG_CURRENT_STAGE="$instdesc process for $position_msg $counter"
echo "========== $counter Starting $instdesc process for $position_msg at `timestamp` =========="
- [ "${_is_target}" = y ] && echo '(Target port)'
- [ "${_is_dependent}" = y ] && echo '(Dependent of the target port(s))'
- [ "${_is_required}" = y ] && echo '(Required by the target port(s))'
+ cat ${TMPDIR}/msg_if_target
cd "${PORTSDIR}/$origin"
if [ -e "${DBDIR}/requires/$origin/status/in_build" ]
then
echo " You should also consider whether the failed ports are really required, viz.,"
echo "not obsolete dependencies, by using pkg_info(1) with -R option."
echo " After resolving the problems, execute"
- echo " ${APPNAME} ok [resolved_port_globs]"
+ echo " ${APPNAME} ok add [resolved_port_globs]"
echo "and restart by"
echo " ${APPNAME} redo"
echo "****************"