[packages/molly-guard] new, version 0.4.5

glen glen at pld-linux.org
Thu Mar 6 18:29:47 CET 2014


commit 4575b58bc77198b14210d48ba4942f78b48533e8
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Mar 6 19:25:10 2014 +0200

    new, version 0.4.5
    
    initial package created based on src.rpm from this blog:
    http://lazarus-corner-of-the-world.blogspot.com/2012/11/rpm-builds-for-molly-guard.html

 docbook.patch       | 12 +++++++++
 doubleslashes.patch | 12 +++++++++
 molly-guard.csh     | 12 +++++++++
 molly-guard.sh      | 14 ++++++++++
 molly-guard.spec    | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 125 insertions(+)
---
diff --git a/molly-guard.spec b/molly-guard.spec
new file mode 100644
index 0000000..1bd3c13
--- /dev/null
+++ b/molly-guard.spec
@@ -0,0 +1,75 @@
+Summary:	protects machines from accidental shutdowns/reboots
+Name:		molly-guard
+Version:	0.4.5
+Release:	0.1
+License:	Artistic Licence 2.0
+Group:		Applications/Networking
+Source0:	http://ftp.debian.org/debian/pool/main/m/molly-guard/%{name}_%{version}.orig.tar.gz
+# Source0-md5:	bee1573a8740d5dcc25302490b18213a
+Source1:	%{name}.sh
+Source2:	%{name}.csh
+Patch1:		docbook.patch
+Patch2:		doubleslashes.patch
+URL:		http://ftp.debian.org/debian/pool/main/m/molly-guard
+BuildRequires:	docbook-style-xsl
+BuildRequires:	libxslt
+Requires:	procps
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+The package installs a shell script that overrides the existing
+shutdown/reboot/halt/poweroff commands and first runs a set of
+scripts, which all have to exit successfully, before molly-guard
+invokes the real command.
+
+One of the scripts checks for existing SSH sessions. If any of the
+four commands are called interactively over an SSH session, the shell
+script prompts you to enter the name of the host you wish to shut
+down. This should adequately prevent you from accidental shutdowns and
+reboots.
+
+This shell script passes through the commands to the respective
+binaries in /sbin and should thus not get in the way if called
+non-interactively, or locally.
+
+%prep
+%setup -q
+%patch1 -p1
+%patch2 -p1
+
+%build
+%{__make} all \
+	etc_prefix=/ \
+	prefix=%{_prefix}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT
+fakeroot %{__make} install \
+	etc_prefix=/ \
+	prefix=%{_prefix} \
+	DEST=$RPM_BUILD_ROOT
+
+install -d $RPM_BUILD_ROOT/etc/profile.d
+cp -p %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d
+
+%clean
+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
+%dir %{_sysconfdir}/%{name}
+%dir %{_sysconfdir}/%{name}/run.d
+%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}
+%attr(755,root,root) %{_datadir}/%{name}/shutdown
+%{_mandir}/man8/%{name}.8*
diff --git a/docbook.patch b/docbook.patch
new file mode 100644
index 0000000..f5b2a9a
--- /dev/null
+++ b/docbook.patch
@@ -0,0 +1,12 @@
+diff -Nru -Nru molly-guard-0.4.5.orig/Makefile molly-guard-0.4.5/Makefile
+--- molly-guard-0.4.5.orig/Makefile	2012-02-23 22:59:43.000000000 +0000
++++ molly-guard-0.4.5/Makefile	2012-06-03 01:41:03.647330113 +0100
+@@ -5,7 +5,7 @@
+ 
+ all: molly-guard.8.gz shutdown
+ 
+-%.8: DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
++%.8: DB2MAN=/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl
+ %.8: XP=xsltproc -''-nonet
+ %.8: %.xml
+ 	$(XP) $(DB2MAN) $<
diff --git a/doubleslashes.patch b/doubleslashes.patch
new file mode 100644
index 0000000..9586176
--- /dev/null
+++ b/doubleslashes.patch
@@ -0,0 +1,12 @@
+diff -Nru -Nru molly-guard-0.4.5.orig/Makefile molly-guard-0.4.5/Makefile
+--- molly-guard-0.4.5.orig/Makefile	2012-02-23 22:59:43.000000000 +0000
++++ molly-guard-0.4.5/Makefile	2012-06-03 01:41:03.647330113 +0100
+@@ -23,7 +23,7 @@
+ .PHONY: clean
+ 
+ shutdown: shutdown.in
+-	sed -e 's, at ETCDIR@,$(ETCDIR),g' $< > $@
++	sed -e 's, at ETCDIR@,$(ETCDIR),g;s,//,/,g' $< > $@
+ 
+ install: shutdown molly-guard.8.gz
+ 	mkdir -m755 --parent $(DST)/share/molly-guard
diff --git a/molly-guard.csh b/molly-guard.csh
new file mode 100755
index 0000000..6fa33cf
--- /dev/null
+++ b/molly-guard.csh
@@ -0,0 +1,12 @@
+
+##
+## debianize $PATH for use with molly-guard
+##
+
+# if we're superuser, reorder $PATH if it's wrong to get molly-guard working
+if ( `/usr/bin/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#'` )
+endif
diff --git a/molly-guard.sh b/molly-guard.sh
new file mode 100755
index 0000000..c58fa99
--- /dev/null
+++ b/molly-guard.sh
@@ -0,0 +1,14 @@
+
+##
+## debianize $PATH for use with molly-guard
+##
+
+# if we're superuser, reorder $PATH if it's wrong to get molly-guard working
+if [ `/usr/bin/id -u` -eq 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#'`
+	export PATH
+fi
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/molly-guard.git/commitdiff/4575b58bc77198b14210d48ba4942f78b48533e8



More information about the pld-cvs-commit mailing list