[packages/molly-guard] Don't touch PATH, add aliases instead

mmazur mmazur at pld-linux.org
Fri Mar 7 15:45:58 CET 2014


commit 6f7310d6461dfb161af96e30fbe157f564ebbde7
Author: Mariusz Mazur <mmazur at pld-linux.org>
Date:   Fri Mar 7 15:44:48 2014 +0100

    Don't touch PATH, add aliases instead

 molly-guard.csh  | 12 ++++++------
 molly-guard.sh   | 12 ++++++------
 molly-guard.spec |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/molly-guard.spec b/molly-guard.spec
index 4f7aa38..7a39564 100644
--- a/molly-guard.spec
+++ b/molly-guard.spec
@@ -56,8 +56,8 @@ install -d $RPM_BUILD_ROOT
 	prefix=%{_prefix} \
 	DEST=$RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT/etc/profile.d
-cp -p %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d
+install -d $RPM_BUILD_ROOT/etc/shrc.d
+cp -p %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT/etc/shrc.d
 
 %clean
 rm -fr $RPM_BUILD_ROOT
@@ -65,8 +65,8 @@ rm -fr $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc ChangeLog
-%config(noreplace) %verify(not md5 mtime size) /etc/profile.d/molly-guard.csh
-%config(noreplace) %verify(not md5 mtime size) /etc/profile.d/molly-guard.sh
+%config(noreplace) %verify(not md5 mtime size) /etc/shrc.d/molly-guard.csh
+%config(noreplace) %verify(not md5 mtime size) /etc/shrc.d/molly-guard.sh
 %dir %{_sysconfdir}/%{name}
 %dir %{_sysconfdir}/%{name}/run.d
 %attr(755,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/run.d/*
diff --git a/molly-guard.csh b/molly-guard.csh
index 53dda5c..0cab041 100755
--- a/molly-guard.csh
+++ b/molly-guard.csh
@@ -1,11 +1,11 @@
 ##
-## update $PATH for use with molly-guard
+## set up molly-guard aliases
 ##
 
-# if we're superuser, reorder $PATH if it's wrong to get molly-guard working
+# if we're superuser, point reboot/shutdown commands at molly-guard
 if ( `id -u` == 0 ) then
-	# switch sbin entries
-	set path = ( `echo ${path} | sed -re 's#(^|\ )/sbin(\ |.*)/usr/sbin(\ |$)#\1/usr/sbin\2/sbin\3#'` )
-	# switch bin entries
-	set path = ( `echo ${path} | sed -re 's#(^|\ )/bin(\ |.*)/usr/bin(\ |$)#\1/usr/bin\2/bin\3#'` )
+    alias halt /usr/sbin/halt
+    alias poweroff /usr/sbin/poweroff
+    alias reboot /usr/sbin/reboot
+    alias shutdown /usr/sbin/shutdown
 endif
diff --git a/molly-guard.sh b/molly-guard.sh
index 917177d..e033f30 100755
--- a/molly-guard.sh
+++ b/molly-guard.sh
@@ -1,11 +1,11 @@
 ##
-## update $PATH for use with molly-guard
+## set up molly-guard aliases
 ##
 
-# if we're superuser, reorder $PATH if it's wrong to get molly-guard working
+# if we're superuser, point reboot/shutdown commands at molly-guard
 if [ $(id -u) = 0 ]; then
-	# switch sbin entries
-	PATH=$(echo ${PATH} | sed -re 's#(^|:)/sbin(:|.*)/usr/sbin(:|$)#\1/usr/sbin\2/sbin\3#')
-	# switch bin entries
-	PATH=$(echo ${PATH} | sed -re 's#(^|:)/bin(:|.*)/usr/bin(:|$)#\1/usr/bin\2/bin\3#')
+    alias halt=/usr/sbin/halt
+    alias poweroff=/usr/sbin/poweroff
+    alias reboot=/usr/sbin/reboot
+    alias shutdown=/usr/sbin/shutdown
 fi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/molly-guard.git/commitdiff/6f7310d6461dfb161af96e30fbe157f564ebbde7



More information about the pld-cvs-commit mailing list