SPECS: adapter.awk - replace into %service and %useradd macros

glen glen at pld-linux.org
Tue Mar 14 09:22:34 CET 2006


Author: glen                         Date: Tue Mar 14 08:22:34 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- replace into %service and %useradd macros

---- Files affected:
SPECS:
   adapter.awk (1.294 -> 1.295) 

---- Diffs:

================================================================
Index: SPECS/adapter.awk
diff -u SPECS/adapter.awk:1.294 SPECS/adapter.awk:1.295
--- SPECS/adapter.awk:1.294	Tue Mar 14 09:09:58 2006
+++ SPECS/adapter.awk	Tue Mar 14 09:22:29 2006
@@ -537,12 +537,18 @@
 /^%pre/, (!/^%pre/ && $0 ~ SECTIONS) {
 	preamble = 0
 
+	if (gsub("/usr/sbin/useradd", "%useradd")) {
+		sub(" 2> /dev/null \|\| :", "");
+		sub(" >/dev/null 2>&1 \|\|:", "");
+	}
+
 	# %useradd and %groupadd may not be wrapped
 	if (/%(useradd|groupadd).*\\$/) {
 		a = $0; getline;
 		sub(/^[\s\t]*/, "");
 		$0 = substr(a, 1, length(a) - 1) $0;
 	}
+	use_script_macros()
 }
 
 /^%post/, (!/^%post/ && $0 ~ SECTIONS) {
@@ -551,30 +557,39 @@
 }
 /^%preun/, (!/^%preun/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%postun/, (!/^%postun/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%triggerin/, (!/^%triggerin/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%triggerun/, (!/^%triggerun/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%triggerpostun/, (!/^%triggerpostun/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%pretrans/, (!/^%pretrans/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%posttrans/, (!/^%posttrans/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%verifyscript/, (!/^%verifyscript/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 /^%check/, (!/^%check/ && $0 ~ SECTIONS) {
 	preamble = 0
+	use_script_macros()
 }
 
 #############
@@ -1330,6 +1345,14 @@
 	gsub("%{_datadir}/applications", "%{_desktopdir}");
 	gsub("%{_datadir}/icons", "%{_iconsdir}");
 	gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}");
+}
+
+function use_script_macros()
+{
+	if (gsub("/sbin/service", "%service")) {
+		sub(" >/dev/null 2>&1 \|\|:", "");
+		sub(" 2> /dev/null \|\| :", "");
+	}
 }
 
 function fill(ch, n, i) {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/adapter.awk?r1=1.294&r2=1.295&f=u



More information about the pld-cvs-commit mailing list