lib/libdatabase_record.sh \
lib/libdeinstall.sh \
lib/libfileedit.sh \
+ lib/libfs.sh \
lib/libmain.sh \
lib/libmessage.sh \
lib/libmisc.sh \
. ${LIBDIR}/libdatabase_record.sh
. ${LIBDIR}/libdeinstall.sh
. ${LIBDIR}/libfileedit.sh
+. ${LIBDIR}/libfs.sh
. ${LIBDIR}/libmain.sh
. ${LIBDIR}/libmessage.sh
. ${LIBDIR}/libmisc.sh
. ${LIBDIR}/libdatabase_record.sh
. ${LIBDIR}/libdeinstall.sh
. ${LIBDIR}/libfileedit.sh
+. ${LIBDIR}/libfs.sh
. ${LIBDIR}/libmain.sh
. ${LIBDIR}/libmessage.sh
. ${LIBDIR}/libmisc.sh
# ========================================================
main_setup_parameters "$@"
-misc_inspect_fs_privilege
+fs_inspect_fs_privilege
main_operation_without_pkg_management_tools "$@"
# ============= Check of the mounting/unmounting privilege of the environment =============
main_check_of_mounting_unmounting_privilege ()
{
- if ! misc_chk_mount_privilege || ! misc_chk_unmount_privilege
+ if ! fs_chk_mount_privilege || ! fs_chk_unmount_privilege
then
temp_terminate_process () { :; }
message_echo "ERROR: The current environment does not have the full privilege to mount and unmount file systems." >&2
#!/bin/sh -e
# ==============================================================================
-# portsreinstall-chroot library script for portsreinstall-chroot
+# portsreinstall-chroot library script
+# Overlay onto lib/libfs.sh for portsreinstall-chroot
# - File system operations -
# Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
# This software is distributed under the 2-Clause BSD License.
printf '%s\t%s\n' real "$src_mountpoint_real" >> ${TMPDIR}/fs_build_chroot:directories
tmpdir_descendant=${TMPDIR}/fs_build_chroot:descendant/$src_mountpoint_real
mkdir -p "$tmpdir_descendant"
- misc_get_descendant_mount_info "$systembase/$src_mountpoint_real" > $tmpdir_descendant/list
+ fs_get_descendant_mount_info "$systembase/$src_mountpoint_real" > $tmpdir_descendant/list
fi
elif [ -d "$systembase"/$directory ]
then
printf '%s\t%s\n' real $directory >> ${TMPDIR}/fs_build_chroot:directories
tmpdir_descendant=${TMPDIR}/fs_build_chroot:descendant/$directory
mkdir -p "$tmpdir_descendant"
- misc_get_descendant_mount_info "$systembase/$directory" > $tmpdir_descendant/list
+ fs_get_descendant_mount_info "$systembase/$directory" > $tmpdir_descendant/list
fi
done < ${TMPDIR}/fs_build_chroot:sys_dirs
)
[ "x$type" = xnullfs -o "x$type" = xunionfs ] && target=$systembase/$target
directory=`echo "$srcline" | cut -f 3`
opt=`echo "$srcline" | cut -f 4`
- if ! misc_chk_mounted "$type" "$target" "$systembase/$opt_basedir/builder/$directory"
+ if ! fs_chk_mounted "$type" "$target" "$systembase/$opt_basedir/builder/$directory"
then
touch "${TMPDIR}"/fs_chk_mount:remains
break
local systembase
systembase=$1
fs_chk_mount "$systembase" && return
- misc_chk_mount_privilege && return
+ fs_chk_mount_privilege && return
temp_terminate_process ()
{
local errno basedir
message_echo
message_echo "INFO: Terminated for mounting file systems because this utility was executed at a virtual (chroot or jail) environment."
message_echo "Execute"
- basedir=`misc_get_system_basedir`
+ basedir=`fs_get_system_basedir`
if [ -n "$basedir" ]
then
message_echo " $basedir${SHAREDIR}/bin/portsreinstall-chroot-mount"
directory=`echo "$srcline" | cut -f 3`
opt=`echo "$srcline" | cut -f 4`
mp=$systembase/$opt_basedir/builder/$directory
- if ! misc_chk_mounted "$type" "$target" "$mp"
+ if ! fs_chk_mounted "$type" "$target" "$mp"
then
mount -t "$type" -o "$opt" "$target" "$mp"
fi
[ "x$type" = xnullfs -o "x$type" = xunionfs ] && target=$systembase/$target
directory=`echo "$srcline" | cut -f 3`
opt=`echo "$srcline" | cut -f 4`
- if misc_chk_mounted "$type" "$target" "$systembase/$opt_basedir/builder/$directory"
+ if fs_chk_mounted "$type" "$target" "$systembase/$opt_basedir/builder/$directory"
then
touch "${TMPDIR}"/fs_chk_unmount:remains
break
local systembase
systembase=$1
fs_chk_unmount "$systembase" && return
- misc_chk_unmount_privilege && return
+ fs_chk_unmount_privilege && return
temp_terminate_process ()
{
local errno basedir
message_echo
message_echo "INFO: Terminated for unmounting file systems because this utility was executed at a virtual (chroot or jail) environment."
message_echo "Execute"
- basedir=`misc_get_system_basedir`
+ basedir=`fs_get_system_basedir`
if [ -n "$basedir" ]
then
message_echo " $basedir${SHAREDIR}/bin/portsreinstall-chroot-mount unmount"
directory=`echo "$srcline" | cut -f 3`
opt=`echo "$srcline" | cut -f 4`
mp=$systembase/$opt_basedir/builder/$directory
- if misc_chk_mounted "$type" "$target" "$mp"
+ if fs_chk_mounted "$type" "$target" "$mp"
then
umount -f "$mp"
fi
{
local errno
errno=${1:-0}
- ! fs_chk_unmount && misc_chk_mount_privilege && fs_unmount
+ ! fs_chk_unmount && fs_chk_mount_privilege && fs_unmount
temp_terminate_process_common "$errno"
}
}
# ============= Regularize the option value =============
options_regularize ()
{
- opt_basedir=`misc_global_path "$opt_basedir"`
+ opt_basedir=`fs_global_path "$opt_basedir"`
}
tmp_work=${TMPDIR}/conf_setup_ports_envs:work
rm -rf "$tmp_work"
mkdir "$tmp_work"
+ fs_fix_unionfs_image_if_hidden "${PORTSDIR}"
PORTSDIR=${PORTSDIR:-`[ -e /etc/make.conf ] && make -C "$tmp_work" -f /etc/make.conf -V PORTSDIR 2> /dev/null`} || :
PORTSDIR=${PORTSDIR:-/usr/ports}
pkgsys_chk_ports_tree_implementation
MAKE_ARGS=`database_build_setup_make_args "$origin"`
MAKE_ENVS=`database_build_setup_make_envs "$origin"`
port_path=`pkgsys_get_portpath_from_origin "$origin"`
+ fs_fix_unionfs_image_if_hidden "$port_path"
env $MAKE_ENVS make -C "$port_path" "$@" $MAKE_ARGS
}
if [ -z "$clean" -o "@$clean" = @clean ]
then
message_echo "*** Trying to clean the failed build... (Ignore failures)"
- env ${MAKE_ENVS} make clean ${MAKE_ARGS} || :
+ database_build_make "$origin" clean || :
fi
message_echo "*** Skipping this port and proceeding to next forcibly..."
message_echo
grep -v -E "^${origin_regexp}[[:space:]]" "${DBDIR}/deleted_conflicts" > ${DBDIR}/deleted_conflicts.tmp 2> /dev/null || :
mv "${DBDIR}/deleted_conflicts.tmp" "${DBDIR}/deleted_conflicts"
currentpkg=`pkgsys_get_installed_pkg_from_origin "$origin" | tr '\n' ' ' | sed 's/ *$//'`
- [ -n "$currentpkg" ] || return 0
+ [ -n "$currentpkg" ] || continue
temp_set_msg_current_stage "a ${_MSG_CURRENT_STAGE_general} process for $origin ($currentpkg) $PROGRAM_STEP_COUNTER"
database_query_get_target_attributes currentorigin "$origin"
if [ -z "${currentorigin_is_relevant}" ]
--- /dev/null
+#!/bin/sh -e
+# ==============================================================================
+# portsreinstall library script
+# - File system operations -
+# Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# This software is distributed under the 2-Clause BSD License.
+# ==============================================================================
+
+# ============= Get the global path of a possibly not yet created file/directory =============
+fs_global_path ()
+{
+ local $path_src
+ path_src=$1
+ if [ -e "$path_src" ]
+ then
+ realpath "$path_src"
+ else
+ expr "$path_src" : '^/' > /dev/null || echo -n `realpath .`
+ echo "$path_src"
+ fi
+}
+
+# ============= Inspect the privilege of the current environment on file system operation =============
+fs_inspect_fs_privilege ()
+{
+ local tgv mp mp_regexp mount_privilege basedir
+ [ -d "${TMPDIR}"/fs_privilege ] && return
+ tgv=${TMPDIR}/fs_privilege/test_tg
+ mkdir -p "$tgv" "${TMPDIR}"/fs_privilege/test_mp
+ mp=`realpath "${TMPDIR}"/fs_privilege/test_mp`
+ mp_regexp=`str_escape_regexp "$mp"`
+ echo yes > ${TMPDIR}/fs_privilege/fs_privilege
+ cat > ${TMPDIR}/fs_privilege/fslist << eof
+devfs devfs
+fdescfs null
+procfs proc
+tmpfs tmpfs
+nullfs "$tgv"
+unionfs "$tgv"
+eof
+ while read fs tg
+ do
+ if mount -t $fs "$tgv" "$mp" 2> /dev/null && umount "$mp"
+ then
+ echo yes
+ else
+ echo no
+ echo no > ${TMPDIR}/fs_privilege/fs_privilege
+ fi > ${TMPDIR}/fs_privilege/fs_privilege:$fs 2> /dev/null
+ umount -f "$mp" 2> /dev/null || :
+ [ -e "${TMPDIR}"/fs_privilege/basedir ] && continue
+ mount -t $fs "$tgv" "$mp" 2> /dev/null && \
+ df "$mp" > ${TMPDIR}/fs_privilege/df:$fs && \
+ umount "$mp"
+ real_mp=`sed 1d "${TMPDIR}"/fs_privilege/df:$fs | tail -n 1 | \
+ sed -E 's/^.*[[:space:]][0-9]+%[[:space:]]+//'`
+ echo "$real_mp" | sed -E "s/$mp_regexp$//" > ${TMPDIR}/fs_privilege/basedir
+ done < ${TMPDIR}/fs_privilege/fslist
+ mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
+ if [ "x$mount_privilege" = xyes ]
+ then
+ mount -t nullfs /bin "$mp" 2> /dev/null
+ if [ `ls "$mp" 2> /dev/null | wc -l` -gt 0 ]
+ then
+ echo yes
+ else
+ echo no
+ fi > ${TMPDIR}/fs_privilege/nullfs_target_recognition
+ umount -f "$mp" 2> /dev/null || :
+ nullfs_target_recognition=`cat "${TMPDIR}"/fs_privilege/nullfs_target_recognition`
+ if [ "x$nullfs_target_recognition" = xyes ]
+ then
+ message_echo "INFO: The current environment has the full required privilege of mounting/unmounting file systems."
+ else
+ message_echo "INFO: The current environment formally has the full required privilege of mounting/unmounting file systems but the recognition of nullfs/unionfs targets is incorrect."
+ fi
+ else
+ echo no > ${TMPDIR}/fs_privilege/nullfs_target_recognition
+ message_echo "INFO: The current environment does not have the privilege of mounting/unmounting for the following file system(s)."
+ while read fs tg
+ do
+ mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege:$fs`
+ [ "x$mount_privilege" = xyes ] || echo ' '$fs
+ done < ${TMPDIR}/fs_privilege/fslist | message_cat
+ fi
+ basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
+ if [ -n "$basedir" ]
+ then
+ message_echo "INFO: The current environment will be a chroot/jail guest whose base directory is \"$basedir\"."
+ fi
+ if [ "x$opt_invalidate_mount_privilege" = xyes ]
+ then
+ message_echo "INFO: The privilege of mounting/unmounting in this environment is forcibly invalidated."
+ fi
+}
+
+# ============= Check whether mounting file systems are available at the current environment =============
+fs_chk_mount_privilege ()
+{
+ local mount_privilege
+ fs_inspect_fs_privilege
+ [ "x$opt_invalidate_mount_privilege" = xno ] || return
+ mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
+ nullfs_target_recognition=`cat "${TMPDIR}"/fs_privilege/nullfs_target_recognition`
+ [ "x$nullfs_target_recognition" = xyes -a "x$mount_privilege" = xyes ]
+}
+
+# ============= Check whether mounting file systems are available at the current environment =============
+fs_chk_unmount_privilege ()
+{
+ local mount_privilege
+ fs_inspect_fs_privilege
+ [ "x$opt_invalidate_mount_privilege" = xno ] || return
+ mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
+ [ "x$mount_privilege" = xyes ]
+}
+
+# ============= Get the base directory the current environment (applicable in case of a chroot guest) =============
+fs_get_system_basedir ()
+{
+ fs_inspect_fs_privilege
+ cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :
+}
+
+# ============= Get the regular expression pattern of the actual mount point =============
+fs_get_actual_mount_point_pattern ()
+{
+ local mountpoint basedir mountpoint_real
+ mountpoint=$1
+ [ -e "$mountpoint" ] || return
+ fs_inspect_fs_privilege
+ basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
+ mountpoint_real=`realpath "$mountpoint"`
+ mountpoint_real_full=`echo "$basedir$mountpoint_real" | sed 's|//*|/|'`
+ str_escape_regexp "$mountpoint_real_full"
+}
+
+# ============= Get mount info at the descendant directory levels required for builder chroot environment =============
+fs_get_descendant_mount_info ()
+{
+ local mountpoint mountpoint_real_regexp basedir
+ mountpoint=$1
+ mountpoint_real_regexp=`fs_get_actual_mount_point_pattern "$mountpoint"` || return
+ basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
+ basedir_ptn=`str_escape_regexp "$basedir"`
+ df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp\/" | while read fs data
+ do
+ echo "$fs" | grep -q -e '^/' -e '^<above>:' && fs=normal
+ mp_abs=`echo "$data" | sed -E 's|.*%[[:space:]]+(/.+)$|\1|'`
+ mp=`echo "$mp_abs" | sed -E "s|^$basedir_ptn||"`
+ relative=`echo "$mp_abs" | sed -E "s|^$mountpoint_real_regexp||"`
+ printf '%s\t%s\t%s\n' "$fs" "$mp" "$relative"
+ done
+}
+
+# ============= Repair the unionfs image if applicable and hidden =============
+# Use the side effect of find(1).
+fs_fix_unionfs_image_if_hidden ()
+{
+ local needlepath needlepath_next
+ needlepath=`realpath "$1"`
+ while :
+ do
+ find -dx "$needlepath" -maxdepth 0 echo "$needlepath"
+ needlepath_next=`dirname "$needlepath"`
+ [ "x$needlepath" = "x$needlepath_next" ] && break
+ needlepath=$needlepath_next
+ done
+}
+
+# ============= Check whether a directory is mounted properly =============
+fs_chk_mounted ()
+{
+ local type target mountpoint target_ptn mountpoint_real_regexp tmpsrc
+ type=$1
+ target=$2
+ mountpoint=$3ileedit
+ target_ptn=`echo "$target" | sed 's|//*|/|g' | str_escape_regexp_filter`
+ mountpoint_real_regexp=`fs_get_actual_mount_point_pattern "$mountpoint"` || return
+ basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
+ basedir_target_ptn=`echo "$basedir/$target" | sed 's|//*|/|g' | str_escape_regexp_filter`
+ tmpsrc=${TMPDIR}/fs_chk_mounted:src
+ df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp$" > $tmpsrc
+ case $type in
+ nullfs )
+ grep -qE "^${target_ptn}[[:space:]]" "$tmpsrc" || grep -qE "^${basedir_target_ptn}[[:space:]]" "$tmpsrc"
+ ;;
+ unionfs )
+ grep -qE "^<above>:${target_ptn}[[:space:]]" "$tmpsrc" || grep -qE "^<above>:${basedir_target_ptn}[[:space:]]" "$tmpsrc"
+ ;;
+ devfs | fdescfs | procfs | linprocfs | tmpfs )
+ grep -q "^$type" "$tmpsrc"
+ ;;
+ *)
+ message_echo "ERROR: Unsupported fyle system [$type]" >&2
+ exit 1
+ ;;
+ esac
+}
+
MYVERSION=4.0.0
COMPATIBLE_VERSIONS='^(4\.[0]\.[0])$'
# Template for development versions
- MYVERSION=4.0.0+toward_4.0.1_20180709164228
+ MYVERSION=4.0.0+toward_4.0.1_20180710114409
COMPATIBLE_VERSIONS='^(4\.[0]\.[0]|4\.[0]\.[0]+(|\+toward_4\.[0]\.[1]+_[0-9]+))$'
}
misc_get_console_size | sed -E 's/^([^ ]+) +[^ ]+/\1/'
}
-# ============= Get the global path of a possibly not yet created file/directory =============
-misc_global_path ()
-{
- local $path_src
- path_src=$1
- if [ -e "$path_src" ]
- then
- realpath "$path_src"
- else
- expr "$path_src" : '^/' > /dev/null || echo -n `realpath .`
- echo "$path_src"
- fi
-}
-
-# ============= Inspect the privilege of the current environment on file system operation =============
-misc_inspect_fs_privilege ()
-{
- local tgv mp mp_regexp mount_privilege basedir
- [ -d "${TMPDIR}"/fs_privilege ] && return
- tgv=${TMPDIR}/fs_privilege/test_tg
- mkdir -p "$tgv" "${TMPDIR}"/fs_privilege/test_mp
- mp=`realpath "${TMPDIR}"/fs_privilege/test_mp`
- mp_regexp=`str_escape_regexp "$mp"`
- echo yes > ${TMPDIR}/fs_privilege/fs_privilege
- cat > ${TMPDIR}/fs_privilege/fslist << eof
-devfs devfs
-fdescfs null
-procfs proc
-tmpfs tmpfs
-nullfs "$tgv"
-unionfs "$tgv"
-eof
- while read fs tg
- do
- if mount -t $fs "$tgv" "$mp" 2> /dev/null && umount "$mp"
- then
- echo yes
- else
- echo no
- echo no > ${TMPDIR}/fs_privilege/fs_privilege
- fi > ${TMPDIR}/fs_privilege/fs_privilege:$fs 2> /dev/null
- umount -f "$mp" 2> /dev/null || :
- [ -e "${TMPDIR}"/fs_privilege/basedir ] && continue
- mount -t $fs "$tgv" "$mp" 2> /dev/null && \
- df "$mp" > ${TMPDIR}/fs_privilege/df:$fs && \
- umount "$mp"
- real_mp=`sed 1d "${TMPDIR}"/fs_privilege/df:$fs | tail -n 1 | \
- sed -E 's/^.*[[:space:]][0-9]+%[[:space:]]+//'`
- echo "$real_mp" | sed -E "s/$mp_regexp$//" > ${TMPDIR}/fs_privilege/basedir
- done < ${TMPDIR}/fs_privilege/fslist
- mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
- if [ "x$mount_privilege" = xyes ]
- then
- mount -t nullfs /bin "$mp" 2> /dev/null
- if [ `ls "$mp" 2> /dev/null | wc -l` -gt 0 ]
- then
- echo yes
- else
- echo no
- fi > ${TMPDIR}/fs_privilege/nullfs_target_recognition
- umount -f "$mp" 2> /dev/null || :
- nullfs_target_recognition=`cat "${TMPDIR}"/fs_privilege/nullfs_target_recognition`
- if [ "x$nullfs_target_recognition" = xyes ]
- then
- message_echo "INFO: The current environment has the full required privilege of mounting/unmounting file systems."
- else
- message_echo "INFO: The current environment formally has the full required privilege of mounting/unmounting file systems but the recognition of nullfs/unionfs targets is incorrect."
- fi
- else
- echo no > ${TMPDIR}/fs_privilege/nullfs_target_recognition
- message_echo "INFO: The current environment does not have the privilege of mounting/unmounting for the following file system(s)."
- while read fs tg
- do
- mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege:$fs`
- [ "x$mount_privilege" = xyes ] || echo ' '$fs
- done < ${TMPDIR}/fs_privilege/fslist | message_cat
- fi
- basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
- if [ -n "$basedir" ]
- then
- message_echo "INFO: The current environment will be a chroot/jail guest whose base directory is \"$basedir\"."
- fi
- if [ "x$opt_invalidate_mount_privilege" = xyes ]
- then
- message_echo "INFO: The privilege of mounting/unmounting in this environment is forcibly invalidated."
- fi
-}
-
-# ============= Check whether mounting file systems are available at the current environment =============
-misc_chk_mount_privilege ()
-{
- local mount_privilege
- misc_inspect_fs_privilege
- [ "x$opt_invalidate_mount_privilege" = xno ] || return
- mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
- nullfs_target_recognition=`cat "${TMPDIR}"/fs_privilege/nullfs_target_recognition`
- [ "x$nullfs_target_recognition" = xyes -a "x$mount_privilege" = xyes ]
-}
-
-# ============= Check whether mounting file systems are available at the current environment =============
-misc_chk_unmount_privilege ()
-{
- local mount_privilege
- misc_inspect_fs_privilege
- [ "x$opt_invalidate_mount_privilege" = xno ] || return
- mount_privilege=`cat "${TMPDIR}"/fs_privilege/fs_privilege`
- [ "x$mount_privilege" = xyes ]
-}
-
-# ============= Get the base directory the current environment (applicable in case of a chroot guest) =============
-misc_get_system_basedir ()
-{
- misc_inspect_fs_privilege
- cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :
-}
-
# ============= Check whether the current environment is in a jail =============
misc_chk_in_jail ()
{
[ x"$status" != x0 ]
}
-# ============= Get the regular expression pattern of the actual mount point =============
-misc_get_actual_mount_point_pattern ()
-{
- local mountpoint basedir mountpoint_real
- mountpoint=$1
- [ -e "$mountpoint" ] || return
- misc_inspect_fs_privilege
- basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
- mountpoint_real=`realpath "$mountpoint"`
- mountpoint_real_full=`echo "$basedir$mountpoint_real" | sed 's|//*|/|'`
- str_escape_regexp "$mountpoint_real_full"
-}
-
-# ============= Get mount info at the descendant directory levels required for builder chroot environment =============
-misc_get_descendant_mount_info ()
-{
- local mountpoint mountpoint_real_regexp basedir
- mountpoint=$1
- mountpoint_real_regexp=`misc_get_actual_mount_point_pattern "$mountpoint"` || return
- basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
- basedir_ptn=`str_escape_regexp "$basedir"`
- df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp\/" | while read fs data
- do
- echo "$fs" | grep -q -e '^/' -e '^<above>:' && fs=normal
- mp_abs=`echo "$data" | sed -E 's|.*%[[:space:]]+(/.+)$|\1|'`
- mp=`echo "$mp_abs" | sed -E "s|^$basedir_ptn||"`
- relative=`echo "$mp_abs" | sed -E "s|^$mountpoint_real_regexp||"`
- printf '%s\t%s\t%s\n' "$fs" "$mp" "$relative"
- done
-}
-
-# ============= Check whether a directory is mounted properly =============
-misc_chk_mounted ()
-{
- local type target mountpoint target_ptn mountpoint_real_regexp tmpsrc
- type=$1
- target=$2
- mountpoint=$3
- target_ptn=`echo "$target" | sed 's|//*|/|g' | str_escape_regexp_filter`
- mountpoint_real_regexp=`misc_get_actual_mount_point_pattern "$mountpoint"` || return
- basedir=`cat "${TMPDIR}"/fs_privilege/basedir 2> /dev/null || :`
- basedir_target_ptn=`echo "$basedir/$target" | sed 's|//*|/|g' | str_escape_regexp_filter`
- tmpsrc=${TMPDIR}/misc_chk_mounted:src
- df | sed 1d | grep -E "%[[:space:]]+$mountpoint_real_regexp$" > $tmpsrc
- case $type in
- nullfs )
- grep -qE "^${target_ptn}[[:space:]]" "$tmpsrc" || grep -qE "^${basedir_target_ptn}[[:space:]]" "$tmpsrc"
- ;;
- unionfs )
- grep -qE "^<above>:${target_ptn}[[:space:]]" "$tmpsrc" || grep -qE "^<above>:${basedir_target_ptn}[[:space:]]" "$tmpsrc"
- ;;
- devfs | fdescfs | procfs | linprocfs | tmpfs )
- grep -q "^$type" "$tmpsrc"
- ;;
- *)
- message_echo "ERROR: Unsupported fyle system [$type]" >&2
- exit 1
- ;;
- esac
-}
-
# ============= Selection of removing leaf ports =============
# Box options for dialog(1) are given via stdin.
misc_dialog_checklist ()
tmp_work=${TMPDIR}/pkgsys_sysvar:work
rm -rf "$tmp_work"
mkdir "$tmp_work"
+ fs_fix_unionfs_image_if_hidden "${PORTSDIR}/Mk/bsd.port.mk"
make -C "$tmp_work" -f "${PORTSDIR}/Mk/bsd.port.mk" -V "$var" 2> /dev/null
}
unset WITHOUT_PKGNG
message_echo "INFO: Attempting deinstallation of pkg(8) to make sure."
portsmgmt_port_path=`pkgsys_get_portpath_from_origin "$origin_portsmgmt"`
+ fs_fix_unionfs_image_if_hidden "${TMPDIR}/make.conf"
env __MAKE_CONF="${TMPDIR}/make.conf" make -C "$portsmgmt_port_path" deinstall || :
message_echo "INFO: Attempting (re)installation by pkg(8)."
env __MAKE_CONF="${TMPDIR}/make.conf" make -C "$portsmgmt_port_path" reinstall clean
grep -E "$glob_regexp_unflavored" "$unflavored_origlist" 2>&1 | while read origin_unflavored
do
+ fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored"
make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \
tr '[:space:]' '\n' | grep -v '^$' | grep -E "$glob_regexp_flavor" | sed -E "s|^|$origin_unflavored@|"
done
grep -E "$glob_regexp" "$unflavored_origlist" 2>&1 | while read origin_unflavored
do
origin_unflavored_rpl=`str_escape_replaceval "$origin_unflavored"`
+ fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored"
make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \
tr '[:space:]' '\n' | grep -v '^$' > $tmp_flavors || :
if [ `wc -l < $tmp_flavors` -gt 0 ]
done | while read origin_unflavored
do
origin_unflavored_rpl=`str_escape_replaceval "$origin_unflavored"`
+ fs_fix_unionfs_image_if_hidden "${PORTSDIR}/$origin_unflavored"
make -C "${PORTSDIR}/$origin_unflavored" -V FLAVORS 2> /dev/null | \
tr '[:space:]' '\n' | grep -v '^$' > $tmp_flavors || :
[ `wc -l < $tmp_flavors` -gt 0 ] || echo > $tmp_flavors
MAKE_ARGS=`reinstall_setup_make_args $mode`
MAKE_ENVS=`reinstall_setup_make_envs`
port_path=`pkgsys_get_portpath_from_origin "$REINSTALL_ORIGIN"`
+ fs_fix_unionfs_image_if_hidden "$port_path"
env $MAKE_ENVS make -C "$port_path" "$@" $MAKE_ARGS
}
# ============= Regularize the option value =============
options_regularize ()
{
- opt_packages_dir=`misc_global_path "$opt_packages_dir"`
+ opt_packages_dir=`fs_global_path "$opt_packages_dir"`
}
.PP
[IMPROVED] It is changed to detect unflavored ports or ports with old flavor names of flavored ports as obsolete.
.PP
+[IMPROVED] The behavior with union file systems is stabilized.
+.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.
. ${LIBDIR}/libdatabase_record.sh
. ${LIBDIR}/libdeinstall.sh
. ${LIBDIR}/libfileedit.sh
+. ${LIBDIR}/libfs.sh
. ${LIBDIR}/libmain.sh
. ${LIBDIR}/libmessage.sh
. ${LIBDIR}/libmisc.sh
. ${LIBDIR}/libdatabase_record.sh
. ${LIBDIR}/libdeinstall.sh
. ${LIBDIR}/libfileedit.sh
+. ${LIBDIR}/libfs.sh
. ${LIBDIR}/libmain.sh
. ${LIBDIR}/libmessage.sh
. ${LIBDIR}/libmisc.sh