From 354675fb5ab8b0ae5fc762f5b13f228858249353 Mon Sep 17 00:00:00 2001 From: Mamoru Sakaue / MwGhennndo Date: Wed, 4 Jul 2018 00:03:34 +0800 Subject: [PATCH] [NEW] Option -x is added. Changes to be committed: modified: lib/libmain.sh modified: lib/libpkgsys.sh modified: lib/main/liboptions.sh modified: lib/main/libusage.sh modified: man/portsreinstall-chroot.8 modified: man/portsreinstall.8 --- lib/libmain.sh | 2 +- lib/libpkgsys.sh | 52 ++++++++++++++++++++++++++++++++------------- lib/main/liboptions.sh | 1 + lib/main/libusage.sh | 1 + man/portsreinstall-chroot.8 | 3 ++- man/portsreinstall.8 | 9 ++++++++ 6 files changed, 51 insertions(+), 17 deletions(-) diff --git a/lib/libmain.sh b/lib/libmain.sh index c4659eb..ca4a1ba 100644 --- a/lib/libmain.sh +++ b/lib/libmain.sh @@ -12,7 +12,7 @@ main_set_version () MYVERSION=4.0.0 COMPATIBLE_VERSIONS='^(4\.[0]\.[0])$' # Template for development versions - MYVERSION=4.0.0+toward_4.0.1_20180703161959 + MYVERSION=4.0.0+toward_4.0.1_20180703235816 COMPATIBLE_VERSIONS='^(4\.[0]\.[0]|4\.[0]\.[0]+(|\+toward_4\.[0]\.[1]+_[0-9]+))$' } diff --git a/lib/libpkgsys.sh b/lib/libpkgsys.sh index 1414cc8..10fd38a 100644 --- a/lib/libpkgsys.sh +++ b/lib/libpkgsys.sh @@ -442,10 +442,13 @@ pkgsys_def_pkgtools () } pkg_delete_f () { - pkg delete -fqy "$@" + local opt_del + opt_del= + [ $no_exec_inst_script = yes ] && opt_del='-D' + pkg delete -fqy $opt_del "$@" 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 "$@" + pkg delete -fy $opt_del "$@" } pkg_add_tools () { @@ -466,7 +469,7 @@ pkgsys_def_pkgtools () } pkg_add_f () { - local pkgarc pkg pkg_tool pkg_gen + local pkgarc pkg pkg_tool pkg_gen opt_add pkg_tool= pkg_gen= for pkgarc in "$@" @@ -484,7 +487,9 @@ pkgsys_def_pkgtools () then rm -rf "${TMPDIR}/pkg_add_f" mkdir -p "${TMPDIR}/pkg_add_f" - ( cd "${TMPDIR}/pkg_add_f" && ln -s $pkg_gen && env ASSUME_ALWAYS_YES=YES pkg add * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_add_f" && ln -s $pkg_gen && env ASSUME_ALWAYS_YES=YES pkg add $opt_add * ) fi } pkg_add_fF () @@ -513,13 +518,15 @@ pkgsys_def_pkgtools () } pkg_inst_remote () { - local pkg pkgarc + local pkg pkgarc opt_add pkg=$1 pkg_inst_remote_verify_fetch "$pkg" || return pkgarc=`pkgsys_pkgname_to_pkgarc "${PKGNG_PKG_CACHEDIR}" "$pkg"` || return rm -rf "${TMPDIR}/pkg_inst_remote" mkdir -p "${TMPDIR}/pkg_inst_remote" - ( cd "${TMPDIR}/pkg_inst_remote" && ln -s "$pkgarc" && env ASSUME_ALWAYS_YES=YES pkg add * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_inst_remote" && ln -s "$pkgarc" && env ASSUME_ALWAYS_YES=YES pkg add $opt_add * ) } pkg_inst_wild_verify_pkg () { @@ -549,14 +556,16 @@ pkgsys_def_pkgtools () } pkg_inst_remote_wild () { - local pkg pkgarc + local pkg pkgarc opt_add pkg=$1 if pkg_inst_remote_wild_verify_fetch "$pkg" then pkgarc=`pkgsys_fetch_legacy_remote__fetched_pkg` rm -rf "${TMPDIR}/pkg_inst_remote_wild" mkdir -p "${TMPDIR}/pkg_inst_remote_wild" - ( cd "${TMPDIR}/pkg_inst_remote_wild" && ln -s "$pkgarc" && pkg_add -ifF * ) || return + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_inst_remote_wild" && ln -s "$pkgarc" && pkg_add -ifF $opt_add * ) || return message_echo "INFO: Trying to convert the installed legacy package to pkgng." pkg2ng || : message_echo "INFO: Checking whether the conversion is successful." @@ -565,7 +574,7 @@ pkgsys_def_pkgtools () } pkg_inst_remote_repository_version () { - local origin origin_unflavored pkg pkgarc tmp_pkgcell + local origin origin_unflavored pkg pkgarc tmp_pkgcell opt_add origin=$1 origin_unflavored=`expr "$origin" : '\([^@]*\)'` || return [ -n "$origin_unflavored" ] || return @@ -576,7 +585,9 @@ pkgsys_def_pkgtools () tmp_pkgcell=${TMPDIR}/pkg_inst_remote_any_version:pkgcell rm -rf "$tmp_pkgcell" mkdir -p "$tmp_pkgcell" - ( cd "$tmp_pkgcell" && ln -s "$pkgarc" && env ASSUME_ALWAYS_YES=YES pkg add * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "$tmp_pkgcell" && ln -s "$pkgarc" && env ASSUME_ALWAYS_YES=YES pkg add $opt_add * ) } pkg_get_pkgs_timestamps () { @@ -767,21 +778,30 @@ pkgsys_def_pkgtools () } pkg_delete_f () { - pkg_delete -f "$@" + local opt_del + opt_del= + [ $no_exec_inst_script = yes ] && opt_del='-D' + pkg_delete -f $opt_del "$@" } pkg_add_f () { + local opt_add rm -rf "${TMPDIR}/pkg_add_f" mkdir -p "${TMPDIR}/pkg_add_f" ln -s "$@" "${TMPDIR}/pkg_add_f" - ( cd "${TMPDIR}/pkg_add_f" && pkg_add -if * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_add_f" && pkg_add -if $opt_add * ) } pkg_add_fF () { + local opt_add rm -rf "${TMPDIR}/pkg_add_f" mkdir -p "${TMPDIR}/pkg_add_f" ln -s "$@" "${TMPDIR}/pkg_add_f" - ( cd "${TMPDIR}/pkg_add_f" && pkg_add -ifF * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_add_f" && pkg_add -ifF $opt_add * ) } pkg_inst_verify_pkg () { @@ -805,7 +825,7 @@ pkgsys_def_pkgtools () } pkg_inst_remote () { - local pkg pkgarc + local pkg pkgarc opt_add pkg=$1 if pkg_inst_remote_verify_fetch "$pkg" then @@ -813,7 +833,9 @@ pkgsys_def_pkgtools () rm -rf "${TMPDIR}/pkg_inst_remote" mkdir -p "${TMPDIR}/pkg_inst_remote" ln -s "$@" "${TMPDIR}/pkg_add_f" - ( cd "${TMPDIR}/pkg_inst_remote" && ls -s "$pkgarc" && pkg_add -ifF * ) + opt_add= + [ $no_exec_inst_script = yes ] && opt_add='-I' + ( cd "${TMPDIR}/pkg_inst_remote" && ls -s "$pkgarc" && pkg_add -ifF $opt_add * ) fi } pkg_inst_wild_verify_pkg () diff --git a/lib/main/liboptions.sh b/lib/main/liboptions.sh index b25c75c..14afa8c 100644 --- a/lib/main/liboptions.sh +++ b/lib/main/liboptions.sh @@ -50,6 +50,7 @@ G use-prebuilt-package opt_inst_by_pkg_if_can no yes l use-legacy-package-for-missing-pkgng opt_use_legacy_pkg_for_missing_pkgng no yes f disallow-force-continuation-for-looped-dependency opt_disallow_force_continuation_for_looped_dependency no yes F fetch-only opt_fetch_only no yes +x no-exec-inst-script no_exec_inst_script no yes eof } diff --git a/lib/main/libusage.sh b/lib/main/libusage.sh index 4713aea..dcf2e69 100644 --- a/lib/main/libusage.sh +++ b/lib/main/libusage.sh @@ -44,6 +44,7 @@ USAGE: portsreinstall [OPTIONS] [--] [command] -q : Only new ports and their run-time requirements are reinstalled. -s : Build of vulnerable ports are avoided by triggering errors. -X : Deselect all deinstallation candidates. + -x : No execution of pre/post-(de)installation scripts -Y : Select all deinstallation candidates. -O glob1[:glob2[:...]] : Reinstall only target ports themselves. diff --git a/man/portsreinstall-chroot.8 b/man/portsreinstall-chroot.8 index 0bdc2f6..095ccdb 100644 --- a/man/portsreinstall-chroot.8 +++ b/man/portsreinstall-chroot.8 @@ -262,9 +262,10 @@ root@[host]# root@[chroot]# .RE 4. In the chroot (builder) environment, upgrade the all pakages completely by \fBportsreinstall\fR (the command line options are just an example; muitiple redoing and reconfiguration of port options and other configuration files of ports management may be required). +It is highly recommended to put \fB\-x\fR option. .RS root@[chroot]# -.B portsreinstall -qC +.B portsreinstall -qxC .RE 5. Exit from the chroot (builder) environment. .RS diff --git a/man/portsreinstall.8 b/man/portsreinstall.8 index d9b94f6..202da6c 100644 --- a/man/portsreinstall.8 +++ b/man/portsreinstall.8 @@ -541,6 +541,13 @@ If you desire to uninstall them, do it manually. Automatically deselect all candidates for deinstallation of leaf or obsolete ports. This option conflicts with \fB\-Y\fR option. .PD +.IP \fB\-x\fR +.PD 0 +.TP +\fB\-\-no\-exec\-inst\-script\fR +Execution of scripts in pre-installation, post-installation and deinstallation defined for each package is skipped. +This option is suitable for package build in \fBportsreinstall\-chroot\fR(8) or other change-rooted/jailed environment. +.PD .IP \fB\-Y\fR .PD 0 .TP @@ -1068,6 +1075,8 @@ Configuration file of \fBportupgrade\fR(1). .TP 4.0.1 (?? July 2018) .RS +[NEW] Option \fB\-x\fR is added. +.PP [IMPROVED] It is changed to show messages of reset ports at the stage of reloading ${LOCALBASE}/etc/portsreinstall.conf. .PP [BUG FIX] Changes made by commands or in ${LOCALBASE}/etc/portsreinstall.conf were not reflected to dependents of the specified ports in the redo runs with incorrect messages notifying as already inspected merged ports. -- 2.11.0