SPELL_INDEX_FILE=${SPELL_INDEX_FILE:-codex.index}
diff --git a/etc/sorcery/hooks/mail.hook b/etc/sorcery/hooks/mail.hook
new file mode 100755
index 0000000..3cadd63
--- /dev/null
+++ b/etc/sorcery/hooks/mail.hook
@@ -0,0 +1,53 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+## @Synopsis Hooks for sending mail
+## @Copyright Copyright (C) 2010 The Source Mage Team
<http://www.sourcemage.org>
+## Functions implementing mail hooks for the end of cast reporting
+#---------------------------------------------------------------------
+
+[[ -x /usr/bin/mail && $MAIL_REPORTS == on ]] || return 0
+
+function mail_cast_final_hook() {
+ {
+ echo "---Success---"
+ cat $SUCCESS_LIST | column
+ echo "---Failure---"
+ cat $FAILED_LIST | column
+ echo "---Dropped---"
+ echo $NOT_CAST | column
+ echo "---Conflicts---"
+ cut -d" " -f2- $CONFLICT_LIST 2>/dev/null | column
+ echo "---check_self succeed---"
+ cat $CHECK_TRIGGERS_SUCCESS | column
+ echo "---check_self fail---"
+ cat $CHECK_TRIGGERS_FAILURE | column
+ } | mail -s "Final report" $SORCERER
+}
+
+function mail_post_FAILURE_hook() {
+ date -u | mail -s "Compile log" -a $C_LOG $SORCERER 2>/dev/null
+}
+
+function mail_post_SUCCESS_hook() {
+ date -u | mail -s "Compile log" -a $C_LOG $SORCERER 2>/dev/null
+ date -u | mail -s "Install log" -a $INST_LOG $SORCERER 2>/dev/null
+}
+
+#---------------------------------------------------------------------
+## @License
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
diff --git a/etc/sorcery/hooks/sound.hook b/etc/sorcery/hooks/sound.hook
new file mode 100755
index 0000000..cb30236
--- /dev/null
+++ b/etc/sorcery/hooks/sound.hook
@@ -0,0 +1,62 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+## @Synopsis Hooks for playing sounds
+## @Copyright Copyright (C) 2010 The Source Mage Team
<http://www.sourcemage.org>
+## Functions implementing sound hooks for the end of cast reporting
+#---------------------------------------------------------------------
+
+[[ -x /usr/bin/play ]] || return 0
+
+#---------------------------------------------------------------------
+##
+## @Globals SOUND SOUND_DIRECTORY SOUND_THEME
+## Plays a given soundfile if sounds are on and the file exists in
+## the chosen theme.
+##
+## Needs sox
+#---------------------------------------------------------------------
+function sound() {
+ local sound_file
+ case $SOUND in
+ on) sound_file=$SOUND_DIRECTORY/$SOUND_THEME/$1
+ if [[ -e $sound_file ]]; then
+ ( cd / ; play $sound_file 2>/dev/null & )
+ debug "libmisc" "Playing $sound_file"
+ else
+ debug "libmisc" "Error playing $sound_file: no such file"
+ fi
+ ;;
+ esac
+
+}
+
+function sound_REPORT_hook() {
+ sound REPORT
+}
+
+function sound_post_FAILURE_hook() {
+ sound FAILURE
+}
+
+function sound_post_SUCCESS_hook() {
+ sound SUCCESS
+}
+
+#---------------------------------------------------------------------
+## @License
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
diff --git a/etc/sorcery/hooks/xterm_title.hook
b/etc/sorcery/hooks/xterm_title.hook
new file mode 100755
index 0000000..45ea5bc
--- /dev/null
+++ b/etc/sorcery/hooks/xterm_title.hook
@@ -0,0 +1,115 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+## @Synopsis Hooks for setting the term title
+## @Copyright Copyright (C) 2010 The Source Mage Team
<http://www.sourcemage.org>
+## Functions implementing term title hooks for all the hook points
+
+[[ $SET_TERM_TITLE != "on" ]] && return 0
+
+#---------------------------------------------------------------------
+## @param title
+## @Globals TERM
+##
+## sets the terminal title if TERM=xterm|rxvt or the window title if
+## TERM=screen
+##
+#---------------------------------------------------------------------
+function set_term_title()
+{
+ case $TERM in
+ xterm*|rxvt) echo -ne "\e]0;$@\007" ;;
+ screen) echo -ne "\ek$@\e\\" ;;
+ *) true ;;
+ esac
+}
+
+function xterm_title_cast_initialize_hook() {
+ set_term_title "cast started"
+}
+
+function xterm_title_cast_start_spell_hook() {
+ set_term_title "[$SPELL]: casting"
+}
+
+function xterm_title_cast_final_hook() {
+ if [[ $ANTE_RC == 0 ]]; then
+ set_term_title "cast finished succesfully"
+ else
+ set_term_title "cast finished with failures!"
+ fi
+}
+
+function xterm_title_pre_SUCCESS_hook() {
+ set_term_title "[$SPELL]: success!"
+}
+
+function xterm_title_pre_FAILURE_hook() {
+ set_term_title "[$SPELL]: failure!"
+}
+
+function xterm_title_pre_BUILD_hook() {
+ set_term_title "[$SPELL]: building"
+}
+
+function xterm_title_pre_DOWNLOAD_hook() {
+ # summon and cast are run in parallel, so try to avoid conflicts
+ # let cast have precedence
+ if test -t 1; then
+ set_term_title "[$SPELL]: downloading"
+ fi
+}
+
+function xterm_title_pre_INSTALL_hook() {
+ if [[ $STAGED_INSTALL != on ]]; then
+ set_term_title "[$SPELL]: installing"
+ else
+ set_term_title "[$SPELL]: installing to stage"
+ fi
+}
+
+function xterm_title_pre_INSTALL_EXTRAS_hook() {
+ set_term_title "[$SPELL]: installing extras"
+}
+
+function xterm_title_pre_PRE_BUILD_hook() {
+ set_term_title "[$SPELL]: unpacking"
+}
+
+function xterm_title_pre_dispel_hook() {
+ set_term_title "[$SPELL]: dispelling"
+}
+
+function xterm_title_pre_PRE_RESURRECT_hook() {
+ set_term_title "[$SPELL]: resurrecting"
+}
+
+function xterm_title_pre_TRANSFER_hook() {
+ set_term_title "[$SPELL]: transfering to system"
+}
+
+function xterm_title_pre_TRIGGERS_hook() {
+ set_term_title "[$SPELL]: checking triggers"
+}
+
+function xterm_title_pre_UP_TRIGGERS_hook() {
+ set_term_title "[$SPELL]: checking reverse triggers"
+}
+
+#---------------------------------------------------------------------
+## @License
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
diff --git a/etc/sorcery/version b/etc/sorcery/version
index 51f7593..5dbf14a 100644
--- a/etc/sorcery/version
+++ b/etc/sorcery/version
@@ -1 +1 @@
-20080324
+20111014
diff --git a/install b/install
index a94f3f7..e1dcf2b 100755
--- a/install
+++ b/install
@@ -117,6 +117,11 @@ for FILE in \
fi
done
+# Create the hooks dir since hooks try to check that the files are properly
owned
+mkdir -p "${INSTALL_ROOT}/etc/sorcery/hooks"
+chown 0:0 "${INSTALL_ROOT}/etc/sorcery/hooks"
+chmod 0755 "${INSTALL_ROOT}/etc/sorcery/hooks"
+
#---------------------------------------------------------------------
##=back
diff --git a/usr/sbin/cast b/usr/sbin/cast
index 5f31dc6..c940a80 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -217,6 +217,7 @@ function cast_spell() { (
set_term_title "Casting spell [$SPELL] ($gsp_done of $gsp_total)"
message "${MESSAGE_COLOR}Casting spell
[${SPELL_COLOR}$SPELL${MESSAGE_COLOR}]" \
"($gsp_done of $gsp_total)"
+ run_hook cast_start_spell
@@ -759,6 +760,7 @@ function pass_five() {
rc=1
fi
fi
+ run_hook cast_final "" $rc
# check if confmeld should be run
local spell deferred_list
@@ -1036,6 +1038,7 @@ else
fi
trap int_trap INT
+ init_hooks
main "$@"
rc=$?
if [ $SHLVL -eq $TOP_LEVEL ] ; then
diff --git a/usr/sbin/delve b/usr/sbin/delve
index 591c522..8070d2d 100755
--- a/usr/sbin/delve
+++ b/usr/sbin/delve
@@ -474,6 +474,7 @@ elif [ "$UID" -gt 0 ]; then
else
# Make a nice dir structure to put stuff in, this exits if it fails
mk_tmp_dirs delve
+ init_hooks
main "$@"
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 94a045e..4ef5d66 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -622,6 +622,8 @@ if [ $# == 0 ]; then help | $PAGER
elif [[ $1 == -h ]] || [[ $1 == --help ]] ; then help
elif [ "$UID" == 0 ]; then
mk_tmp_dirs dispel
+ # FIXME: not sure if this is the right place for it
+ init_hooks
main "$@"
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/usr/sbin/resurrect b/usr/sbin/resurrect
index 9b53469..db3a894 100755
--- a/usr/sbin/resurrect
+++ b/usr/sbin/resurrect
@@ -315,6 +315,7 @@ if [[ $UID -gt 0 ]]; then
PARAMS=$(consolidate_params "$@")
run_as_root resurrect "$@"
else
+ init_hooks
main "$@"
fi
diff --git a/usr/sbin/summon b/usr/sbin/summon
index cda9cdf..a010603 100755
--- a/usr/sbin/summon
+++ b/usr/sbin/summon
@@ -240,6 +240,7 @@ if [ "$UID" == 0 ] ; then
renice $NICE -p $$ >/dev/null
fi
mk_tmp_dirs summon
+ init_hooks
main "$@"
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 57edb2b..41cfe3c 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -23,6 +23,7 @@
function run_config_loc () {
debug "build_api/common" "Starting run_config_loc() on $SPELL"
pushd . > /dev/null # may have been somewhere else
+ run_hook config_loc pre
[ -d "$SOURCE_DIRECTORY" ] &&
cd $SOURCE_DIRECTORY # we need to be in here for this function to
work
if [[ $CONFIG_LOC == on ]]; then
@@ -71,6 +72,7 @@ function run_config_loc () {
fi
popd &>/dev/null
+ run_hook config_loc post
}
@@ -206,12 +208,11 @@ function run_spell_success() {
local TMP_MD5_LOG="$TMP_DIR/$SPELL-$VERSION.md5"
local C_LOG_COMP="$COMPILE_LOGS/$SPELL-$VERSION$EXTENSION"
+ run_hook SUCCESS pre
local CACHE
construct_cache_name "$INSTALL_CACHE/$SPELL-$VERSION-$HOST" CACHE
local CACHE_COMP=$CACHE$EXTENSION
report_install
+ run_hook SUCCESS post
rm -f $IW_LOG $C_LOG $TMP_INST_LOG $TMP_MD5_LOG "$STAGE_INST_LOG" \
"$spell_sub_depends" "$spell_rsub_depends" "$spell_depends"
}
@@ -375,7 +377,7 @@ function run_spell_failure() {
debug "build_api/common" "cast of $SPELL-$VERSION failed"
local rc=$1
- sound FAILURE
+ run_hook FAILURE pre
local reason
get_failure_reason reason
@@ -400,6 +402,8 @@ function run_spell_failure() {
IW_LOG="${INSTALLWATCHFILE:-$INSTW_LOGFILE}"
devoke_installwatch
+ run_hook FAILURE post
+
rm -f $IW_LOG $C_LOG
local spell_sub_depends spell_rsub_depends
diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index d380146..29aa542 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -166,6 +166,7 @@ function run_security() {
debug "build_api/common" "Starting run_security() on $SPELL"
local rc=0
if [[ -f $SCRIPT_DIRECTORY/SECURITY ]]; then
+ run_hook SECURITY pre
message "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
tee -a $SECURITY_LOG < $SCRIPT_DIRECTORY/SECURITY
if grep -q critical $SCRIPT_DIRECTORY/SECURITY; then
@@ -174,6 +175,7 @@ function run_security() {
query "SECURITY: Do you still want to cast
${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${QUERY_COLOR}?" "y"
fi
rc=$?
+ run_hook SECURITY post
fi
[[ $rc != 0 ]] && log_failure_reason "security"
return $rc
diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index 06c09b8..b6f5baf 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -319,6 +319,7 @@ function post_remove() {
function dispel_spell() {
local SPELL=$1
+ run_hook dispel pre
# fake dispel, only remove sorcery metadata
if [[ $DEBUG_DISPEL ]] ; then
echo "pretending to dispel $SPELL"
@@ -362,6 +363,7 @@ function dispel_spell() {
"${PROBLEM_COLOR}failed!${DEFAULT_COLOR}"
return $rc
fi
+ run_hook dispel post
return 0
}
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 55a56db..8e4635f 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -103,6 +103,7 @@ function isalpha() {
function real_query() {
debug "libmisc" "Running query() with the following arguments: '$1' and
'$2'"
local _response
+ run_hook real_query
while true; do
_response=""
@@ -142,6 +143,7 @@ function real_query_string () {
local ANSWER_first ANSWER_rest
if [ -z "$SILENT" ]; then
@@ -323,27 +325,151 @@ function clear_line() {
}
-
#---------------------------------------------------------------------
##
-## @Globals SOUND
-## Plays a given soundfile if sounds are on and the file exists in
-## the chosen theme.
+## @Globals USE_HOOKS LIST_OF_HOOKS
+## Used to initialize hooks
+## Limitations: hook functions need to be defined as:
+## something_hookname_hook
+## in files named: something.hook
+##
+## Example:
+## mail.hook
+## function mail_post_SUCCESS_hook(){
+## send_that_mail
+## }
##
#---------------------------------------------------------------------
-function sound() {
+function init_hooks() {
+ debug "libmisc" "init_hooks - starting"
+ # check if we were called already
+ declare -F hook_marker &>/dev/null && return 0
+
+ local hook_file
+ local hookdir_perms="$(ls -lnd $SORCERY_HOOKS 2>/dev/null|awk '{printf
"%s:%s:%s\n" ,$1,$3,$4;}')"
+ local hooks_list=""
+
+ if [[ $hookdir_perms == "drwxr-xr-x:0:0" ]]; then
+ for hook_file in $SORCERY_HOOKS/* ; do
+ # check if the effective owner and group are
+ # the same as the running process - root
+ # check for read and execute perms
+ # still lacks better security checking
+ # ideally this should be:
+ # if it's owned by 0:0 and has no write perms
+ # for group or other then it's assumed safe
+ # Extra precaution is done by permissions on the hooks
+ # directory and checked before the loop
+ if [[ -G $hook_file ]] &&
+ [[ -O $hook_file ]] &&
+ [[ -x $hook_file ]] &&
+ [[ -r $hook_file ]]
+ then
+ . $hook_file
+ hooks_list="$hooks_list $(smgl_basename ${hook_file/.hook})"
+ debug "libmisc" "init_hooks - loaded $hook_file"
+ fi
+ done
+ local function_name function_list
+ function_list="cast_initialize \
+ cast_start_spell \
+ cast_final \
+ real_query \
+ real_query_string \
+ REPORT \
+ pre_dispel \
+ post_dispel \
+ pre_SUCCESS \
+ post_SUCCESS \
+ pre_FAILURE \
+ post_FAILURE \
+ pre_BUILD \
+ post_BUILD \
+ pre_config_loc \
+ post_config_loc \
+ pre_CONFIGURE \
+ post_CONFIGURE \
+ pre_DEPENDS \
+ post_DEPENDS \
+ pre_DOWNLOAD \
+ post_DOWNLOAD \
+ pre_FINAL \
+ post_FINAL \
+ pre_INSTALL \
+ post_INSTALL \
+ pre_INSTALL_EXTRAS \
+ post_INSTALL_EXTRAS \
+ pre_POST_INSTALL \
+ post_POST_INSTALL \
+ pre_POST_REMOVE \
+ post_POST_REMOVE \
+ pre_POST_RESURRECT \
+ post_POST_RESURRECT \
+ pre_PRE_BUILD \
+ post_PRE_BUILD \
+ pre_PRE_INSTALL \
+ post_PRE_INSTALL \
+ pre_PREPARE \
+ post_PREPARE \
+ pre_PRE_REMOVE \
+ post_PRE_REMOVE \
+ pre_PRE_RESURRECT \
+ post_PRE_RESURRECT \
+ pre_SECURITY \
+ post_SECURITY \
+ pre_SUB_DEPENDS \
+ post_SUB_DEPENDS \
+ pre_TRANSFER \
+ post_TRANSFER \
+ pre_TRIGGER_CHECK \
+ post_TRIGGER_CHECK \
+ pre_TRIGGERS \
+ post_TRIGGERS \
+ pre_UP_TRIGGERS \
+ post_UP_TRIGGERS"
+ local i f of
+# [[ -z $hooks_list ]] && return
+ for function_name in $function_list; do
+ of="function sorcery_default_${function_name}_hook () { local
ANTE_RC=\$1; "
+ f="$of"
+ for i in $hooks_list; do
+ # check if the function as is is declared
+ if declare -F ${i}_${function_name}_hook &>/dev/null; then
+ f="$f ${i}_${function_name}_hook;"
+ fi
+ done
+ # check if there was anything done if yes then just close it else
+ # default it to true
+ if [[ $f != $of ]]; then
+ f="$f }"
+ else
+ f="$f true; }"
+ fi
+ eval "$f"
+ done
+ fi
+ hook_marker() { true; };
+ debug "libmisc" "init_hooks - finished initial load"
+}
- case $SOUND in
- on) SOUND_FILE=$SOUND_DIRECTORY/$SOUND_THEME/$1
- if [ -e $SOUND_FILE ]; then
- ( cd / ; play $SOUND_FILE 2>/dev/null & )
- debug "libmisc" "Playing $SOUND_FILE"
- else
- debug "libmisc" "Error playing $SOUND_FILE: no such file"
- fi
- ;;
- esac
+#---------------------------------------------------------------------
+##
+## This function first checks if the spell_file hook should be run
+## and then assembles the parameters into a call to the relevant function
+## @param spell_file
+## @optional_param hook_order pre|post
+##
+#---------------------------------------------------------------------
+function run_hook() {
+ local spell_file="$1"
+ local hook_order="$2"
+ local rc=$3
+ case $spell_file in
+ DETAILS|CONFLICTS|PRE_SUB_DEPENDS|SUB_DEPENDS) return 0 ;;
+
REPORT|cast_start_spell|cast_initialize|cast_final|real_query|real_query_string)
sorcery_default_${spell_file}_hook $rc ;;
+ *) sorcery_default_${hook_order}_${spell_file}_hook $rc ;;
+ esac
}
@@ -599,26 +725,6 @@ function select_list_sub() {
}
#---------------------------------------------------------------------
-## @param title
-##
-## sets the terminal title if TERM=xterm|rxvt or the window title if
-## TERM=screen
-##
-#---------------------------------------------------------------------
-function set_term_title()
-{
- if [[ $SET_TERM_TITLE != on ]]; then return; fi
- case $TERM in
- xterm*|rxvt*) echo -ne "\e]0;$@\007"
- ;;
- screen) echo -ne "\ek$@\e\\"
- ;;
- *) ;;
- esac
-}
-
-
-#---------------------------------------------------------------------
## @param return_var
## @param elements, ...
##
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index f73a657..1062712 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -325,11 +325,13 @@ function resurrect_spell() { (
function resurrect_sub() {
# 10) if theres a PRE_RESURRECT run it or fail/rollback
if test -x $SCRIPT_DIRECTORY/PRE_RESURRECT ; then
+ run_hook PRE_RESURRECT pre
. $SCRIPT_DIRECTORY/PRE_RESURRECT || {
debug "libresurrect" "PRE_RESURRECT failed"
resurrect_fail 1
return 1
}
+ run_hook PRE_RESURRECT post
fi
@@ -408,11 +410,13 @@ function resurrect_sub() {
# 14) if theres a POST_RESURRECT run it
if test -x $SCRIPT_DIRECTORY/POST_RESURRECT ; then
+ run_hook POST_RESURRECT pre
. $SCRIPT_DIRECTORY/POST_RESURRECT || {
message "POST_RESURRECT failed"
resurrect_fail 1
return 1
}
+ run_hook POST_RESURRECT post
fi
ldconfig # can never be too careful
}
diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index f322021..21399be 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -173,30 +173,22 @@ function set_umask() {
#---------------------------------------------------------------------
## @param filename
##
-## Displays and/or mails the contents of the file given as the first
-## argument.
+## Displays and the contents of the file given as the first argument.
##
#---------------------------------------------------------------------
function report() {
if ! [ -f $1 ]; then return; fi
+ run_hook REPORT
if [ "$VIEW_REPORTS" == "on" ]; then
debug "libsorcery" "Prompting to view $2 for $SPELL"
VIEW_PROMPT="View $2 for
${SPELL_COLOR}${SPELL}-${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}?"
- sound REPORT
if query "$VIEW_PROMPT" n; then $PAGER $1; fi
fi
- if [ "$MAIL_REPORTS" == "on" ]; then
- debug "libsorcery" "Mailing report ($2) for $SPELL to $SORCERER"
- date -u |
- mail -s "Sorcery Report : $HOSTNAME : $2 for $SPELL-$VERSION" \
- -a $1 $SORCERER 2>/dev/null
- fi
-
true
}
diff --git a/var/lib/sorcery/modules/libspell
b/var/lib/sorcery/modules/libspell
index d51eff7..76b0fb3 100755
--- a/var/lib/sorcery/modules/libspell
+++ b/var/lib/sorcery/modules/libspell
@@ -151,6 +151,9 @@ function run_spell_file() {
# this is mostly used for messages like "<spell> checking dependencies"
local pre_function=$3
+ # hook calling moved into here
+ run_hook ${spell_file} pre
+
eval "function real_default_${function_suffix}() {
default_section_${function_suffix}
}"
@@ -179,6 +182,9 @@ function run_spell_file() {
log_failure_reason $function_suffix
fi
+ # hooks moved into here
+ run_hook ${spell_file} post $rc
+
# restore these, so they're always false except when needed
eval "function real_default_${function_suffix}() {
false
[SM-Commit] GIT changes to devel-pyrobor2 sorcery by Bor Kraljič (07bf30b46dcec73167cc01d3c5c030fe870b4296),
Bor Kraljič, 10/17/2011