aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-01-27 14:47:42 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-01-27 14:47:42 +0000
commit8955653bd3e37afd97a81ce752559e51b01d8f1d (patch)
tree3b4cadcfd223b540bb3b91288749f8c7e96fbbab
parent820f75379afdc4e8e2434363341acd30e2a98b9d (diff)
downloadrpm-helper-8955653bd3e37afd97a81ce752559e51b01d8f1d.tar
rpm-helper-8955653bd3e37afd97a81ce752559e51b01d8f1d.tar.gz
rpm-helper-8955653bd3e37afd97a81ce752559e51b01d8f1d.tar.bz2
rpm-helper-8955653bd3e37afd97a81ce752559e51b01d8f1d.tar.xz
rpm-helper-8955653bd3e37afd97a81ce752559e51b01d8f1d.zip
svn keywords expansion
-rw-r--r--README58
-rwxr-xr-xcreate-ssl-certificate22
-rw-r--r--rpm-helper.macros.in2
3 files changed, 71 insertions, 11 deletions
diff --git a/README b/README
index 5beb4d2..4376e18 100644
--- a/README
+++ b/README
@@ -1,3 +1,57 @@
-rpm-helper is a set of scripts called by rpm scriptlets.
+rpm-helper is a set of helper scripts to be executed at package installation
+time. They are invocated through rpm macros. Here is a list of them, along with
+their usage instructions.
-Comments and new scripts welcome.
+%_get_password <length>
+Return a random password from given length (default 8).
+
+%create_ghostfile <package> <number> <file> <owner> <group> <mode>
+Create an empty file, with given owner, group and mode.
+
+%_create_ssl_certificate <package> <number> <name> [-g <group>] [-b]
+Create a ssl key and certificate pair with given name under /etc/pki/tls.
+Optional arguments:
+-b: concatenate certificate with the key file (bundle mode)
+-g: ensure key is readable by given group
+
+%_post_service <package> <number> <service>
+Add given service to boot sequence, by running chkconfig --add on it.
+
+%_preun_service <package> <number> <service>
+Remove given service from boot sequence, by running chkconfig --del on it.
+
+%_pre_useradd <package> <number> <name> <homedir> <shell>
+Add given user, with given homedir and shell.
+
+%_postun_userdel <package> <number> <name>
+Does nothing currently.
+
+%_pre_groupadd <package> <number> <group> [user1,user2,...]
+Add given group, with optional list of coma-separated users as members.
+
+%_postun_groupdel <package> <number> <group>
+Does nothing currently.
+
+%_post_shelladd <package> <number> <shell>
+Add given shell to the list of available system shells.
+
+%_preun_shelldel <package> <number> <shell>
+Remove given shell from the list of available system shells.
+
+%_post_syslogadd <package> <number> <destination> [-s <source>] [-f <facility>] [-m <min>] [-M <max>]
+Add a syslog entry, with given destination (usually a log file), and returns
+used facility. Support sysklogd and syslog-ng.
+Optional arguments:
+-s: ensure given source (usually /dev/log) is readable by syslog daemon.
+-f: use given facility (otherwise first available local one is used).
+-m: use given minimal priority.
+-M: use given maximal priority.
+
+%_preun_syslogdel <package> <number>
+Delete syslog entry created by previous macro. Support sysklogd and syslog-ng.
+
+%_post_webapp <package> <number>
+Handle apache configuration reloading if needed when adding a web application.
+
+%_postun_webapp <package> <number>
+Handle apache configuration reloading if needed when removing a web application.
diff --git a/create-ssl-certificate b/create-ssl-certificate
index 784d0e4..0e2e250 100755
--- a/create-ssl-certificate
+++ b/create-ssl-certificate
@@ -2,17 +2,23 @@
# $Id$
# helper script for creating ssl certificates
-if [ $# -lt 3 ]; then
- echo "usage: $0 <pkg name> <num installed> <service> <bundle> <group>" 1>&2
+while [ $# -gt 0 ]; do
+ case $1 in
+ -g) group=$2; shift 2;;
+ -b) bundle="true"; shift;;
+ *) args=( ${args[@]:-} $1 ); shift;;
+ esac
+done
+
+pkg=${args[0]} # name of the package
+num=${args[1]} # number of packages installed
+srv=${args[2]} # name of the service
+
+if [ -z "$pkg" -o -z "$num" -o -z "$srv" ]; then
+ echo "usage: $0 [-g <group>] [-b] <pkg name> <num installed> <service>" 1>&2
exit 1
fi
-pkg=$1 # name of the package
-num=$2 # number of packages installed
-srv=$3 # name of the service
-bundle=$4 # bundle mode
-group=$5 # group with read access on key
-
if [ $num = 1 ]; then
# default values
host=$(hostname)
diff --git a/rpm-helper.macros.in b/rpm-helper.macros.in
index bd8c8eb..60caa82 100644
--- a/rpm-helper.macros.in
+++ b/rpm-helper.macros.in
@@ -10,7 +10,7 @@
%{nil}
%_create_ssl_certificate_helper %_rpm_helper_dir/create-ssl-certificate
-%create_ssl_certificate() %_create_ssl_certificate_helper %{name} $1 %{1} %{2} %{?3} \
+%_create_ssl_certificate(g:b) %_create_ssl_certificate_helper %{name} $1 %{1} %{?-g:-g %{-g*}} %{?-b:-b} \
%{nil}
# initscripts macros