Signed-off-by: Jakub Filak <[email protected]>
---
.gitignore | 1 +
src/hooks/Makefile.am | 9 +++-
src/hooks/abrt-install-ccpp-hook | 97 -------------------------------------
src/hooks/abrt-install-ccpp-hook.in | 97 +++++++++++++++++++++++++++++++++++++
4 files changed, 106 insertions(+), 98 deletions(-)
delete mode 100755 src/hooks/abrt-install-ccpp-hook
create mode 100755 src/hooks/abrt-install-ccpp-hook.in
diff --git a/.gitignore b/.gitignore
index 4982416..8d6aeca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,7 @@ src/plugins/abrt-action-generate-core-backtrace
src/plugins/abrt-bodhi
src/hooks/abrt_exception_handler.py
src/hooks/abrt-hook-ccpp
+src/hooks/abrt-install-ccpp-hook
src/applet/abrt-applet.desktop
src/gui-gtk/abrt.desktop
src/cli/abrt-cli
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
index bbdc472..3cfaabd 100644
--- a/src/hooks/Makefile.am
+++ b/src/hooks/Makefile.am
@@ -26,7 +26,9 @@ abrt_hook_ccpp_LDADD = \
$(LIBREPORT_LIBS)
python_PYTHON = abrt.pth abrt_exception_handler.py
-EXTRA_DIST = abrt_exception_handler.py.in abrt-install-ccpp-hook
abrt-harvest-vmcore
+EXTRA_DIST = abrt_exception_handler.py.in \
+ abrt-install-ccpp-hook.in \
+ abrt-harvest-vmcore
CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir
$(wildcard \.\#*)) $(notdir $(wildcard *.pyc)) $(man1_MANS)
@@ -44,3 +46,8 @@ install-data-local:
sed -e s,\@VAR_RUN\@,\"$(VAR_RUN)\",g \
-e s,\@CONF_DIR\@,\"$(CONF_DIR)\",g \
abrt_exception_handler.py.in >abrt_exception_handler.py
+
+abrt-install-ccpp-hook: abrt-install-ccpp-hook.in
+ sed -e s,\@VAR_RUN\@,$(VAR_RUN),g \
+ -e s,\@libexecdir\@,$(libexecdir),g \
+ $< >$@
diff --git a/src/hooks/abrt-install-ccpp-hook b/src/hooks/abrt-install-ccpp-hook
deleted file mode 100755
index 63fc804..0000000
--- a/src/hooks/abrt-install-ccpp-hook
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/bin/bash
-# Install coredump handler which saves segfault data
-
-# For debugging
-
-dry_run=false
-verbose=false
-
-PATTERN_FILE="/proc/sys/kernel/core_pattern"
-SAVED_PATTERN_DIR="/var/run/abrt"
-SAVED_PATTERN_FILE="/var/run/abrt/saved_core_pattern"
-HOOK_BIN="/usr/libexec/abrt-hook-ccpp"
-# Must match percent_specifiers[] order in abrt-hook-ccpp.c:
-PATTERN="|$HOOK_BIN %s %c %p %u %g %t %e"
-# Same, but with bogus "executable name" parameter
-PATTERN1="|$HOOK_BIN %s %c %p %u %g %t e"
-
-# core_pipe_limit specifies how many dump_helpers can run at the same time
-# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
-# process will be available for dump_helper.
-# 4 - means that 4 dump_helpers can run at the same time (the rest will also
-# run, but they will fail to read /proc/<pid>).
-#
-# This should be enough for ABRT, we can miss some crashes, but what are
-# the odds that more processes crash at the same time? And moreover,
-# do people want to save EVERY ONE of the crashes when they have
-# a crash storm? I don't think so.
-# The value of 4 has been recommended by nhorman.
-#
-CORE_PIPE_LIMIT_FILE="/proc/sys/kernel/core_pipe_limit"
-CORE_PIPE_LIMIT="4"
-
-start() {
- cur=`cat "$PATTERN_FILE"`
- cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
-
- # Is there a %e (executable name) in old pattern anywhere?
- if test x"${cur#*%e}" = x"${cur}"; then
- # No. Can use PATTERN with less risk of overflow
- # on expansion (executable names can be LONG).
- # Overflow would cause kernel to abort coredump. BAD.
- PATTERN="$PATTERN1"
- fi
-
- $verbose && printf "cur:'%s'\n" "$cur"
- # Is it already installed?
- if test x"$cur_first" != x"|$HOOK_BIN"; then # no
- # It is not installed
- mkdir -p -- "$SAVED_PATTERN_DIR"
- printf "%s\n" "$cur" >"$SAVED_PATTERN_FILE"
- # Install new handler
- $verbose && printf "Installing to %s:'%s'\n" "$PATTERN_FILE"
"$PATTERN"
- $dry_run || echo "$PATTERN" >"$PATTERN_FILE"
-
- # Check core_pipe_limit and change it if it's 0,
- # otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
- # of the crashing process
- if test x"`cat "$CORE_PIPE_LIMIT_FILE"`" = x"0"; then
- echo "$CORE_PIPE_LIMIT" >"$CORE_PIPE_LIMIT_FILE"
- fi
- fi
-}
-
-stop() {
- if test -f "$SAVED_PATTERN_FILE"; then
- $verbose && printf "Restoring to %s:'%s'\n" "$PATTERN_FILE"
"`cat "$SAVED_PATTERN_FILE"`"
- $dry_run || cat "$SAVED_PATTERN_FILE" >"$PATTERN_FILE"
- fi
-}
-
-status() {
- cur=`cat "$PATTERN_FILE"`
- cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
- # Is it already installed?
- if test x"$cur_first" = x"|$HOOK_BIN"; then # yes
- $verbose && printf "Installed\n"
- return 0
- else
- $verbose && printf "Not installed\n"
- return 1
- fi
-}
-
-case "$1" in
-install)
- start
- ;;
-uninstall)
- stop
- ;;
-is-installed)
- status
- ;;
-*)
- echo $"Usage: $0 {install|uninstall|is-installed}"
- exit 2
-esac
diff --git a/src/hooks/abrt-install-ccpp-hook.in
b/src/hooks/abrt-install-ccpp-hook.in
new file mode 100755
index 0000000..aa01231
--- /dev/null
+++ b/src/hooks/abrt-install-ccpp-hook.in
@@ -0,0 +1,97 @@
+#!/bin/bash
+# Install coredump handler which saves segfault data
+
+# For debugging
+
+dry_run=false
+verbose=false
+
+PATTERN_FILE="/proc/sys/kernel/core_pattern"
+SAVED_PATTERN_DIR="@VAR_RUN@/abrt"
+SAVED_PATTERN_FILE="@VAR_RUN@/abrt/saved_core_pattern"
+HOOK_BIN="@libexecdir@/abrt-hook-ccpp"
+# Must match percent_specifiers[] order in abrt-hook-ccpp.c:
+PATTERN="|$HOOK_BIN %s %c %p %u %g %t %e"
+# Same, but with bogus "executable name" parameter
+PATTERN1="|$HOOK_BIN %s %c %p %u %g %t e"
+
+# core_pipe_limit specifies how many dump_helpers can run at the same time
+# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
+# process will be available for dump_helper.
+# 4 - means that 4 dump_helpers can run at the same time (the rest will also
+# run, but they will fail to read /proc/<pid>).
+#
+# This should be enough for ABRT, we can miss some crashes, but what are
+# the odds that more processes crash at the same time? And moreover,
+# do people want to save EVERY ONE of the crashes when they have
+# a crash storm? I don't think so.
+# The value of 4 has been recommended by nhorman.
+#
+CORE_PIPE_LIMIT_FILE="/proc/sys/kernel/core_pipe_limit"
+CORE_PIPE_LIMIT="4"
+
+start() {
+ cur=`cat "$PATTERN_FILE"`
+ cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
+
+ # Is there a %e (executable name) in old pattern anywhere?
+ if test x"${cur#*%e}" = x"${cur}"; then
+ # No. Can use PATTERN with less risk of overflow
+ # on expansion (executable names can be LONG).
+ # Overflow would cause kernel to abort coredump. BAD.
+ PATTERN="$PATTERN1"
+ fi
+
+ $verbose && printf "cur:'%s'\n" "$cur"
+ # Is it already installed?
+ if test x"$cur_first" != x"|$HOOK_BIN"; then # no
+ # It is not installed
+ mkdir -p -- "$SAVED_PATTERN_DIR"
+ printf "%s\n" "$cur" >"$SAVED_PATTERN_FILE"
+ # Install new handler
+ $verbose && printf "Installing to %s:'%s'\n" "$PATTERN_FILE"
"$PATTERN"
+ $dry_run || echo "$PATTERN" >"$PATTERN_FILE"
+
+ # Check core_pipe_limit and change it if it's 0,
+ # otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
+ # of the crashing process
+ if test x"`cat "$CORE_PIPE_LIMIT_FILE"`" = x"0"; then
+ echo "$CORE_PIPE_LIMIT" >"$CORE_PIPE_LIMIT_FILE"
+ fi
+ fi
+}
+
+stop() {
+ if test -f "$SAVED_PATTERN_FILE"; then
+ $verbose && printf "Restoring to %s:'%s'\n" "$PATTERN_FILE"
"`cat "$SAVED_PATTERN_FILE"`"
+ $dry_run || cat "$SAVED_PATTERN_FILE" >"$PATTERN_FILE"
+ fi
+}
+
+status() {
+ cur=`cat "$PATTERN_FILE"`
+ cur_first=`printf "%s" "$cur" | sed 's/ .*//'`
+ # Is it already installed?
+ if test x"$cur_first" = x"|$HOOK_BIN"; then # yes
+ $verbose && printf "Installed\n"
+ return 0
+ else
+ $verbose && printf "Not installed\n"
+ return 1
+ fi
+}
+
+case "$1" in
+install)
+ start
+ ;;
+uninstall)
+ stop
+ ;;
+is-installed)
+ status
+ ;;
+*)
+ echo $"Usage: $0 {install|uninstall|is-installed}"
+ exit 2
+esac
--
1.7.11.2