]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
2 years agotree-wide: use __u32 for capabilities
Christian Brauner [Wed, 13 Oct 2021 16:51:48 +0000 (18:51 +0200)]
tree-wide: use __u32 for capabilities

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agocgroups: use __u32 for cpumasks
Christian Brauner [Wed, 13 Oct 2021 16:30:00 +0000 (18:30 +0200)]
cgroups: use __u32 for cpumasks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3994 from brauner/2021-10-12.fixes
Stéphane Graber [Wed, 13 Oct 2021 13:25:59 +0000 (09:25 -0400)]
Merge pull request #3994 from brauner/2021-10-12.fixes

conf: improve and fix lxc.cap.keep

2 years agoconf: improve capability handling
Christian Brauner [Wed, 13 Oct 2021 11:38:14 +0000 (13:38 +0200)]
conf: improve capability handling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotests: add test for lxc.cap.keep
Christian Brauner [Tue, 12 Oct 2021 14:48:02 +0000 (16:48 +0200)]
tests: add test for lxc.cap.keep

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoconf: fix lxc.cap.keep behavior
Christian Brauner [Tue, 12 Oct 2021 14:33:14 +0000 (16:33 +0200)]
conf: fix lxc.cap.keep behavior

Fixes: ##3993
Fixes: 20ab75789eb9 ("conf: simplify and port caps to new list type")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3992 from brauner/2021-10-11.fixes
Stéphane Graber [Mon, 11 Oct 2021 14:30:46 +0000 (10:30 -0400)]
Merge pull request #3992 from brauner/2021-10-11.fixes

terminal: log at warning message

2 years agoterminal: log at warning message
Christian Brauner [Mon, 11 Oct 2021 13:21:45 +0000 (15:21 +0200)]
terminal: log at warning message

The lxc_devpts_terminal() helper is called in contexts where it can fail
due to various reasons but where we safely fallback to allocating
terminal devices on the host. Logging error messages irritates users so
just log warning messages.

Link: https://discuss.linuxcontainers.org/t/lxc-attach-error-failed-to-open-terminal-multiplexer-device
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3988 from brauner/2021-10-04.fixes
Stéphane Graber [Mon, 4 Oct 2021 13:14:18 +0000 (09:14 -0400)]
Merge pull request #3988 from brauner/2021-10-04.fixes

log: improve %m handling on musl

2 years agolog: improve %m handling on musl
Christian Brauner [Mon, 4 Oct 2021 09:23:55 +0000 (11:23 +0200)]
log: improve %m handling on musl

Fixes: #3961
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3987 from brauner/2021-10-01.fixes
Stéphane Graber [Fri, 1 Oct 2021 14:33:23 +0000 (10:33 -0400)]
Merge pull request #3987 from brauner/2021-10-01.fixes

start: make failure to apply core scheduling fatal

2 years agostart: make failure to apply core scheduling fatal
Christian Brauner [Fri, 1 Oct 2021 08:27:04 +0000 (10:27 +0200)]
start: make failure to apply core scheduling fatal

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3986 from brauner/2021-10-01.fixes
Stéphane Graber [Fri, 1 Oct 2021 12:52:01 +0000 (08:52 -0400)]
Merge pull request #3986 from brauner/2021-10-01.fixes

lxc: core scheduling tweaks

2 years agostart: use core scheduling error helper
Christian Brauner [Fri, 1 Oct 2021 08:14:08 +0000 (10:14 +0200)]
start: use core scheduling error helper

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agostart: don't fail when core scheduling isn't supported
Christian Brauner [Fri, 1 Oct 2021 08:12:43 +0000 (10:12 +0200)]
start: don't fail when core scheduling isn't supported

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agosyscall_wrappers: fix core scheduling creation helper naming
Christian Brauner [Fri, 1 Oct 2021 08:12:17 +0000 (10:12 +0200)]
syscall_wrappers: fix core scheduling creation helper naming

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3985 from brauner/2021-09-30.fixes.2
Stéphane Graber [Thu, 30 Sep 2021 21:17:07 +0000 (17:17 -0400)]
Merge pull request #3985 from brauner/2021-09-30.fixes.2

tree-wide: cast to core scheduling cookie to llu

2 years agotree-wide: cast to core scheduling cookie to llu
Christian Brauner [Thu, 30 Sep 2021 20:48:04 +0000 (22:48 +0200)]
tree-wide: cast to core scheduling cookie to llu

Link: https://launchpadlibrarian.net/561086365/buildlog_ubuntu-focal-ppc64el.lxc_1%3A4.0.10+master~20210930-1812-0ubuntu1~focal_BUILDING.txt.gz
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3984 from brauner/2021-09-29.core_scheduling
Stéphane Graber [Thu, 30 Sep 2021 17:56:25 +0000 (13:56 -0400)]
Merge pull request #3984 from brauner/2021-09-29.core_scheduling

lxc: core scheduling support

2 years agoattach: handle core scheduling
Christian Brauner [Wed, 29 Sep 2021 12:35:41 +0000 (14:35 +0200)]
attach: handle core scheduling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3983 from brauner/2021-09-29.fixes
Stéphane Graber [Wed, 29 Sep 2021 16:45:09 +0000 (12:45 -0400)]
Merge pull request #3983 from brauner/2021-09-29.fixes

build: compiler attribute improvements

2 years agolxc: add lxc.sched.core
Christian Brauner [Wed, 29 Sep 2021 11:16:26 +0000 (13:16 +0200)]
lxc: add lxc.sched.core

Core scheduling defines if the container payload is marked as being
schedulable on the same core. Doing so will cause the kernel scheduler
to ensure that tasks that are not in the same group never run
simultaneously on a core. This can serve as an extra security measure to
prevent the container payload from using cross hyper thread attacks.

The only allowed values are 0 and 1. Set this to 1 to create a core
scheduling domain for the container or 0 to not create one. If not set
explicitly no core scheduling domain will be created for the container.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoinitutils: add missing prctl include
Christian Brauner [Wed, 29 Sep 2021 11:16:05 +0000 (13:16 +0200)]
initutils: add missing prctl include

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: compiler attribute improvements
Christian Brauner [Wed, 29 Sep 2021 08:02:39 +0000 (10:02 +0200)]
build: compiler attribute improvements

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3982 from stgraber/master
Christian Brauner [Tue, 28 Sep 2021 21:09:44 +0000 (23:09 +0200)]
Merge pull request #3982 from stgraber/master

github: Drop 16.04 tests

2 years agoMerge pull request #3981 from brauner/2021-09-28.fixes
Stéphane Graber [Tue, 28 Sep 2021 20:58:59 +0000 (16:58 -0400)]
Merge pull request #3981 from brauner/2021-09-28.fixes

build: check whether compiler supports nonnull and returns_nonnull at…

2 years agogithub: Drop 16.04 tests
Stéphane Graber [Tue, 28 Sep 2021 20:58:44 +0000 (16:58 -0400)]
github: Drop 16.04 tests

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agobuild: check whether compiler supports nonnull and returns_nonnull attributes
Christian Brauner [Tue, 28 Sep 2021 09:49:26 +0000 (11:49 +0200)]
build: check whether compiler supports nonnull and returns_nonnull attributes

Fixes: #3980
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3979 from brauner/2021-09-27.fixes
Stéphane Graber [Mon, 27 Sep 2021 13:39:39 +0000 (09:39 -0400)]
Merge pull request #3979 from brauner/2021-09-27.fixes

build: add commands, hooks, and templates

2 years agohooks: fix quoting
Christian Brauner [Mon, 27 Sep 2021 10:46:29 +0000 (12:46 +0200)]
hooks: fix quoting

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotemplates: don't double quote
Christian Brauner [Mon, 27 Sep 2021 10:42:22 +0000 (12:42 +0200)]
templates: don't double quote

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add templates
Christian Brauner [Mon, 27 Sep 2021 10:39:10 +0000 (12:39 +0200)]
build: add templates

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: fix remaining HAVE_* generations
Christian Brauner [Mon, 27 Sep 2021 10:22:12 +0000 (12:22 +0200)]
build: fix remaining HAVE_* generations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotree-wide: fix HAVE_* checks
Christian Brauner [Mon, 27 Sep 2021 10:15:05 +0000 (12:15 +0200)]
tree-wide: fix HAVE_* checks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agocmds: fix includes
Christian Brauner [Mon, 27 Sep 2021 10:09:17 +0000 (12:09 +0200)]
cmds: fix includes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agocmds: fix integer conversions
Christian Brauner [Mon, 27 Sep 2021 10:04:34 +0000 (12:04 +0200)]
cmds: fix integer conversions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxc-monitord: use {} around ;
Christian Brauner [Mon, 27 Sep 2021 10:03:20 +0000 (12:03 +0200)]
lxc-monitord: use {} around ;

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add cmd builds
Christian Brauner [Mon, 27 Sep 2021 09:42:58 +0000 (11:42 +0200)]
build: add cmd builds

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add hooks
Christian Brauner [Mon, 27 Sep 2021 09:06:50 +0000 (11:06 +0200)]
build: add hooks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: build hooks directly in their folder
Christian Brauner [Mon, 27 Sep 2021 08:48:29 +0000 (10:48 +0200)]
build: build hooks directly in their folder

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3978 from brauner/2021-09-23.fixes
Stéphane Graber [Thu, 23 Sep 2021 21:14:05 +0000 (17:14 -0400)]
Merge pull request #3978 from brauner/2021-09-23.fixes

build: improve meson build

2 years agobuild: improve meson build
Christian Brauner [Thu, 23 Sep 2021 12:05:24 +0000 (14:05 +0200)]
build: improve meson build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3977 from brauner/2021-09-16.fixes
Stéphane Graber [Thu, 16 Sep 2021 14:45:44 +0000 (10:45 -0400)]
Merge pull request #3977 from brauner/2021-09-16.fixes

build: fixes

2 years agobuild: use dummy config data
Christian Brauner [Thu, 16 Sep 2021 14:04:33 +0000 (16:04 +0200)]
build: use dummy config data

to avoid having to rely on newer meson features.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: expand default_options
Christian Brauner [Thu, 16 Sep 2021 13:59:49 +0000 (15:59 +0200)]
build: expand default_options

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add commands
Christian Brauner [Thu, 16 Sep 2021 13:20:13 +0000 (15:20 +0200)]
build: add commands

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: split netns_ifaddrs into separate sources
Christian Brauner [Thu, 16 Sep 2021 13:19:53 +0000 (15:19 +0200)]
build: split netns_ifaddrs into separate sources

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agohooks: use cloexec everywhere
Christian Brauner [Thu, 16 Sep 2021 12:10:56 +0000 (14:10 +0200)]
hooks: use cloexec everywhere

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: fix tools build
Christian Brauner [Thu, 16 Sep 2021 08:54:02 +0000 (10:54 +0200)]
build: fix tools build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: fix hook program build
Christian Brauner [Thu, 16 Sep 2021 08:48:25 +0000 (10:48 +0200)]
build: fix hook program build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3976 from stgraber/master
Stéphane Graber [Thu, 16 Sep 2021 03:43:52 +0000 (23:43 -0400)]
Merge pull request #3976 from stgraber/master

Don't include internal headers in external library headers

2 years agoDon't include internal headers in external library headers
Stéphane Graber [Thu, 16 Sep 2021 03:05:47 +0000 (23:05 -0400)]
Don't include internal headers in external library headers

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #3974 from brauner/2021-09-15.fixes.2
Stéphane Graber [Wed, 15 Sep 2021 19:15:41 +0000 (15:15 -0400)]
Merge pull request #3974 from brauner/2021-09-15.fixes.2

tools: use correct include for Android

2 years agotools: use correct include for Android
Christian Brauner [Wed, 15 Sep 2021 18:26:11 +0000 (20:26 +0200)]
tools: use correct include for Android

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3972 from brauner/2021-09-15.fixes
Stéphane Graber [Wed, 15 Sep 2021 14:15:53 +0000 (10:15 -0400)]
Merge pull request #3972 from brauner/2021-09-15.fixes

build: ensure all relevant calls are checked for availability at buil…

2 years agobuild: support lto
Christian Brauner [Wed, 15 Sep 2021 08:42:04 +0000 (10:42 +0200)]
build: support lto

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agocgroups: fix declarations and headers
Christian Brauner [Wed, 15 Sep 2021 08:28:50 +0000 (10:28 +0200)]
cgroups: fix declarations and headers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agonetwork: fix integer comparisons
Christian Brauner [Wed, 15 Sep 2021 08:12:41 +0000 (10:12 +0200)]
network: fix integer comparisons

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: ensure all relevant calls are checked for availability at build time
Christian Brauner [Wed, 15 Sep 2021 07:07:51 +0000 (09:07 +0200)]
build: ensure all relevant calls are checked for availability at build time

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3966 from denisfa/improve-bash-completion-ext
Stéphane Graber [Wed, 15 Sep 2021 03:33:57 +0000 (23:33 -0400)]
Merge pull request #3966 from denisfa/improve-bash-completion-ext

Improve bash completion - part 2.

2 years agoMerge pull request #3963 from brauner/2021-09-03.build
Stéphane Graber [Wed, 15 Sep 2021 02:41:55 +0000 (22:41 -0400)]
Merge pull request #3963 from brauner/2021-09-03.build

build: add basic meson support

2 years agobuild: show more detailed information
Christian Brauner [Tue, 14 Sep 2021 09:01:59 +0000 (11:01 +0200)]
build: show more detailed information

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: record meson version
Christian Brauner [Tue, 14 Sep 2021 08:34:05 +0000 (10:34 +0200)]
build: record meson version

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: use correct minimal meson version requirement
Christian Brauner [Tue, 14 Sep 2021 08:23:37 +0000 (10:23 +0200)]
build: use correct minimal meson version requirement

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: remove pointless prefixdir validation
Christian Brauner [Tue, 14 Sep 2021 08:03:12 +0000 (10:03 +0200)]
build: remove pointless prefixdir validation

Meson will handle this internall and treat a non-absolute path as an
error.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #3968 from brauner/2021-09-03.fixes.2
Stéphane Graber [Mon, 13 Sep 2021 12:41:41 +0000 (08:41 -0400)]
Merge pull request #3968 from brauner/2021-09-03.fixes.2

tests: fix config file tests

2 years agoMerge pull request #3967 from brauner/2021-09-03.fixes
Stéphane Graber [Mon, 13 Sep 2021 12:37:25 +0000 (08:37 -0400)]
Merge pull request #3967 from brauner/2021-09-03.fixes

log: fix cross-compilation with %m modifier

2 years agotests: fix config file tests
Christian Brauner [Mon, 13 Sep 2021 11:55:17 +0000 (13:55 +0200)]
tests: fix config file tests

Link: https://bugs.launchpad.net/bugs/1943441
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolog: fix cross-compilation with %m modifier
Christian Brauner [Mon, 13 Sep 2021 10:29:22 +0000 (12:29 +0200)]
log: fix cross-compilation with %m modifier

Fixes: #3961
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: set more variables and print summary
Christian Brauner [Mon, 13 Sep 2021 09:21:23 +0000 (11:21 +0200)]
build: set more variables and print summary

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add more global config variables
Christian Brauner [Mon, 13 Sep 2021 09:03:34 +0000 (11:03 +0200)]
build: add more global config variables

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: set diagnostic colours directly in default_options
Christian Brauner [Mon, 13 Sep 2021 08:15:01 +0000 (10:15 +0200)]
build: set diagnostic colours directly in default_options

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: add single option directly to static library
Christian Brauner [Mon, 13 Sep 2021 08:14:45 +0000 (10:14 +0200)]
build: add single option directly to static library

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: remove unneeded variables
Christian Brauner [Mon, 13 Sep 2021 08:09:45 +0000 (10:09 +0200)]
build: remove unneeded variables

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: use common dependencies variable
Christian Brauner [Mon, 13 Sep 2021 08:05:48 +0000 (10:05 +0200)]
build: use common dependencies variable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: libdir and bindir are the default for shared libraries and executables
Christian Brauner [Mon, 13 Sep 2021 08:01:46 +0000 (10:01 +0200)]
build: libdir and bindir are the default for shared libraries and executables

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: set find_library('libcap', require : false)
Christian Brauner [Mon, 13 Sep 2021 07:58:44 +0000 (09:58 +0200)]
build: set find_library('libcap', require : false)

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: -fPIC and -shared are handled automatically
Christian Brauner [Mon, 13 Sep 2021 07:57:53 +0000 (09:57 +0200)]
build: -fPIC and -shared are handled automatically

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: use dependency() where possible
Christian Brauner [Mon, 13 Sep 2021 07:54:17 +0000 (09:54 +0200)]
build: use dependency() where possible

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: set as-needed in default_options
Christian Brauner [Mon, 13 Sep 2021 07:44:32 +0000 (09:44 +0200)]
build: set as-needed in default_options

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: set pie in default_options
Christian Brauner [Mon, 13 Sep 2021 07:43:29 +0000 (09:43 +0200)]
build: set pie in default_options

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoFix `lxc-cgroup` smart completion.
Edênis Freindorfer Azevedo [Wed, 8 Sep 2021 13:40:49 +0000 (10:40 -0300)]
Fix `lxc-cgroup` smart completion.

Also make bash function more readable for itself.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoRefactor ` __lxc_check_name_present()`.
Edênis Freindorfer Azevedo [Tue, 7 Sep 2021 13:19:46 +0000 (10:19 -0300)]
Refactor ` __lxc_check_name_present()`.

Print name of container found, if any.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoCheck completion for prefixes names.
Edênis Freindorfer Azevedo [Mon, 6 Sep 2021 20:42:23 +0000 (17:42 -0300)]
Check completion for prefixes names.

If a name is a prefix of another word available for completion, adjust
to show all words with given prefix.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd `__lxc_cgroup_state_object()`.
Edênis Freindorfer Azevedo [Fri, 3 Sep 2021 13:54:24 +0000 (10:54 -0300)]
Add `__lxc_cgroup_state_object()`.

Support cgroup state-object completion values for `lxc-cgroup`.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoUpdate `_lxc_usernsexec`.
Edênis Freindorfer Azevedo [Fri, 3 Sep 2021 13:01:45 +0000 (10:01 -0300)]
Update `_lxc_usernsexec`.

Not really much can be done for this function, as `-m` requires an ID
mapping that has to be manually input, since it will use
`/etc/sub{g,u}id` if not specified.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd completion for `lxc-copy` param `--fssize`.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 17:03:55 +0000 (14:03 -0300)]
Add completion for `lxc-copy` param `--fssize`.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd `__lxc_get_selinux_contexts()`.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 15:45:51 +0000 (12:45 -0300)]
Add `__lxc_get_selinux_contexts()`.

List SElinux contexts available. Not clear if this could be only for
root or if normal user with `sudo` is also supported.

Using `Fedora34` for basic testing.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoRefactor `__lxc_groups()` to `__lxc_get_groups()`.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 13:21:38 +0000 (10:21 -0300)]
Refactor `__lxc_groups()` to `__lxc_get_groups()`.

Make code logic be more clear to what it is being done.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAnother round of more bash-like syntax.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 11:19:48 +0000 (08:19 -0300)]
Another round of more bash-like syntax.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoFix `lxc-create` completion.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 10:52:03 +0000 (07:52 -0300)]
Fix `lxc-create` completion.

Do not append a name of an existing container.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd support for comma as a completion word.
Edênis Freindorfer Azevedo [Tue, 31 Aug 2021 10:29:01 +0000 (07:29 -0300)]
Add support for comma as a completion word.

For `lxc-ls --groups` and `lxc-autostart --groups`.
Support leading comma, trailing comma, embedded double comma.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoRefactor `__lxc_piped_args`.
Edênis Freindorfer Azevedo [Mon, 30 Aug 2021 22:47:58 +0000 (19:47 -0300)]
Refactor `__lxc_piped_args`.

Use bash functions for common array operations. Keep code logic somewhat
easy to read for bug hunting.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoFix `lxc-snapshot` completion.
Edênis Freindorfer Azevedo [Mon, 30 Aug 2021 18:34:06 +0000 (15:34 -0300)]
Fix `lxc-snapshot` completion.

For options `-r,--restore` and `-d,--destroy`, we need the container
name to create the list of completion values.

Therefore, it is needed to scan the current command line to check if
there is a container name available.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoUse more bash-like syntax.
Edênis Freindorfer Azevedo [Mon, 30 Aug 2021 13:50:52 +0000 (10:50 -0300)]
Use more bash-like syntax.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd support for container composed names.
Edênis Freindorfer Azevedo [Mon, 30 Aug 2021 13:33:35 +0000 (10:33 -0300)]
Add support for container composed names.

When a container name has whitespace in it
(e.g. created by `lxc-create -t download -n "arch linux"` ),
the completion for other commands should be able to work by adding a
backslash to escape it.

Although it may be interesting to support names between quotes, this
would probably means to have to add quotes to all names. Might not be
interesting just due to an edge case.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd completion output for `lxc-ls --fancy-format`.
Edênis Freindorfer Azevedo [Sat, 28 Aug 2021 17:59:57 +0000 (14:59 -0300)]
Add completion output for `lxc-ls --fancy-format`.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoImprove name completion handling.
Edênis Freindorfer Azevedo [Fri, 27 Aug 2021 20:24:24 +0000 (17:24 -0300)]
Improve name completion handling.

Use regex to handle short option `-n`, since short options can be
combined (e.g. `-nd`) as long as at max one requires an argument.

Also consider the case when the arg for the long option is not given
together with `--name=`.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoAdd `compopt` call to `__lxc_piped_args`.
Edênis Freindorfer Azevedo [Fri, 27 Aug 2021 12:11:42 +0000 (09:11 -0300)]
Add `compopt` call to `__lxc_piped_args`.

On pair with how other functions do it. Also, be smarter about adding
whitespace when there are no more completions available for the
parameter.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
2 years agoUse `--running` instead of `--active`.
Edênis Freindorfer Azevedo [Fri, 27 Aug 2021 11:48:38 +0000 (08:48 -0300)]
Use `--running` instead of `--active`.

Commands block if container is frozen.

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>