]> git.pld-linux.org Git - packages/rpm.git/commitdiff
New macros:
authorsaq <saq@pld-linux.org>
Mon, 23 Jul 2001 22:17:14 +0000 (22:17 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- for the kernel:
-- %{_kernel_ver} returning the version of /usr/src/linux
-- %{_kernel24} true if %{_kernel_ver} is the 2.4 series
-- %{_kernel_series} returning 2.2 or 2.4 (dep. on %{_kernel24})
-- %conflicts_kernel_ver, %conflicts_kernel_series giving a
Conflicts: line against wrong kernel {version,series}
- for %{pre,post}{un,} scripts: %chkconfig_pre, %chkconfig_postun,
%fix_info_dir, %{group,user}{add,del}

Changed files:
    rpm.macros -> 1.54

rpm.macros

index 284dfc3e20d8dc4a9f6de548f30e83fd72d8bd63..a406e960008a8c1d6bae982a07c3b5e7e9600ebe 100644 (file)
@@ -239,4 +239,67 @@ fi \
 #%_noautoprovfiles     %{nil}
 #%_noautoprov          %{nil}
 
+#-----------------------------------------------------------------
+# Kernel version related stuff
+#
+%_kernel_ver           %(grep UTS_RELEASE /usr/src/linux/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
+%_kernel24             %(echo %{_kernel_ver} | grep -q '2\.[012]\.' ; echo $?)
+%_kernel_series                %{?_kernel24:2.4}%{!?_kernel24:2.2}
+%conflicts_kernel_ver  Conflicts: kernel < %{_kernel_ver}, kernel > %{_kernel_ver}
+%conflicts_kernel_series Conflicts: kernel %{?_kernel24:<}{^!?_kernel24:>=} 2.3.0
+
+#-----------------------------------------------------------------
+# Macros commonly used in %{pre,post}{un,}
+#
+# Usage:
+# NAME=lircd; %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)
+# GROUP=http; %groupdel (in %postun)
+# USER=http; %userdel (in %postun)
+#
+%chkconfig_post /sbin/chkconfig --add $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 \
+fi
+
+%chkconfig_preun if [ "$1" = "0" ]; then \
+        if [ -f /var/lock/subsys/$NAME ]; then \
+                /etc/rc.d/init.d/$NAME stop >&2 \
+        fi \
+        /sbin/chkconfig --del $NAME \
+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 \
+        if [ "`getgid $GROUP`" != "$GID" ]; then \
+                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 \
+fi
+
+%useradd 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 \
+                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 \
+fi
+
+%groupdel if [ "$1" = "0" ]; then \
+        /usr/sbin/groupdel $GROUP \
+fi
 
+%userdel if [ "$1" = "0" ]; then \
+        /usr/sbin/userdel $USER \
+fi
This page took 0.040228 seconds and 4 git commands to generate.