]> git.pld-linux.org Git - packages/molly-guard.git/commitdiff
No aliases, back to PATH changes, but different
authorMariusz Mazur <mmazur@axeos.com>
Tue, 11 Mar 2014 16:16:25 +0000 (16:16 +0000)
committerMariusz Mazur <mmazur@axeos.com>
Tue, 11 Mar 2014 16:18:43 +0000 (16:18 +0000)
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 [new file with mode: 0644]
molly-guard.csh
molly-guard.sh
molly-guard.spec

diff --git a/bin_path.patch b/bin_path.patch
new file mode 100644 (file)
index 0000000..cdd56dc
--- /dev/null
@@ -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)
index 0cab0419fd96bd4f618144443a352b1f1b263968..2906d24dc9186441d4dc9366e9f75540cac8ed73 100755 (executable)
@@ -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
index e033f30abfac71e8f6e4aeaf9b7b9962d9f14df5..58f4b288f55b6380187bb5c6e4435fdadbcf0942 100755 (executable)
@@ -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
index 7a39564fd3d83374a68fa24a005012ad8dac767b..f291ff2db1b1109e9e58efa6e84eea2994131f68 100644 (file)
@@ -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*
This page took 0.078445 seconds and 4 git commands to generate.