many: add stub implementation of snap-alter-ns #2643

Merged
merged 2 commits into from Jan 25, 2017
Jump to file or symbol
Failed to load files and symbols.
+115 −6
Split
View
@@ -10,19 +10,21 @@ vendor/*/
po/snappy.pot
# snap-confine bits
+*.a
+*.o
+*~
+.*.swp
+.*.swp
+.dirstamp
cmd/decode-mount-opts/decode-mount-opts
cmd/libsnap-confine-private/unit-tests
+cmd/snap-alter-ns/snap-alter-ns
cmd/snap-confine/snap-confine
cmd/snap-confine/snap-confine-unit-tests
cmd/snap-confine/snap-confine.apparmor
cmd/snap-discard-ns/snap-discard-ns
cmd/system-shutdown/system-shutdown
cmd/system-shutdown/system-shutdown-unit-tests
-.dirstamp
-*~
-.*.swp
-*.o
-*.a
# manual pages
cmd/*/*.[1-9]
View
@@ -6,7 +6,7 @@ dist_man_MANS =
noinst_PROGRAMS =
noinst_LIBRARIES =
-subdirs = snap-confine snap-discard-ns system-shutdown libsnap-confine-private
+subdirs = snap-confine snap-discard-ns system-shutdown libsnap-confine-private snap-alter-ns
# Run check-syntax when checking
# TODO: conver those to autotools-style tests later
@@ -325,3 +325,18 @@ system_shutdown_system_shutdown_unit_tests_LDADD = libsnap-confine-private.a
system_shutdown_system_shutdown_unit_tests_CFLAGS = $(GLIB_CFLAGS)
system_shutdown_system_shutdown_unit_tests_LDADD += $(GLIB_LIBS)
endif
+
+##
+## snap-alter-ns
+##
+
+libexec_PROGRAMS += snap-alter-ns/snap-alter-ns
+dist_man_MANS += snap-alter-ns/snap-alter-ns.5
+CLEANFILES += snap-alter-ns/snap-alter-ns.5
+EXTRA_DIST += snap-alter-ns/snap-alter-ns.rst
+
+snap_alter_ns_snap_alter_ns_LDADD = libsnap-confine-private.a
+
+snap-alter-ns/%.5: snap-alter-ns/%.rst
+ mkdir -p snap-alter-ns
+ $(HAVE_RST2MAN) $^ > $@
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2017 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+int main(int arch, char **argv)
+{
+ return 1;
+}
@@ -0,0 +1,65 @@
+===============
+ snap-alter-ns
+===============
+
+-----------------------------------------------------------------------
+internal tool for altering preserved namespaces of snappy applications
+-----------------------------------------------------------------------
+
+:Author: zygmunt.krynicki@canonical.com
+:Date: 2017-01-17
+:Copyright: Canonical Ltd.
+:Version: 2.22
+:Manual section: 5
+:Manual group: snappy
+
+SYNOPSIS
+========
+
+ snap-alter-ns SNAP_NAME
+
+DESCRIPTION
+===========
+
+The `snap-alter-ns` is a program used internally by `snapd` to alter a preserved
+mount namespace of a particular snap.
+
+OPTIONS
+=======
+
+The `snap-alter-ns` program does not support any options.
+
+ENVIRONMENT
+===========
+
+`snap-alter-ns` responds to the following environment variables
+
+`SNAP_CONFINE_DEBUG`:
+ When defined the program will print additional diagnostic information about
+ the actions being performed. All the output goes to stderr.
+
+FILES
+=====
+
+`snap-alter-ns` uses the following files:
+
+`/run/snapd/ns/$SNAP_NAME.mnt`:
+
+ The preserved mount namespace that is altered by `snap-alter-ns`.
+
+`/proc/self/mountinfo`:
+
+ Kernel representation of the mount table of the current process.
+
+`/var/lib/snapd/mount/$SNAP_NAME.fstab`:
+
+ Desired, persistent mount table for the given snap.
+
+`/run/snapd/ns/$SNAP_NAME.fstab`:
+
+ Current, ephemeral mount table for the gien snap.
+
+BUGS
+====
+
+Please report all bugs with https://bugs.launchpad.net/snap-confine/+filebug
@@ -3,5 +3,7 @@ lib/udev/rules.d/80-snappy-assign.rules
lib/udev/snappy-app-dev
usr/lib/snapd/snap-confine
usr/lib/snapd/snap-discard-ns
+usr/lib/snapd/snap-alter-ns
usr/share/man/man5/snap-confine.5
+usr/share/man/man5/snap-alter-ns.5
usr/share/man/man5/snap-discard-ns.5