Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167885059
D58960.id184325.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58960.id184325.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
@@ -527,6 +527,56 @@
# 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
+}
+
+#
+# Swap the /tmp ID with the /var/tmp ID in the pkg_directories table.
+# Remove the /tmp directory from the directories table.
+#
+tgt_pkg_link_tmp_var_tmp() {
+ local tmp_id var_tmp_id
+
+ tmp_id=$(tgt_pkg shell "SELECT id FROM directories WHERE path = '/tmp';")
+ var_tmp_id=$(tgt_pkg shell "SELECT id FROM directories WHERE path = '/var/tmp';")
+
+ if [ -z "$tmp_id" ] || [ -z "$var_tmp_id" ]; then
+ return
+ fi
+
+ tgt_pkg shell <<-EOF
+ BEGIN TRANSACTION;
+
+ -- Change any package relation from the /tmp ID to the /var/tmp ID
+ UPDATE OR IGNORE pkg_directories
+ SET directory_id = ${var_tmp_id} WHERE directory_id = ${tmp_id};
+
+ -- Remove residual /tmp remnants left behind by "OR IGNORE"
+ DELETE FROM pkg_directories WHERE directory_id = ${tmp_id};
+
+ -- Remove /tmp from the directories table
+ DELETE FROM directories WHERE id = ${tmp_id};
+
+ COMMIT;
+ EOF
+}
+
+# Timestamp all files with NANO_TIMESTAMP in the pkg database
+tgt_pkg_time_timestamp() {
+ if [ -z "$NANO_TIMESTAMP" ]; then
+ return
+ fi
+
+ tgt_pkg shell "UPDATE files SET mtime = ${NANO_TIMESTAMP};"
+ tgt_pkg shell "UPDATE packages SET time = ${NANO_TIMESTAMP};"
+}
+
+# Run pkg(8) with the configured ABI, repo, and cache settings
pkg_cmd() {
pkg --repo-conf-dir "$(nano_pkg_repos_dir)" \
-o ABI="$NANO_ABI" \
@@ -1177,6 +1227,7 @@
fi
if $do_precompiled && [ -z "$NANO_NOPKGBASE" ]; then
+ tgt_pkg_time_timestamp
fi
}
@@ -1261,6 +1312,7 @@
fi
tgt_dir2symlink tmp var/tmp 1777
if [ -z "$NANO_NOPKGBASE" ]; then
+ tgt_pkg_link_tmp_var_tmp
fi
) > ${NANO_LOG}/_.dl 2>&1
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 6:12 AM (6 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36989279
Default Alt Text
D58960.id184325.diff (2 KB)
Attached To
Mode
D58960: nanobsd: Fix target pkg database /tmp symlink and timestamps
Attached
Detach File
Event Timeline
Log In to Comment