command_do_update_host_files ()
{
local dirpath filepath
+ [ "x$opt_share_port_pkgs_dirs" = xyes ] && return
message_section_title "Update the files affecting package installation of the host environment"
message_echo "INFO: targets are packages, distfiles, port options and ports/packages management tools configurations"
for dirpath in "${DISTDIR}" "${PACKAGES}" "${PORT_DBDIR}"
mkdir -p "$nodedir"
cp -p "$opt_basedir/builder$dirpath/$file" "$dirpath/$file"
done
- find -d $dirpath -type d -empty -delete
+ find -d $dirpath -mindepth 1 -type d -empty -delete
done
for filepath in "${LOCALBASE}"/etc/portsreinstall.conf "${LOCALBASE}"/etc/pkgtools.conf "${LOCALBASE}"/etc/pkg.conf /etc/make.conf "${DBDIR}"
do
local mode stdout
[ $opt_fullcourse = no ] && return
message_section_title "Full course starter: Update the ports tree"
- if [ -e "$opt_basedir/builder$PORTSNAP_WORKDIR/INDEX" ]
- then
- mode=update
- else
- mode=extract
- fi
- if [ $opt_batch_mode = no ]
- then
- stdout=/dev/stdout
- else
- stdout=/dev/null
- fi
- chroot "$opt_basedir"/builder /usr/bin/env portsnap fetch $mode > $stdout
+ pkgsys_update_portstree
message_echo
}
program_exec_and_record_completion STARTER_GUEST_PORTS_TREE
}
-# ============= Starter process in the chroot environment: Update the package repository =============
+# ============= Starter process of the full course: Update the package repository =============
command_do_starter_pkg ()
{
local PROGRAM_DEPENDS
local opts
[ $opt_fullcourse = no ] && return
message_section_title "Full course starter: Update the package repository"
- if [ $opt_batch_mode = no ]
- then
- opts=
- else
- opts='-q'
- fi
- chroot "$opt_basedir"/builder /usr/bin/env pkg update $opts
+ pkg_update_pkgrepository
message_echo
}
program_exec_and_record_completion STARTER_GUEST_PKG_REPO
}
-# ============= Starter process in the chroot environment: Clean the temporary database =============
+# ============= Starter process of the full course: Clean the temporary database =============
command_do_starter_clean ()
{
local PROGRAM_DEPENDS
_program_exec_and_record_completion__operation ()
{
local exitstatus
- command_do_chroot_enter
+ command_do_chroot_enter "$@"
exitstatus=`command_do_get_recent_chroot_exit_status`
[ "$exitstatus" -gt 0 ] && exit $exitstatus
command_do_chroot_postprocess
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
}
# ============= Main pre-operation of do/auto =============
command_do_pre ()
{
- # Initial clean up
- command_do_chroot_cleanup
-
# Build and mount of the chroot environment
fs_build_chroot
fs_mount