aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2006-08-28 20:48:00 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2006-08-28 20:48:00 +0000
commitae65411a8fcc50d59e6bebb4651cce940404217c (patch)
tree0ff4bef0df9ead97400b881274b7cb26f726aa1e
parent9c411e3706f7ff514ba27f902b902753695a4298 (diff)
downloadpaludis-ae65411a8fcc50d59e6bebb4651cce940404217c.tar.gz
paludis-ae65411a8fcc50d59e6bebb4651cce940404217c.tar.xz
Add a new hook to generate vdb_dir/.cache/all_CONFIG_PROTECT{,_MASK} files,
which contain a list of all CONFIG_PROTECT and CONFIG_PROTECT_MASK directories from all packages. This is for use by things like etc-update.
-rw-r--r--hooks/Makefile.am.m44
-rwxr-xr-xhooks/update_config_protect_list.bash44
2 files changed, 48 insertions, 0 deletions
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index 01baaf8..7ac1bee 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -11,6 +11,7 @@ installvarlibpaludisnewsdir = $(localstatedir)/paludis/news
installhookcommonprogdir = $(libexecdir)/paludis/hooks/common
installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post
+installhookinstallpostdir = $(libexecdir)/paludis/hooks/install_post
installhookcommonprog_SCRIPTS = \
gnu_info_index.bash \
@@ -21,6 +22,9 @@ installhookcommonprog_SCRIPTS = \
installhookinstallallpost_SCRIPTS = \
find_config_updates.bash
+installhookinstallpost_SCRIPTS = \
+ update_config_protect_list.bash
+
installvarlibpaludisnews_DATA = \
.keep
diff --git a/hooks/update_config_protect_list.bash b/hooks/update_config_protect_list.bash
new file mode 100755
index 0000000..f1fff98
--- /dev/null
+++ b/hooks/update_config_protect_list.bash
@@ -0,0 +1,44 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+vdb_loc=$(${PALUDIS_COMMAND} --configuration-variable installed location )
+cfg_protect_list="${vdb_loc}/.cache/all_CONFIG_PROTECT"
+cfg_protect_mask_list="${vdb_loc}/.cache/all_CONFIG_PROTECT_MASK"
+
+if [[ ! -f "${cfg_protect_list}" || ! -f "${cfg_protect_mask_list}" ]] ; then
+ # Generate this list for the first time. *slow*
+ echo "Creating the CONFIG_PROTECT and CONFIG_PROTECT_MASK lists."
+ echo "This will take a while."
+ > "${cfg_protect_list}"
+ > "${cfg_protect_mask_list}"
+
+ installed_pkgs=$(${PALUDIS_COMMAND} --list-packages --repository installed |grep ^* |cut -d" " -f2)
+
+ for p in ${installed_pkgs} ; do
+ cfg_protect=$(${PALUDIS_COMMAND} --environment-variable ${p} CONFIG_PROTECT)
+ for x in ${cfg_protect} ; do
+ echo "${x}" >> "${cfg_protect_list}"
+ done
+
+ cfg_protect_mask=$(${PALUDIS_COMMAND} --environment-variable ${p} CONFIG_PROTECT_MASK)
+ for x in ${cfg_protect_mask} ; do
+ echo "${x}" >> "${cfg_protect_mask_list}"
+ done
+ done
+fi
+
+# Now, update the lists with our current values.
+for x in ${CONFIG_PROTECT} ; do
+ echo "${x}" >> "${cfg_protect_list}"
+done
+
+for x in ${CONFIG_PROTECT_MASK} ; do
+ echo "${x}" >> "${cfg_protect_mask_list}"
+done
+
+# Finally, ensure we have no duplicates in these lists.
+sort -u "${cfg_protect_list}" > "${cfg_protect_list}.$$"
+mv "${cfg_protect_list}.$$" "${cfg_protect_list}"
+
+sort -u "${cfg_protect_mask_list}" > "${cfg_protect_mask_list}.$$"
+mv "${cfg_protect_mask_list}.$$" "${cfg_protect_mask_list}"