rpath= ; \
chmod u+w "$file"; \
for dir in $(chrpath -l "$file" | awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'); do \
- dir=$(%{__python} -c 'import sys, os; print os.path.normpath(sys.argv[1]);' "$dir"); \
+ # translate $ORIGIN to real path, so that normalize path \
+ # would work with readlink and secondly we don't need to \
+ # relocate the binaries in rpm based distro \
+ local f=${file#$RPM_BUILD_ROOT}; \
+ local origin=${f%/*}; \
+ dir=$(echo $dir | sed -e "s,\$ORIGIN,$origin,g"); \
+ dir=$(readlink -m "$dir"); \
case $dir in \
/home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
echo "remove-rpath: $dir in $file"; \
###################################################################
# Requires/Provides automation
-# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
+# exceptions system by Jacek Konieczny <jajcus@pld-linux.org>
#
%__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
%__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
%ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version
%php_pear_dir /usr/share/pear
+%php_data_dir /usr/share/php
%php_extensiondir %{expand:%%global php_extensiondir %(php-config --extension-dir 2>/dev/null || echo ERROR)}%php_extensiondir
%php_sysconfdir %{expand:%%global php_sysconfdir %(php-config --sysconfdir 2>/dev/null || echo ERROR)}%php_sysconfdir
%php_includedir %{expand:%%global php_includedir %(php-config --include-dir 2>/dev/null || echo ERROR)}%php_includedir
# Author: Elan Ruusamäe <glen@pld-linux.org>
#
# Usage:
-# %post -p %add_etc_shells -p /bin/sh /bin/pdksh
-# %preun -p %remove_etc_shells -p /bin/sh /bin/pdksh
+# %post -p <lua>
+# %lua_add_etc_shells /bin/sh /bin/pdksh
#
-# -p (optional) -- specifies that result is embeded %post script (prepends <lua> as first line)
+# %preun -p <lua>
+# if arg[2] == 0 then
+# %lua_remove_etc_shells /bin/bash /bin/rbash
+# end
#
# Requirements:
-# BuildRequires: rpmbuild(macros) >= 1.429
+# BuildRequires: rpmbuild(macros) >= 1.462
+#
-%add_etc_shells(p) %{-p:<lua>}\
+%lua_add_etc_shells() \
t = {}\
f = io.open("/etc/shells", "r")\
if f then\
end\
%{nil}
+%lua_remove_etc_shells() \
+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\
+ print("Removing "..l.." from /etc/shells")\
+ t[l] = nil\
+end\
+s=""\
+for _, l in pairs(t) do\
+ s=s..l.."\\n"\
+end\
+io.open("/etc/shells", "w"):write(s)\
+%{nil}
+
+# Backwards compat. Use of %lua_ prefixed macros is preferred as these are cleaner to read.
+#
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+#
+# Usage:
+# %post -p %add_etc_shells -p /bin/sh /bin/pdksh
+# %preun -p %remove_etc_shells -p /bin/sh /bin/pdksh
+#
+# -p (optional) -- specifies that result is embeded %post script (prepends <lua> as first line)
+#
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.429
+#
+%add_etc_shells(p) %{-p:<lua>}\
+%{expand:%%lua_add_etc_shells %*}\
+%{nil}
+
%remove_etc_shells(p) %{-p:<lua>}\
%{-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\
- print("Removing "..l.." from /etc/shells")\
- t[l] = nil\
- end\
- s=""\
- for _, l in pairs(t) do\
- s=s..l.."\\n"\
- end\
- io.open("/etc/shells", "w"):write(s)\
+%{expand:%%lua_remove_etc_shells %*}\
%{-p:end} \
%{nil}