From 94769e3f5ffa5bda72a68afa68f7039791a7b43c Mon Sep 17 00:00:00 2001 From: saq Date: Tue, 24 Jul 2001 22:43:41 +0000 Subject: [PATCH] - more macros: %rc_inetd_post{,un} - functional changes to %chkconfig_{post,preun} and %{user,group}add Changed files: rpm.macros -> 1.56 --- rpm.macros | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/rpm.macros b/rpm.macros index 1576e9a..422257d 100644 --- a/rpm.macros +++ b/rpm.macros @@ -252,23 +252,29 @@ fi \ # Macros commonly used in %{pre,post}{un,} # # Usage: -# NAME=lircd; %chkconfig_post -# NAME=lircd; %chkconfig_preun +# [NAME=lircd;] [DESC="lirc daemon";] %chkconfig_post +# [NAME=lircd;] %chkconfig_preun # %fix_info_dir (in %post) -# GID=51; GROUP=http; %groupadd (in %pre) -# UID=51; USER=http; GROUP=http; COMMENT="HTTP User"; HOMEDIR=/home/httpd -# [SHELL=/bin/false;] %useradd (in %pre) +# GID=51; GROUP=http; [NAME=apache;] %groupadd (in %pre) +# [UID=51;] USER=http; GROUP=http; COMMENT="HTTP User" +# [HOMEDIR="/home/users/httpd [-m]";] [SHELL=/bin/false;] +# [NAME=apache;] %useradd (in %pre) # GROUP=http; %groupdel (in %postun) # USER=http; %userdel (in %postun) +# %rc_inetd_post +# %rc_inetd_postun # -%chkconfig_post /sbin/chkconfig --add $NAME \ +%chkconfig_post [ -z "$NAME" ] && NAME=%{name} \ +/sbin/chkconfig --add $NAME \ +[ -z "$DESC" ] && DESC=$NAME if [ -f /var/lock/subsys/$NAME ]; then \ /etc/rc.d/init.d/$NAME restart >&2 \ else \ - echo "Run \\"/etc/rc.d/init.d/$NAME start\\" to start $NAME." >&2 \ + echo "Run \\"/etc/rc.d/init.d/$NAME start\\" to start $DESC." >&2 \ fi -%chkconfig_preun if [ "$1" = "0" ]; then \ +%chkconfig_preun [ -z "$NAME" ] && NAME=%{name} \ +if [ "$1" = "0" ]; then \ if [ -f /var/lock/subsys/$NAME ]; then \ /etc/rc.d/init.d/$NAME stop >&2 \ fi \ @@ -277,23 +283,28 @@ fi %fix_info_dir [ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} > /dev/null 2>&1 -%groupadd if [ -n "`getgid $GROUP`" ]; then \ +%groupadd [ -z "$NAME" ] && NAME=%{name} \ +[ -n "$GID" ] && GID="-g $GID" \ +if [ -n "`getgid $GROUP`" ]; then \ if [ "`getgid $GROUP`" != "$GID" ]; then \ - echo "Warning: group $GROUP doesn't have gid=$GID. Correct this before installing %{name}" 1>&2 \ + echo "Warning: group $GROUP doesn't have gid=$GID. Correct this before installing $NAME." 1>&2 \ exit 1 \ fi \ else \ - /usr/sbin/groupadd -g $GID -r -f $GROUP \ + /usr/sbin/groupadd $GID -r -f $GROUP \ fi -%useradd if [ -n "`id -u $USER 2>/dev/null`" ]; then \ +%useradd [ -z "$NAME" ] && NAME=%{name} \ +[ -z "$HOMEDIR" ] && HOMEDIR=/home/users/$NAME \ +[ -n "$UID" ] && UID="-u $UID -r" +if [ -n "`id -u $USER 2>/dev/null`" ]; then \ if [ "`id -u $USER`" != "$UID" ]; then \ - echo "Warning: user $USER doesn't have uid=$UID. Correct this before installing %{name}" 1>&2 \ + echo "Warning: user $USER doesn't have uid=$UID. Correct this before installing $NAME." 1>&2 \ exit 1 \ fi \ else \ test -z "$SHELL" && SHELL=/bin/false \ - /usr/sbin/useradd -u $UID -r -d "$HOMEDIR" -s $SHELL -c "$COMMENT" -g $GROUP $USER 1>&2 \ + /usr/sbin/useradd $UID -d "$HOMEDIR" -s $SHELL -c "$COMMENT" -g $GROUP $USER 1>&2 \ fi %groupdel if [ "$1" = "0" ]; then \ @@ -303,3 +314,13 @@ fi %userdel if [ "$1" = "0" ]; then \ /usr/sbin/userdel $USER \ fi + +%rc_inetd_post if [ -f /var/lock/subsys/rc-inetd ]; then \ + /etc/rc.d/init.d/rc-inetd restart 1>&2 \ +else \ + echo "Type \"/etc/rc.d/init.d/rc-inetd start\" to start inet server" 1>&2 \ +fi + +%rc_inetd_postun if [ -f /var/lock/subsys/rc-inetd ]; then \ + /etc/rc.d/init.d/rc-inetd restart \ +fi -- 2.44.0