pflask: rename --volatile option to --ephemeral
It just makes more sense.
This commit is contained in:
parent
d88cab0b31
commit
e0961d59b2
7 changed files with 16 additions and 16 deletions
|
|
@ -114,15 +114,15 @@ manpage for more information.
|
|||
|
||||
.. _`types of mount points`: https://ghedo.github.io/pflask/pflask.html#mount
|
||||
|
||||
Volatile root filesystem
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Ephemeral root filesystem
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Using the ``--volatile`` option it's possible to tell pflask to discard any
|
||||
Using the ``--ephemeral`` option it's possible to tell pflask to discard any
|
||||
change applied to the root filesystem once the container terminates:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sudo pflask --chroot=/path/to/rootfs --volatile -- /sbin/init
|
||||
$ sudo pflask --chroot=/path/to/rootfs --ephemeral -- /sbin/init
|
||||
|
||||
This can be used for example for a build environment, where dependencies can
|
||||
be installed at every run on a clean rootfs, without the need to recreate the
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ OPTIONS
|
|||
|
||||
Example: ``--user-map=0:100000,65536``
|
||||
|
||||
.. option:: -w, --volatile
|
||||
.. option:: -w, --ephemeral
|
||||
|
||||
Discard any change to / once the container exits. This can only be used
|
||||
along with ``--chroot`` and requires support for the overlay_ mount type.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ _arguments -C -S \
|
|||
{--user-map=,-e}'[Map container users to host users]:map' \
|
||||
{--chroot=,-r}'[Change the root directory inside the container]:directory:_directories' \
|
||||
{--chdir=,-c}'[Change the current directory inside the container]:directory' \
|
||||
{--volatile,-w}'[Discard changes to /]' \
|
||||
{--ephemeral,-w}'[Discard changes to /]' \
|
||||
{--cgroup=,-g}'[Create new cgroups and move the container inside them]:cgroup spec' \
|
||||
{--detach,-d}'[Detach from terminal]' \
|
||||
{--attach=,-a}'[Attach to the specified detached process]:PID' \
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void mount_add_from_spec(struct mount **mounts, const char *spec) {
|
|||
}
|
||||
}
|
||||
|
||||
void setup_mount(struct mount *mounts, const char *dest, bool is_volatile) {
|
||||
void setup_mount(struct mount *mounts, const char *dest, bool is_ephemeral) {
|
||||
int rc;
|
||||
|
||||
struct mount *sys_mounts = NULL;
|
||||
|
|
@ -174,13 +174,13 @@ void setup_mount(struct mount *mounts, const char *dest, bool is_volatile) {
|
|||
|
||||
_free_ char *procsys_dir = NULL;
|
||||
|
||||
char template[] = "/tmp/pflask-volatile-XXXXXX";
|
||||
char template[] = "/tmp/pflask-ephemeral-XXXXXX";
|
||||
|
||||
rc = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL);
|
||||
if (rc < 0) sysf_printf("mount(MS_SLAVE)");
|
||||
|
||||
if (dest != NULL) {
|
||||
if (is_volatile) {
|
||||
if (is_ephemeral) {
|
||||
if (!mkdtemp(template))
|
||||
sysf_printf("mkdtemp()");
|
||||
|
||||
|
|
|
|||
|
|
@ -35,4 +35,4 @@ void mount_add(struct mount **mounts, const char *src, const char *dst,
|
|||
|
||||
void mount_add_from_spec(struct mount **mounts, const char *spec);
|
||||
|
||||
void setup_mount(struct mount *mounts, const char *dest, bool is_volatile);
|
||||
void setup_mount(struct mount *mounts, const char *dest, bool is_ephemeral);
|
||||
|
|
|
|||
10
src/pflask.c
10
src/pflask.c
|
|
@ -63,7 +63,7 @@ static struct option long_opts[] = {
|
|||
{ "user", required_argument, NULL, 'u' },
|
||||
{ "user-map", required_argument, NULL, 'e' },
|
||||
{ "chroot", required_argument, NULL, 'r' },
|
||||
{ "volatile", no_argument, NULL, 'w' },
|
||||
{ "ephemeral", no_argument, NULL, 'w' },
|
||||
{ "chdir", required_argument, NULL, 'c' },
|
||||
{ "cgroup", required_argument, NULL, 'g' },
|
||||
{ "detach", no_argument, NULL, 'd' },
|
||||
|
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
bool detach = false;
|
||||
bool keepenv = false;
|
||||
bool is_volatile = false;
|
||||
bool is_ephemeral = false;
|
||||
|
||||
siginfo_t status;
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
|
||||
case 'w':
|
||||
is_volatile = 1;
|
||||
is_ephemeral = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
|
|
@ -321,7 +321,7 @@ int main(int argc, char *argv[]) {
|
|||
if (rc < 0) sysf_printf("sethostname()");
|
||||
}
|
||||
|
||||
setup_mount(mounts, dest, is_volatile);
|
||||
setup_mount(mounts, dest, is_ephemeral);
|
||||
|
||||
if (dest != NULL) {
|
||||
setup_nodes(dest);
|
||||
|
|
@ -523,7 +523,7 @@ static inline void help(void) {
|
|||
CMD_HELP("--user", "-u", "Run the command under the specified user");
|
||||
CMD_HELP("--user-map", "-e", "Map container users to host users");
|
||||
|
||||
CMD_HELP("--volatile", "-w", "Discard changes to /");
|
||||
CMD_HELP("--ephemeral", "-w", "Discard changes to /");
|
||||
|
||||
CMD_HELP("--cgroup", "-g",
|
||||
"Create a new cgroup and move the container inside it");
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ elif [ "$1" = "--update" ]; then
|
|||
-- \
|
||||
sh -c "$APT_TOOL update && $APT_TOOL dist-upgrade && $APT_TOOL autoremove --purge && $APT_TOOL autoclean"
|
||||
else
|
||||
$PFLASK_TOOL --keepenv --chroot $BASEDIR --volatile \
|
||||
$PFLASK_TOOL --keepenv --chroot $BASEDIR --ephemeral \
|
||||
--mount "bind,$RESDIR,$TMPDIR" \
|
||||
--chdir "/mnt/$PKGDIR" \
|
||||
-- \
|
||||
|
|
|
|||
Loading…
Reference in a new issue