diff options
author | 2008-03-22 18:35:13 +0000 | |
---|---|---|
committer | 2008-03-22 18:35:13 +0000 | |
commit | af0ac792aa22dc4f3f5d7d28c32a1687811102f2 (patch) | |
tree | f5c3c03eb39b2a5611ffdb446f7ddf7f10c1e66b /hooks | |
parent | fb41fd31c2dffa30926ba49698e84d266479e4dc (diff) | |
download | paludis-af0ac792aa22dc4f3f5d7d28c32a1687811102f2.tar.gz paludis-af0ac792aa22dc4f3f5d7d28c32a1687811102f2.tar.xz |
Convert pretend_resume to auto/ hook.
Diffstat (limited to 'hooks')
-rw-r--r-- | hooks/demos/Makefile.am | 8 | ||||
-rwxr-xr-x | hooks/demos/pretend_resume.bash.in | 38 | ||||
-rwxr-xr-x | hooks/demos/pretend_resume.hook.in | 45 |
3 files changed, 49 insertions, 42 deletions
diff --git a/hooks/demos/Makefile.am b/hooks/demos/Makefile.am index 23973919a..4a39b1962 100644 --- a/hooks/demos/Makefile.am +++ b/hooks/demos/Makefile.am @@ -4,13 +4,13 @@ DEMOS = \ report.bash \ elog.bash \ new_packages.bash \ - pretend_resume.bash + pretend_resume.hook EXTRA_DIST = \ report.bash.in \ elog.bash.in \ new_packages.bash.in \ - pretend_resume.bash.in + pretend_resume.hook.in MAINTAINERCLEANFILES = Makefile.in CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.o *.so $(DEMOS) @@ -27,8 +27,8 @@ report.bash : $(srcdir)/report.bash.in elog.bash : $(srcdir)/elog.bash.in sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/elog.bash.in > elog.bash -pretend_resume.bash : $(srcdir)/pretend_resume.bash.in - sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/pretend_resume.bash.in > pretend_resume.bash +pretend_resume.hook : $(srcdir)/pretend_resume.hook.in + sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/pretend_resume.hook.in > pretend_resume.hook built-sources : $(BUILT_SOURCES) for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done diff --git a/hooks/demos/pretend_resume.bash.in b/hooks/demos/pretend_resume.bash.in deleted file mode 100755 index 7c99adf2e..000000000 --- a/hooks/demos/pretend_resume.bash.in +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# vim: set et sw=4 sts=4 : - -# This hook makes Paludis display the resume command at the end of the -# --install --pretend output, so the installation can be carried out -# without recalculating dependencies, rescanning libraries, etc. To -# enable this functionality, this script should be copied or symlinked -# into: -# -# @DATADIR@/paludis/hooks/install_pretend_post/ -# -# You should ensure that it has execute permissions. - -[[ -n ${RESUME_COMMAND} ]] || exit 0 -${DEPLIST_HAS_ERRORS} && exit 0 -echo - -template_var=$(tr '[[:lower:]]' '[[:upper:]]' <<<"${PALUDIS_CLIENT}")_CMDLINE_resume_command_template -template=${!template_var} - -if [[ -n ${template} ]]; then - if [[ ${template} = *XXXXXX* ]]; then - file="$(mktemp "${template}")" - else - file=${template} - fi - - if touch "${file}" && chmod 644 "${file}" && echo "${RESUME_COMMAND}" >"${file}"; then - echo "Resume command saved to file: ${file}" - else - echo "Resume command NOT saved to file: ${file}" - echo "Resume command: ${RESUME_COMMAND}" - fi - -else - echo "Resume command: ${RESUME_COMMAND}" -fi - diff --git a/hooks/demos/pretend_resume.hook.in b/hooks/demos/pretend_resume.hook.in new file mode 100755 index 000000000..b96646961 --- /dev/null +++ b/hooks/demos/pretend_resume.hook.in @@ -0,0 +1,45 @@ +#!/bin/bash +# vim: set et sw=4 sts=4 : + +# This hook makes Paludis display the resume command at the end of the +# --install --pretend output, so the installation can be carried out +# without recalculating dependencies, rescanning libraries, etc. To +# enable this functionality, this script should be copied or symlinked +# into: +# +# @DATADIR@/paludis/hooks/auto/ +# +# You should ensure that it has execute permissions. + +hook_run_install_pretend_post() { + [[ -n ${RESUME_COMMAND} ]] || exit 0 + ${DEPLIST_HAS_ERRORS} && exit 0 + echo + + local template_var=$(tr '[[:lower:]]' '[[:upper:]]' <<<"${PALUDIS_CLIENT}")_CMDLINE_resume_command_template + local template=${!template_var} + local file + + if [[ -n ${template} ]]; then + if [[ ${template} = *XXXXXX* ]]; then + file="$(mktemp "${template}")" + else + file=${template} + fi + + if touch "${file}" && chmod 644 "${file}" && echo "${RESUME_COMMAND}" >"${file}"; then + echo "Resume command saved to file: ${file}" + else + echo "Resume command NOT saved to file: ${file}" + echo "Resume command: ${RESUME_COMMAND}" + fi + + else + echo "Resume command: ${RESUME_COMMAND}" + fi +} + +hook_auto_names() { + echo install_pretend_post +} + |