Bumped to a release version, with several bug fix related to the new features of this release version.
modified: README
modified: bin/portsreinstall
modified: lib/libpkgsys.sh
modified: lib/libreinstall.sh
modified: man/portsreinstall.8
================================================================================
portsreinstall - ports upgrading utility for massive forced reinstallation
- Version 3.2.0, December 28, 2014
+ Version 3.2.0, December 30, 2014
Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
================================================================================
# ============ Set up of environment =============
APPNAME=`basename "$0"`
-# MYVERSION=3.2.0
-# COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
+MYVERSION=3.2.0
+COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+)$'
# Template for development versions
-MYVERSION=3.1.1+toward_3.2.0_20141228231007
-COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+\+toward_3\.[1-2]\.[0-9]+_[0-9]+|3\.[1-2]\.[0-9]+)$'
+# MYVERSION=3.1.1+toward_3.2.0_20141228231007
+# COMPATIBLE_VERSIONS='^(3\.[1-2]\.[0-9]+\+toward_3\.[1-2]\.[0-9]+_[0-9]+|3\.[1-2]\.[0-9]+)$'
MYPREFIX=`dirname "\`dirname \"$0\"\`" | sed 's|/bin$||'`
MYPREFIX=${MYPREFIX:-/usr/local}
LIBDIR=${MYPREFIX}/lib/${APPNAME}
pkgsys_is_pkgtool ()
{
case $1 in
- ports-mgmt/pkg|ports-mgmt/pkg-devel|ports-mgmt/dialog4ports|ports-mgmt/dialog4ports-static)
+ ports-mgmt/pkg|ports-mgmt/pkg-devel|ports-mgmt/dialog4ports)
;;
*) return 1;;
esac
pkg_delete_f ()
{
pkg delete -fqy "$@"
+ pkg -N 2> /dev/null || return 0 # If pkg(8) is deinstalled successfully
pkg info -e "$@" || return 0 # Countermeasure for a bug found for pkg-1.3.4 (at least not until 1.2.7_4)
pkg delete -fy "$@"
}
message_echo "WARNING: Failed to create backup package for $pkgname." >&2
return 1
fi
- dbpath=${DBDIR}/requires/$origin
- [ -d "$dbpath" ] || dbpath=${DBDIR}/initial/$origin
+ dbpath=${DBDIR}/backup/$origin
+ [ -d "$dbpath" ] || mkdir -p "$dbpath"
pkg_info_qL > $dbpath/previously_installed_files
[ -d "$dstdir" ] || mkdir -p "$dstdir"
mv "${TMPDIR}/package.tmp/$backup_pkg" "$dstdir"
# ============= Get a file list to be restored by the current backup package for a port origin =============
pkgsys_get_restored_files_by_backup_pkg ()
{
- local origin dbpath
+ local origin
origin=$1
- dbpath=${DBDIR}/requires/$origin
- [ -d "$dbpath" ] || dbpath=${DBDIR}/initial/$origin
- cat "$dbpath/previously_installed_files" 2> /dev/null || :
+ cat "${DBDIR}/backup/$origin/previously_installed_files" 2> /dev/null || :
+}
+
+# ============= Check whether any file match restored files by the current backup package for a port origin =============
+pkgsys_chk_match_to_restored_files_by_backup_pkg ()
+{
+ local origin
+ origin=$1
+ pattern_file=$2
+ while read pattern
+ do
+ grep -qE "$pattern" "${DBDIR}/backup/$origin/previously_installed_files" && return
+ done < $pattern_file
+ false
}
# ============= Get a package name from a package archive file name =============
mode=$1
origin=$2
tmp_conflicts=${TMPDIR}/pkgsys_get_conflicting_installed_pkgs::conflicts
- pkg_info_Eg `pkgsys_get_conflicting_pkgs_patterns "$mode" "$origin"` > $tmp_conflicts || :
+ pkgsys_get_conflicting_pkgs_patterns "$mode" "$origin" | while read pkg_pattern
+ do
+ pkg_info_Eg "$pkg_pattern" || :
+ done > $tmp_conflicts
cat "$tmp_conflicts"
[ `wc -l < $tmp_conflicts` -gt 0 ]
}
pkg=`pkg_which "$filepath"`
[ -z "$pkg" ] && continue
origin=`pkg_info_qo "$pkg"`
- [ x"$pkg" = x"$REINSTALL_ORIGIN" ] || echo "$pkg"
+ [ x"$origin" = x"$REINSTALL_ORIGIN" ] || echo "$pkg"
done
pkgsys_get_conflicting_installed_pkgs install "$REINSTALL_ORIGIN"
} | sort -u | reinstall_backup_and_delete_conflicts
if reinstall_chk_stage in_stage
then
message_echo "(Restarting the previously terminated staging process...)"
- flag_restarted_stage=yes
else
reinstall_register_stage in_stage
- flag_restarted_stage=no
fi
if ! reinstall_chk_stage_complete STAGE
then
if reinstall_chk_stage in_install
then
message_echo "(Restarting the previously terminated installation process...)"
- flag_restarted_build=yes
else
reinstall_register_stage in_install
- flag_restarted_build=no
fi
reinstall_pkg_backup || :
if [ -e "$REINSTALL_DBNODE_DIR/BEFOREDEINSTALL.conf" ] && ! reinstall_chk_stage_complete BEFOREDEINSTALL
fi
if ! reinstall_chk_stage_complete INSTALL
then
- if pkgsys_is_necessary_pkgtool
+ if pkgsys_is_necessary_pkgtool "$REINSTALL_ORIGIN"
then
reinstall_backup_and_delete_remaining_install_conflicts
reinstall_deinstall
cat "${DBDIR}/backup_pkgarcs.lst" 2> /dev/null \
| while read origin_bak pkgpath_bak
do
- if pkgsys_get_restored_files_by_backup_pkg "$origin_bak" \
- | grep -qE -f "${TMPDIR}/previously_installed_files.grep_pattern"
+ if pkgsys_chk_match_to_restored_files_by_backup_pkg "$origin_bak" "${TMPDIR}/previously_installed_files.grep_pattern"
then
pkg_bak=`pkgsys_pkgarc_to_pkgname "$pkgpath_bak"`
fileedit_add_a_line_if_new "$pkg_bak:$REINSTALL_NEWPKGNAME" \
.\" ports reinstall installation guide
.\" Copyright (C) 2010-2014 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
.\" ==================================================================================
-.TH PORTSREINSTALL 8 "28 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
+.TH PORTSREINSTALL 8 "30 December 2014" "FreeBSD" "FreeBSD System Manager's Manual"
.SH NAME
portsreinstall \- ports upgrading utility for massive forced reinstallation
.SH SYNOPSIS
.TP
\fB\-\-suppress\-pkgtools\-upadte\fR
Keep indispensable packages for the standard function of the ports/packages system untouched.
-Concretely, this option suppresses upgrade, de/re-installation of the currently installed ports-mgmt/pkg(\-devel) and ports-mgmt/dialog4ports(\-static).
+Concretely, this option suppresses upgrade, de/re-installation of the currently installed ports-mgmt/pkg(\-devel) and ports-mgmt/dialog4ports.
.PD
.IP \fB\-I\fR
.PD 0
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-3.2.0 (28 December 2014)
+3.2.0 (30 December 2014)
.RS
[IMPROVED] The automatic resolution of installation conflict is improved to avoid stripping due to restore\-and\-delete of backup packages that possibly occurs when the default version changes.
.PP
-[IMPROVED] Support for cases that ports-mgmt/pkg-devel or ports-mgmt/dialog4ports-static is used are implemented.
+[IMPROVED] Support for cases that alternative version of ports\-mgmt/pkg (ports\-mgmt/pkg\-devel, switched by defining WITH_PKG=devel in /etc/make.conf) or ports-mgmt/dialog4ports (DIALOGPORT=\fIport_origin\fR in /etc/make.conf, reserved for the future) is used are implemented.
.PP
[BUG FIX] Reinstallation of pkg(8) could encounter error termination.
.RE