OSDN Git Service

Fixed bugs related to portsreinstall packupgrade and portsreinstall-upgrade.
authorMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 11 Sep 2018 16:02:40 +0000 (00:02 +0800)
committerMamoru Sakaue / MwGhennndo <glmwghennndo@users.sourceforge.jp>
Tue, 11 Sep 2018 16:02:40 +0000 (00:02 +0800)
 Changes to be committed:
modified:   lib/chroot-mount/liboptions.sh
modified:   lib/chroot/libcommand.sh
modified:   lib/chroot/libcommand_do.sh
modified:   lib/libcommand.sh
modified:   lib/libcommand_pkgs.sh
modified:   lib/libmain.sh
modified:   lib/libpkgsys.sh
modified:   lib/main/libcommand.sh
modified:   lib/main/liboptions.sh
modified:   lib/upgrade/libcommand.sh
modified:   lib/upgrade/libcommand_do.sh
modified:   lib/upgrade/liboptions.sh
modified:   share/bin/portsreinstall-chroot-mount

13 files changed:
lib/chroot-mount/liboptions.sh
lib/chroot/libcommand.sh
lib/chroot/libcommand_do.sh
lib/libcommand.sh
lib/libcommand_pkgs.sh
lib/libmain.sh
lib/libpkgsys.sh
lib/main/libcommand.sh
lib/main/liboptions.sh
lib/upgrade/libcommand.sh
lib/upgrade/libcommand_do.sh
lib/upgrade/liboptions.sh
share/bin/portsreinstall-chroot-mount

index fe58113..98ab6f7 100644 (file)
@@ -22,3 +22,10 @@ J    just-save-options       opt_just_save_options   no      yes
 S      no-opening-message      opt_no_opening_message  no      yes
 eof
 }
+
+# ============= Regularize the option value =============
+options_regularize ()
+{
+       opt_packages_dir=`fs_global_path "$opt_packages_dir"`
+       opt_invalidate_mount_privilege=no
+}
index 46316bb..a077a55 100644 (file)
@@ -108,12 +108,12 @@ command_all_exec_before_tools_upgrade ()
        case $COMMAND_MODE in
        clean )
                database_maintain_clean
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        destroy )
                database_maintain_destroy
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        unmount )
@@ -125,7 +125,7 @@ command_all_exec_before_tools_upgrade ()
                fs_build_chroot
                fs_mount
                temp_reset_termination_messages_common
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        enter )
@@ -152,7 +152,7 @@ command_all_exec_before_tools_upgrade ()
                fs_build_chroot
                fs_mount
                command_do_update_host_files
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        esac
index 9a49de4..e5ec829 100644 (file)
@@ -347,26 +347,24 @@ command_do_chroot_update_host_pkgs ()
        PROGRAM_DEPENDS='UPDATE_HOST'
        _program_exec_and_record_completion__operation ()
        {
+               local storedir
                message_section_title "Extract the upgrade archive"
-               (
-                       cd "$opt_basedir"/store
-                       rm -rf work
-                       mkdir work
-                       tar xzf portsreinstall-upgrade.tar.gz -C work
-               )
+               storedir=$opt_basedir/store
+               rm -rf "$storedir/work"
+               mkdir "$storedir/work"
+               tar xzf "$storedir/portsreinstall-upgrade.tar.gz" -C "$storedir/work"
+               message_echo
        }
        program_exec_and_record_completion EXTRACT_SCRIPT_ARCHIVE
        PROGRAM_DEPENDS='EXTRACT_SCRIPT_ARCHIVE'
        _program_exec_and_record_completion__operation ()
        {
+               local opt_quiet
                message_section_title "Update the packages at the host environment"
-               (
-                       cd "$opt_basedir"/store
-                       opt_quiet=
-                       [ $opt_batch_mode = yes ] && opt_quiet='-a '
-                       work/portsreinstall-upgrade -S clean
-                       work/portsreinstall-upgrade -S $opt_quiet -P "${PACKAGES}/${PKGREPOSITORYSUBDIR}"
-               )
+               opt_quiet=
+               [ $opt_batch_mode = yes ] && opt_quiet='-a '
+               $opt_basedir/store/work/portsreinstall-upgrade -S clean
+               $opt_basedir/store/work/portsreinstall-upgrade -S $opt_quiet -P "${PACKAGES}/${PKGREPOSITORYSUBDIR}"
        }
        program_exec_and_record_completion UPGRADE_HOST
 }
index 5d8ce58..3bc375c 100644 (file)
@@ -61,6 +61,7 @@ command_all_parse_args ()
 # ============= Notify that option settings are reset =============
 command_exec_without_pkgtools__notify_reset_options ()
 {
+       [ $opt_no_opening_message = yes ] && return
        message_echo "NOTE: Option settings are ignored (because of no effect) and reset."
 }
 
index 448fe4b..3b42c0d 100644 (file)
@@ -401,7 +401,6 @@ command_pkgs_packupgrade_create__pack ()
                install -m 444 "${MYPREFIX}/man/man8/${PROGRAM}-upgrade.8.gz" "$dstdir/man/man8"
                tar czf "$dstdir.tar.gz" -C "$dstdir" .
                touch "$dstdir/complete"
-               message_echo
        }
        program_exec_and_record_completion COMMAND_PACKUPGRADE_PACK
 }
@@ -441,6 +440,7 @@ command_pkgs_packupgrade_crop ()
        fi
        cp "$dstdir.tar.gz" "${COMMAND_PACKUPGRADE_SAVEPATH}"
        message_echo "INFO: The cropped archive is saved as [${COMMAND_PACKUPGRADE_SAVEPATH}]."
+       message_echo
 }
 
 # ============= Operation of make command =============
index fc1ca3f..0a00d41 100644 (file)
@@ -12,7 +12,7 @@ main_set_version ()
        MYVERSION=4.1.0
        COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
        # Template for development versions
-       MYVERSION=4.0.0+toward_4.1.0_20180911205455
+       MYVERSION=4.0.0+toward_4.1.0_20180912000219
        COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
 }
 
index ba4e731..e24db5b 100644 (file)
@@ -486,7 +486,7 @@ pkgsys_def_pkgtools ()
                {
                        local opt_del opt_quit dev_out dev_err
                        opt_del=
-                       [ $no_exec_inst_script = yes ] && opt_del='-D'
+                       [ $opt_no_exec_inst_script = yes ] && opt_del='-D'
                        opt_quit=
                        dev_out=/dev/stdout
                        dev_err=/dev/stderr
@@ -550,7 +550,7 @@ pkgsys_def_pkgtools ()
                                rm -rf "${TMPDIR}/pkg_add_f"
                                mkdir -p "${TMPDIR}/pkg_add_f"
                                opt_add=
-                               [ $no_exec_inst_script = yes ] && opt_add='-I'
+                               [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                                opt_quit=
                                dev_out=/dev/stdout
                                dev_err=/dev/stderr
@@ -602,7 +602,7 @@ pkgsys_def_pkgtools ()
                        rm -rf "${TMPDIR}/pkg_inst_remote"
                        mkdir -p "${TMPDIR}/pkg_inst_remote"
                        opt_add=
-                       [ $no_exec_inst_script = yes ] && opt_add='-I'
+                       [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                        opt_quit=
                        dev_out=/dev/stdout
                        dev_err=/dev/stderr
@@ -650,7 +650,7 @@ pkgsys_def_pkgtools ()
                                rm -rf "${TMPDIR}/pkg_inst_remote_wild"
                                mkdir -p "${TMPDIR}/pkg_inst_remote_wild"
                                opt_add=
-                               [ $no_exec_inst_script = yes ] && opt_add='-I'
+                               [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                                dev_out=/dev/stdout
                                dev_err=/dev/stderr
                                if [ $opt_batch_mode = yes ]
@@ -892,7 +892,7 @@ pkgsys_def_pkgtools ()
                {
                        local opt_del dev_out dev_err
                        opt_del=
-                       [ $no_exec_inst_script = yes ] && opt_del='-D'
+                       [ $opt_no_exec_inst_script = yes ] && opt_del='-D'
                        dev_out=/dev/stdout
                        dev_err=/dev/stderr
                        if [ $opt_batch_mode = yes ]
@@ -909,7 +909,7 @@ pkgsys_def_pkgtools ()
                        mkdir -p "${TMPDIR}/pkg_add_f"
                        ln -s "$@" "${TMPDIR}/pkg_add_f"
                        opt_add=
-                       [ $no_exec_inst_script = yes ] && opt_add='-I'
+                       [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                        dev_out=/dev/stdout
                        dev_err=/dev/stderr
                        if [ $opt_batch_mode = yes ]
@@ -926,7 +926,7 @@ pkgsys_def_pkgtools ()
                        mkdir -p "${TMPDIR}/pkg_add_f"
                        ln -s "$@" "${TMPDIR}/pkg_add_f"
                        opt_add=
-                       [ $no_exec_inst_script = yes ] && opt_add='-I'
+                       [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                        dev_out=/dev/stdout
                        dev_err=/dev/stderr
                        if [ $opt_batch_mode = yes ]
@@ -967,7 +967,7 @@ pkgsys_def_pkgtools ()
                                mkdir -p "${TMPDIR}/pkg_inst_remote"
                                ln -s "$@" "${TMPDIR}/pkg_add_f"
                                opt_add=
-                               [ $no_exec_inst_script = yes ] && opt_add='-I'
+                               [ $opt_no_exec_inst_script = yes ] && opt_add='-I'
                                dev_out=/dev/stdout
                                dev_err=/dev/stderr
                                if [ $opt_batch_mode = yes ]
index 8b8e83a..eb03756 100644 (file)
@@ -29,7 +29,7 @@ command_all_exec_before_db_creation ()
                force )
                        message_echo "INFO: The temporary database is tried to be cleaned up without checking the privilege."
                        database_maintain_clean_all
-                       message_echo "Done"
+                       [ $opt_no_opening_message = yes ] || message_echo "Done"
                        exit
                        ;;
                esac
@@ -293,12 +293,6 @@ command_all_parse_args ()
        COMMAND_SHIFT=$(($num_args_init - $#))
 }
 
-# ============= Notify that option settings are reset =============
-command_exec_without_pkgtools__notify_reset_options ()
-{
-       message_echo "NOTE: Option settings are ignored (because of no effect) and reset."
-}
-
 # ============= Execute command operations which do not need package tools =============
 command_all_exec_without_pkgtools ()
 {
@@ -315,7 +309,7 @@ command_all_exec_without_pkgtools ()
                        database_maintain_load "$COMMAND_LOAD_FILE"
                        ;;
                esac
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        esac
@@ -394,7 +388,7 @@ command_all_exec_irrespective_of_saved_options ()
                arcfile=`realpath "$COMMAND_SAVE_DIR"`/${APPNAME}_`date +%Y%m%d_%H%M%S`.tar.gz
                message_echo "Starting to save the temporary database as [$arcfile]..."
                database_maintain_save "$arcfile"
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        glob )
@@ -449,7 +443,7 @@ command_all_exec_irrespective_of_saved_options ()
                        command_pkgs_packupgrade
                        ;;
                esac
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        redo )
@@ -467,12 +461,12 @@ command_all_exec_before_tools_upgrade ()
                message_echo "Starting to reset the temporary database by preserving the initial snapshot of installed packages..."
                if [ ! -d "${DBDIR}" ]
                then
-                       message_echo "INFO: No temporary database is built yet."
+                       [ $opt_no_opening_message = yes ] || message_echo "INFO: No temporary database is built yet."
                else
                        database_maintain_reset "$COMMAND_OPERATION"
-                       message_echo "INFO: Option settings and taboo/freeze/need/noneed lists are preserved."
+                       [ $opt_no_opening_message = yes ] || message_echo "INFO: Option settings and taboo/freeze/need/noneed lists are preserved."
                fi
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        options )
index 28b29dc..cc59653 100644 (file)
@@ -52,7 +52,7 @@ l     use-legacy-package-for-missing-pkgng    opt_use_legacy_pkg_for_missing_pkgng    no      y
 f      disallow-force-continuation-for-looped-dependency       opt_disallow_force_continuation_for_looped_dependency   no      yes
 j      delete-then-reinstall   opt_delete_then_reinstall       no      yes
 F      fetch-only      opt_fetch_only  no      yes
-x      no-exec-inst-script     no_exec_inst_script     no      yes
+x      no-exec-inst-script     opt_no_exec_inst_script no      yes
 eof
 }
 
index 0e2de1d..5415dac 100644 (file)
@@ -48,9 +48,9 @@ command_all_exec_without_pkgtools ()
        case $COMMAND_MODE in
        clean )
                command_exec_without_pkgtools__notify_reset_options
-               message_echo "Starting to clean up the temporary database..."
+               [ $opt_no_opening_message = yes ] || message_echo "Starting to clean up the temporary database..."
                database_maintain_clean_all
-               message_echo "Done"
+               [ $opt_no_opening_message = yes ] || message_echo "Done"
                exit
                ;;
        esac
index f40c3fc..ae69b0b 100644 (file)
@@ -78,7 +78,7 @@ command_do_reinst_ports ()
                        then
                                datetime_init=`expr "$timestamp_init" : '[^:]*:\([0-9]*\)' || :`
                                datetime_fin=`expr "$timestamp_fin" : '[^:]*:\([0-9]*\)' || :`
-                               [ -n "$datetime_init" -a -n "$datetime_fin" -a "$datetime_init" -ge "$datetime_fin" ] && break
+                               [ -n "$datetime_init" -a -n "$datetime_fin" -a "$datetime_init" -ge "$datetime_fin" ] && return
                        fi
                fi
                case $cmd in
index 2f7b9c8..9f6a88e 100644 (file)
@@ -46,4 +46,5 @@ eof
 options_regularize ()
 {
        opt_packages_dir=`fs_global_path "$opt_packages_dir"`
+       opt_no_exec_inst_script=no
 }
index 3f71932..9eb4f4e 100755 (executable)
@@ -72,7 +72,6 @@ fs_save_current_systembase "${SYSTEMBASE}"
 main_parse_options_arguments "$@"
 shift "${OPTIONS_SHIFT}"
 shift "${COMMAND_SHIFT}"
-opt_invalidate_mount_privilege=no
 
 # ========================================================
 # ================== SET UP OF PARAMETERS ==================