From 750e19f4788145911378e6855c2515c430b58b83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Sun, 10 Feb 2008 12:44:19 +0000 Subject: [PATCH] - %remove_etc_shells with -p skips code if upgraded Changed files: rpm.macros -> 1.428 --- rpm.macros | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/rpm.macros b/rpm.macros index 03f9d5d..5a97446 100644 --- a/rpm.macros +++ b/rpm.macros @@ -1420,20 +1420,22 @@ end\ %{nil} %remove_etc_shells(p) %{-p:}\ -t = {}\ -f = io.open("/etc/shells", "r")\ -if f then\ - for l in f:lines() do t[l]=l; end\ - f:close()\ -end\ -for _, l in pairs({%{expand:%%__lua_split %*}}) do\ - t[l] = nil\ -end\ -s=""\ -for _, l in pairs(t) do\ - s=s..l.."\\n"\ -end\ -io.open("/etc/shells", "w"):write(s)\ +%{-p:if arg[2] == "0" then}\ + t = {}\ + f = io.open("/etc/shells", "r")\ + if f then\ + for l in f:lines() do t[l]=l; end\ + f:close()\ + end\ + for _, l in pairs({%{expand:%%__lua_split %*}}) do\ + t[l] = nil\ + end\ + s=""\ + for _, l in pairs(t) do\ + s=s..l.."\\n"\ + end\ + io.open("/etc/shells", "w"):write(s)\ +%{-p:end} \ %{nil} # vim:ts=4 sw=4 noet syn=spec -- 2.44.0