summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-12 06:18:35 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-03-31 14:30:15 +0000
commit030fdd00abcece474ce2b2eb060f230738a944ec (patch)
tree79af69c0067bb5413d23431dc850e224e3fe36cc
parentAdding native ARM architecture support in container start command. (diff)
downloadcompute-tools-030fdd00abcece474ce2b2eb060f230738a944ec.tar.xz
compute-tools-030fdd00abcece474ce2b2eb060f230738a944ec.zip
Adding container-shell program.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rw-r--r--Makefile2
l---------bin/cntsh1
-rwxr-xr-xbin/container-shell93
-rw-r--r--share/man/container-shell.1.txt63
-rw-r--r--share/man/container.1.txt3
5 files changed, 162 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index dafd581..d934242 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,7 @@ install: build
done
ln -s container.1 $(DESTDIR)/usr/share/man/man1/cnt.1
+ ln -s container-shell.1 $(DESTDIR)/usr/share/man/man1/cntsh.1
uninstall:
for SECTION in $$(seq 1 8); \
@@ -89,6 +90,7 @@ uninstall:
done
rm -f $(DESTDIR)/usr/share/man/man1/cnt.1
+ rm -f $(DESTDIR)/usr/share/man/man1/cntsh.1
rm -rf $(DESTDIR)/usr/share/$(SOFTWARE)
rmdir --ignore-fail-on-non-empty --parents $(DESTDIR)/usr/share || true
diff --git a/bin/cntsh b/bin/cntsh
new file mode 120000
index 0000000..38c4486
--- /dev/null
+++ b/bin/cntsh
@@ -0,0 +1 @@
+container-shell \ No newline at end of file
diff --git a/bin/container-shell b/bin/container-shell
new file mode 100755
index 0000000..a25c5f0
--- /dev/null
+++ b/bin/container-shell
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# Open Infrastructure: container-tools
+# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+SOFTWARE="container-tools"
+PROGRAM="container"
+
+COMMAND="$(basename ${0})"
+
+Usage ()
+{
+ echo "Usage: ${PROGRAM}-shell" >&2
+ exit 1
+}
+
+Shell ()
+{
+ COMMAND="${1}"
+
+ if [ -z "${COMMAND}" ]
+ then
+ return
+ fi
+
+ shift 1
+
+ OPTIONS="${@}"
+
+ case "${COMMAND}" in
+ exit|logout|quit)
+ exit 0
+ ;;
+
+ help)
+ case "${OPTIONS}" in
+ "")
+ echo
+ echo "The following ${PROGRAM} commands are available:"
+
+ cd "/usr/lib/${SOFTWARE}/${PROGRAM}"
+ ls
+ cd "${OLDPWD}"
+
+ return
+ ;;
+
+ *)
+ man container-${1}
+
+ return
+ ;;
+ esac
+ ;;
+ esac
+
+ if [ ! -e "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" ]
+ then
+ echo "'${COMMAND}': no such ${PROGRAM} command" >&2
+ return
+ else
+ "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" "${OPTIONS}" || true
+ fi
+}
+
+trap 'echo' EXIT HUP INT QUIT TERM
+
+echo "${PROGRAM}-shell $(${PROGRAM} version)"
+echo "Type \"help\" for more information."
+
+while true
+do
+ echo
+ echo -n "${PROGRAM}: "
+ read CMDLINE
+
+ Shell ${CMDLINE}
+done
diff --git a/share/man/container-shell.1.txt b/share/man/container-shell.1.txt
new file mode 100644
index 0000000..0633b8d
--- /dev/null
+++ b/share/man/container-shell.1.txt
@@ -0,0 +1,63 @@
+// Open Infrastructure: container-tools
+// Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CONTAINER(1)
+============
+:doctype: manpage
+:man manual: Open Infrastructure
+:man source: container-tools
+:man version: {revnumber}
+
+
+NAME
+----
+container-shell - Manage systemd-nspawn Containers (shell)
+
+
+SYNOPSIS
+--------
+*container-shell*
+
+
+DESCRIPTION
+-----------
+container-tools provides the integration for Debian based Containers using systemd-nspawn.
+
+
+COMMANDS
+--------
+All container commands are available, see container(1).
+
+
+SEE ALSO
+--------
+machinectl(1),
+systemd-nspawn(1).
+
+
+HOMEPAGE
+--------
+More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net.
+
+
+BUGS
+----
+Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools.
+
+
+AUTHORS
+-------
+container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>.
diff --git a/share/man/container.1.txt b/share/man/container.1.txt
index 54e3145..1b26451 100644
--- a/share/man/container.1.txt
+++ b/share/man/container.1.txt
@@ -81,6 +81,9 @@ The following files are used:
*/usr/bin/container*, */usr/bin/cnt*::
Container program.
+*/usr/bin/container-shell*, */usr/bin/cntsh*::
+ Container shell program.
+
*/usr/lib/container-tools*::
Container commands.