Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177275579
D58953.1794052051.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D58953.1794052051.diff
View Options
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -471,6 +471,11 @@
echo "$list"
}
+# Remove the existing NANO_METALOG file to generate new metalog
+nano_pkgbase_reset_metalog() {
+ rm -f "$NANO_METALOG"
+}
+
#
# Update the sha256 checksum of a file in the target pkg database
# to match the current file on disk
@@ -509,7 +514,16 @@
# Run pkg(8) with NANO_WORLDDIR as rootdir
tgt_pkg() {
- pkg_cmd --rootdir "$NANO_WORLDDIR" "$@"
+ local install_as_user metalog
+
+ if ! $do_root; then
+ install_as_user="-o INSTALL_AS_USER=yes"
+ fi
+ if [ -n "$NANO_METALOG" ]; then
+ metalog="-o METALOG=${NANO_METALOG}"
+ fi
+
+ pkg_cmd --rootdir "$NANO_WORLDDIR" ${install_as_user} ${metalog} "$@"
}
# Run pkg(8) in chroot mode against NANO_WORLDDIR
@@ -692,6 +706,18 @@
done
)
+#
+# Update the path the files table of the target pkg database from
+# /usr/local/etc to /etc/local. All paths are relative to NANO_WORLDDIR
+#
+tgt_pkg_update_file_path_etc_local() {
+ tgt_pkg shell <<-EOF
+ UPDATE files
+ SET path = '/etc/local' || SUBSTR(path, 15)
+ WHERE path LIKE '/usr/local/etc%';
+ EOF
+}
+
#
# Convert a directory into a symlink. Takes three arguments, the current
# directory, what it should become a symlink to, and optionally, the mode.
@@ -704,15 +730,48 @@
local mode=${3:-0777}
cd "${NANO_WORLDDIR}"
+
rm -xrf "$dir"
+ if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
+ tgt_pkg shell <<-EOF
+ DELETE FROM directories WHERE path = '$dir';
+ EOF
+ fi
+
ln -sf "$symlink" "$dir"
if [ -n "$NANO_METALOG" ]; then
printf "./%s type=link uname=%s gname=%s mode=%s link=%s\n" \
"$dir" "$NANO_DEF_UNAME" "$NANO_DEF_GNAME" "$mode" \
"$symlink" >> "$NANO_METALOG"
fi
+ if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
+ tgt_pkg shell <<-EOF
+ INSERT INTO files (path, uname, gname, perm, fflags, symlink_target)
+ VALUES ('$dir', '$NANO_DEF_UNAME', '$NANO_DEF_GNAME', '$mode', 0, '$symlink');
+ EOF
+ fi
)
+#
+# Generate metalog entries for each intermediate directory in a path.
+# Assume default ownership and directory permissions
+#
+mtree_walk() {
+ local dir oifs path
+
+ dir="$1"
+ path=""
+
+ oifs="$IFS"
+ IFS="/"
+ for d in $dir; do
+ path="${path}/${d}"
+ printf ".%s type=dir uname=%s gname=%s mode=0755\n" \
+ "$path" "$NANO_DEF_UNAME" "$NANO_DEF_GNAME" >> "$NANO_METALOG"
+ done
+ IFS="$oifs"
+}
+
#
# Create directories in the target tree, and record the fact.
# All paths are relative to NANO_WORLDDIR
@@ -722,12 +781,7 @@
mkdir -p "${NANO_WORLDDIR}/${i}"
if [ -n "$NANO_METALOG" ]; then
- path=""
- for dir in $(echo "$i" | tr "/" " "); do
- path="${path}/${dir}"
- echo ".${path} type=dir uname=${NANO_DEF_UNAME}" \
- "gname=${NANO_DEF_GNAME} mode=0755" >> "${NANO_METALOG}"
- done
+ mtree_walk "$i"
fi
done
}
@@ -904,7 +958,7 @@
if [ -n "$(nano_pkgbase_world_list)" ]; then
tgt_pkg install -U -y $(nano_pkgbase_world_list)
fi
- tgt_pkg_chroot triggers
+ _xxx_tgt_pkg_triggers
else
for distset in $NANO_DISTRIBUTIONS; do
if [ "$distset" = "kernel.txz" ] || \
@@ -1075,6 +1129,11 @@
# The dedup tool's output must be sorted due to limitations in awk.
if [ -n "${NANO_METALOG}" ]; then
pprint 2 "Fixing metalog"
+
+ if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
+ _xxx_pkg_metalog
+ fi
+
cp ${NANO_METALOG} ${NANO_METALOG}.pre
echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" > ${NANO_METALOG}
cat ${NANO_METALOG}.pre | ${NANO_TOOLS}/mtree-dedup.awk | \
@@ -1108,6 +1167,9 @@
sed -i "" "\=^\./usr/local/etc =d" "$NANO_METALOG"
sed -i "" -e "s=^\./usr/local/etc/=./etc/local/=g" "$NANO_METALOG"
fi
+ if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
+ tgt_pkg_update_file_path_etc_local
+ fi
fi
# Always setup the usr/local/etc -> etc/local symlink.
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh
--- a/tools/tools/nanobsd/nanobsd.sh
+++ b/tools/tools/nanobsd/nanobsd.sh
@@ -206,6 +206,9 @@
if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
nano_configure_pkgbase_pkg
+ if ! $do_root; then
+ nano_pkgbase_reset_metalog
+ fi
else
nano_fetch_distsets
if ! $do_root; then
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 7, 11:47 AM (4 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41532252
Default Alt Text
D58953.1794052051.diff (4 KB)
Attached To
Mode
D58953: nanobsd: Support -PU builds with COMPONENTS
Attached
Detach File
Event Timeline