[packages/molly-guard] No aliases, back to PATH changes, but different
mmazur
mmazur at pld-linux.org
Tue Mar 11 17:30:54 CET 2014
commit 0be761242e354d6a9b275eb97e0163e87e8e0eaa
Author: Mariusz Mazur <mmazur at axeos.com>
Date: Tue Mar 11 16:16:25 2014 +0000
No aliases, back to PATH changes, but different
Don't reorder PATH (an admin might not want that), but prepend PATH with
a directory containing only the shutdown/reboot overrides.
bin_path.patch | 19 +++++++++++++++++++
molly-guard.csh | 10 ++++------
molly-guard.sh | 16 ++++++++++------
molly-guard.spec | 11 +++++++----
4 files changed, 40 insertions(+), 16 deletions(-)
---
diff --git a/molly-guard.spec b/molly-guard.spec
index 7a39564..f291ff2 100644
--- a/molly-guard.spec
+++ b/molly-guard.spec
@@ -10,6 +10,7 @@ Source1: %{name}.sh
Source2: %{name}.csh
Patch1: docbook.patch
Patch2: doubleslashes.patch
+Patch3: bin_path.patch
URL: http://ftp.debian.org/debian/pool/main/m/molly-guard
BuildRequires: docbook-dtd42-xml
BuildRequires: docbook-style-xsl
@@ -40,6 +41,7 @@ non-interactively, or locally.
%setup -q
%patch1 -p1
%patch2 -p1
+%patch3 -p1
%{__sed} -i -e '/install/ s/-oroot -[og]root//' Makefile
%{__sed} -i -e '/chown/ s/root.root/%(id -un)/' Makefile
@@ -71,10 +73,11 @@ rm -fr $RPM_BUILD_ROOT
%dir %{_sysconfdir}/%{name}/run.d
%attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/run.d/*
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/rc
-%attr(755,root,root) %{_sbindir}/halt
-%attr(755,root,root) %{_sbindir}/poweroff
-%attr(755,root,root) %{_sbindir}/reboot
-%attr(755,root,root) %{_sbindir}/shutdown
+%dir %{_datadir}/%{name}/bin
+%attr(755,root,root) %{_datadir}/%{name}/bin/halt
+%attr(755,root,root) %{_datadir}/%{name}/bin/poweroff
+%attr(755,root,root) %{_datadir}/%{name}/bin/reboot
+%attr(755,root,root) %{_datadir}/%{name}/bin/shutdown
%dir %{_datadir}/%{name}
%attr(755,root,root) %{_datadir}/%{name}/shutdown
%{_mandir}/man8/%{name}.8*
diff --git a/bin_path.patch b/bin_path.patch
new file mode 100644
index 0000000..cdd56dc
--- /dev/null
+++ b/bin_path.patch
@@ -0,0 +1,19 @@
+--- molly-guard-0.4.5/Makefile.orig 2014-03-11 14:54:11.881357825 +0000
++++ molly-guard-0.4.5/Makefile 2014-03-11 14:55:19.208022299 +0000
+@@ -29,11 +29,11 @@
+ mkdir -m755 --parent $(DST)/share/molly-guard
+ install -m755 shutdown $(DST)/share/molly-guard
+
+- mkdir -m755 --parent $(DST)/sbin
+- ln -s ../share/molly-guard/shutdown $(DST)/sbin/poweroff
+- ln -s ../share/molly-guard/shutdown $(DST)/sbin/halt
+- ln -s ../share/molly-guard/shutdown $(DST)/sbin/reboot
+- ln -s ../share/molly-guard/shutdown $(DST)/sbin/shutdown
++ mkdir -m755 --parent $(DST)/share/molly-guard/bin
++ ln -s ../shutdown $(DST)/share/molly-guard/bin/poweroff
++ ln -s ../shutdown $(DST)/share/molly-guard/bin/halt
++ ln -s ../shutdown $(DST)/share/molly-guard/bin/reboot
++ ln -s ../shutdown $(DST)/share/molly-guard/bin/shutdown
+
+ mkdir -m755 --parent $(ETCDIR)
+ install -m644 rc $(ETCDIR)
diff --git a/molly-guard.csh b/molly-guard.csh
index 0cab041..2906d24 100755
--- a/molly-guard.csh
+++ b/molly-guard.csh
@@ -1,11 +1,9 @@
##
-## set up molly-guard aliases
+## update $PATH for use with molly-guard
##
-# if we're superuser, point reboot/shutdown commands at molly-guard
+# if we're superuser, put molly-guard binaries at the beginning of $PATH
if ( `id -u` == 0 ) then
- alias halt /usr/sbin/halt
- alias poweroff /usr/sbin/poweroff
- alias reboot /usr/sbin/reboot
- alias shutdown /usr/sbin/shutdown
+ # TODO: avoid duplicates same as in *.sh
+ set path = ( /usr/share/molly-guard/bin $path )
endif
diff --git a/molly-guard.sh b/molly-guard.sh
index e033f30..58f4b28 100755
--- a/molly-guard.sh
+++ b/molly-guard.sh
@@ -1,11 +1,15 @@
##
-## set up molly-guard aliases
+## update $PATH for use with molly-guard
##
-# if we're superuser, point reboot/shutdown commands at molly-guard
+# if we're superuser, put molly-guard binaries at the beginning of $PATH
if [ $(id -u) = 0 ]; then
- alias halt=/usr/sbin/halt
- alias poweroff=/usr/sbin/poweroff
- alias reboot=/usr/sbin/reboot
- alias shutdown=/usr/sbin/shutdown
+ case $PATH in
+ */usr/share/molly-guard/bin*)
+ # avoid duplicates
+ ;;
+ *)
+ PATH="/usr/share/molly-guard/bin:$PATH"
+ ;;
+ esac
fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/molly-guard.git/commitdiff/1788eff878d25c820732e14cf880118f42fbb2f1
More information about the pld-cvs-commit
mailing list