]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- more macros: %rc_inetd_post{,un}
authorsaq <saq@pld-linux.org>
Tue, 24 Jul 2001 22:43:41 +0000 (22:43 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- functional changes to %chkconfig_{post,preun} and %{user,group}add

Changed files:
    rpm.macros -> 1.56

rpm.macros

index 1576e9a5b9f43abf39bbaade10d45254db42d59c..422257de00973377d052822a628daf6892a56190 100644 (file)
@@ -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
This page took 0.06403 seconds and 4 git commands to generate.