[shellinabox/el5] Initial import

Simone Caronni slaanesh at fedoraproject.org
Tue May 29 14:35:58 UTC 2012


commit 0bf9d3b64e0edf126457a02e2b0c71a6cdbb2ed3
Author: Simone Caronni <negativo17 at gmail.com>
Date:   Tue May 29 16:34:27 2012 +0200

    Initial import

 .gitignore             |    1 +
 shellinabox.spec       |  136 ++++++++++++++++++++++++++++++++++++++++++++++++
 shellinaboxd.init      |   81 ++++++++++++++++++++++++++++
 shellinaboxd.service   |   13 +++++
 shellinaboxd.sysconfig |    4 ++
 sources                |    1 +
 6 files changed, 236 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..0a936b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/shellinabox-2.14.tar.gz
diff --git a/shellinabox.spec b/shellinabox.spec
new file mode 100644
index 0000000..4ac497c
--- /dev/null
+++ b/shellinabox.spec
@@ -0,0 +1,136 @@
+Name:           shellinabox
+Version:        2.14
+Release:        3%{?dist}
+Summary:        Web based AJAX terminal emulator
+Group:          System Environment/Daemons
+License:        GPLv2
+URL:            http://code.google.com/p/shellinabox/
+Source0:        http://shellinabox.googlecode.com/files/%{name}-%{version}.tar.gz
+Source1:        shellinaboxd.sysconfig
+Source2:        shellinaboxd.service
+Source3:        shellinaboxd.init
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:  openssl-devel%{?_isa}
+BuildRequires:  zlib-devel%{?_isa}
+BuildRequires:  systemd-units
+
+%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+Requires(post):         systemd-sysv
+Requires(post):         systemd-units
+Requires(preun):        systemd-units
+Requires(postun):       systemd-units
+%else
+Requires(post):         /sbin/chkconfig
+Requires(preun):        /sbin/chkconfig
+Requires(preun):        /sbin/service
+Requires(postun):       /sbin/service
+%endif
+
+%description
+Shell In A Box implements a web server that can export arbitrary command line
+tools to a web based terminal emulator. This emulator is accessible to any
+JavaScript and CSS enabled web browser and does not require any additional
+browser plugins.
+
+
+%prep
+%setup -q
+
+%build
+%configure
+make %{?_smp_mflags}
+
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}%{_sbindir}
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
+
+install -p -m 755 -D shellinaboxd %{buildroot}%{_sbindir}/shellinaboxd
+install -p -m 644 -D shellinaboxd.1 %{buildroot}%{_mandir}/man1/shellinaboxd.1
+install -p -m 644 -D %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/shellinaboxd
+
+%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+
+# Systemd unit files
+mkdir -p %{buildroot}%{_unitdir}
+install -p -m 644 -D %{SOURCE2} %{buildroot}%{_unitdir}/shellinaboxd.service
+
+%else
+
+# Initscripts
+mkdir -p %{buildroot}%{_initrddir}
+install -p -m 755 -D %{SOURCE3} %{buildroot}%{_initrddir}/shellinaboxd
+
+%endif
+
+%clean
+rm -rf %{buildroot}
+
+%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+
+%post
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable shellinaboxd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop shellinaboxd.service > /dev/null 2>&1 || :
+fi
+
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart shellinaboxd.service >/dev/null 2>&1 || :
+fi
+
+%else
+
+%post
+/sbin/chkconfig --add shellinaboxd
+
+
+%preun
+if [ "$1" = 0 ]; then
+        /sbin/service shellinaboxd stop >/dev/null 2>&1 || :
+        /sbin/chkconfig --del shellinaboxd
+fi
+
+
+%postun
+if [ "$1" -ge "1" ]; then
+        /sbin/service shellinaboxd condrestart >/dev/null 2>&1 || :
+fi
+
+%endif
+
+
+%files
+%doc AUTHORS NEWS README README.Fedora GPL-2 COPYING
+%config(noreplace) %{_sysconfdir}/sysconfig/shellinaboxd
+%{_mandir}/man1/shellinaboxd.1.*
+%{_sbindir}/shellinaboxd
+%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
+%{_unitdir}/shellinaboxd.service
+%else
+%{_initrddir}/shellinaboxd
+%endif
+
+
+%changelog
+* Tue May 29 2012 Simone Caronni <negativo17 at gmail.com> - 2.14-3
+- Spec file changes (changelog, formatting).
+- Added license files to doc section.
+
+* Wed May 09 2012 Simone Caronni <negativo17 at gmail.com> - 2.14-2
+- Tags for RHEL building.
+
+* Wed May 09 2012 Simone Caronni <negativo17 at gmail.com> - 2.14-1
+- First build.
diff --git a/shellinaboxd.init b/shellinaboxd.init
new file mode 100644
index 0000000..9aa5c20
--- /dev/null
+++ b/shellinaboxd.init
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# shellinaboxd   This shell script takes care of starting and stopping
+#               shellinabox.
+#
+# chkconfig: - 80 20
+# description: Publish command line shell through AJAX interface.
+# processname: shellinaboxd
+# config: /etc/sysconfig/shellinaboxd
+# pidfile: /var/run/shellinaboxd.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+prog="shellinaboxd"
+
+# Source configuration.
+if [ -f /etc/sysconfig/$prog ] ; then
+        . /etc/sysconfig/$prog
+fi
+
+OPTS="$OPTS --background=/var/run/$prog.pid"
+
+start() {
+        [ "$EUID" != "0" ] && exit 4
+
+        echo -n "Starting $prog: "
+        daemon $prog $OPTS
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
+        return $RETVAL
+}
+
+stop() {
+        [ "$EUID" != "0" ] && exit 4
+
+        echo -n "Shutting down $prog: "
+        killproc $prog
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
+        return $RETVAL
+}
+
+rh_status() {
+    # run checks to determine if the service is running or use generic status
+    status $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+    start)
+                start
+                ;;
+    stop)
+                stop
+                ;;
+    status)
+		rh_status
+		;;
+    condrestart|try-restart)
+		rh_status_q || exit 0
+		restart
+		;;
+    restart|force-reload)
+                stop
+                start
+                ;;
+    *)
+        echo "Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|status}"
+        [ "$1" = "usage" ] && exit 0
+        exit 2
+        ;;
+esac
+exit $?
+
diff --git a/shellinaboxd.service b/shellinaboxd.service
new file mode 100644
index 0000000..1e934fb
--- /dev/null
+++ b/shellinaboxd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Shell In A Box daemon
+Requires=network.target
+After=network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/shellinaboxd
+ExecStart=/usr/sbin/shellinaboxd $OPTS
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/shellinaboxd.sysconfig b/shellinaboxd.sysconfig
new file mode 100644
index 0000000..dce83a8
--- /dev/null
+++ b/shellinaboxd.sysconfig
@@ -0,0 +1,4 @@
+# Shell in a box daemon configuration
+# For details see shellinaboxd man page
+
+OPTS="-s /:LOGIN"
diff --git a/sources b/sources
index e69de29..4f6ede7 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+6c63b52edcebc56ee73a108e7211d174  shellinabox-2.14.tar.gz


More information about the scm-commits mailing list