diff --git a/hooks/dhclient-script b/hooks/dhclient-script old mode 100644 new mode 100755 diff --git a/hooks/meson.build b/hooks/meson.build new file mode 100644 index 000000000..a3e45116a --- /dev/null +++ b/hooks/meson.build @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +hooks_include_directories = include_directories( + '../', + '../src/include') + +hooks_unmount_namespace_sources = files('unmount-namespace.c') + +hook_programs += executable( + 'unmount-namespace', + hooks_unmount_namespace_sources, + include_directories : hooks_include_directories, + install : true, + install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'clonehostname', + output : 'clonehostname') +install_data(join_paths(project_build_root, 'hooks/clonehostname'), install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'dhclient-script', + output : 'dhclient-script') +install_data(join_paths(project_build_root, 'hooks/dhclient-script'), install_dir : lxchookdir) + +dhclient_config_data = configuration_data() +dhclient_config_data.set_quoted('LXCHOOKDIR', lxchookdir) +dhclient_config_data.set_quoted('SYSCONFDIR', sysconfdir) + +hook_programs = configure_file( + configuration : dhclient_config_data, + input : 'dhclient.in', + output : 'dhclient') +install_data(join_paths(project_build_root, 'hooks/dhclient'), install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'mountecryptfsroot', + output : 'mountecryptfsroot') +install_data(join_paths(project_build_root, 'hooks/mountecryptfsroot'), install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'nvidia', + output : 'nvidia') +install_data(join_paths(project_build_root, 'hooks/nvidia'), install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'squid-deb-proxy-client', + output : 'squid-deb-proxy-client') +install_data(join_paths(project_build_root, 'hooks/squid-deb-proxy-client'), install_dir : lxchookdir) + +hook_programs = configure_file( + configuration : dummy_config_data, + input : 'ubuntu-cloud-prep', + output : 'ubuntu-cloud-prep') +install_data(join_paths(project_build_root, 'hooks/ubuntu-cloud-prep'), install_dir : lxchookdir) diff --git a/meson.build b/meson.build index ab1885bcc..0ef787196 100644 --- a/meson.build +++ b/meson.build @@ -22,6 +22,7 @@ conf = configuration_data() conf.set_quoted('PROJECT_URL', 'https://linuxcontainers.org/lxc/introduction/') conf.set('PROJECT_VERSION', meson.project_version(), description : 'Numerical project version (used where a simple number is expected)') +conf.set('PACKAGE_VERSION', meson.project_version()) conf.set('_GNU_SOURCE', true) conf.set('__STDC_FORMAT_MACROS', true) @@ -103,8 +104,15 @@ conf.set_quoted('LXCHOOKDIR', lxchookdir) lxchookbindir = join_paths(libexecdir, 'lxc/hooks') conf.set_quoted('LXCBINHOOKDIR', lxchookbindir) +user_network_conf_opt = get_option('user-network-conf') +lxc_user_network_conf = join_paths(sysconfdir, user_network_conf_opt) +conf.set_quoted('LXC_USERNIC_CONF', lxc_user_network_conf) + +user_network_db_opt = get_option('user-network-db') +lxc_user_network_db = join_paths(runtimepath, user_network_db_opt) +conf.set_quoted('LXC_USERNIC_DB', lxc_user_network_db) + # AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date --utc --date=@${SOURCE_DATE_EPOCH:-$(date +%s)} '+%Y-%m-%d')") -# AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf") # AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db") # AS_AC_EXPAND(LXC_DISTRO_SYSCONF, "$distrosysconf") @@ -198,6 +206,8 @@ foreach decl : [ # We get -1 if the size cannot be determined if cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 conf.set10('HAVE_' + decl.underscorify().to_upper(), true) + else + conf.set10('HAVE_' + decl.underscorify().to_upper(), false) endif endforeach @@ -282,17 +292,20 @@ conf.set('TIME_EPOCH', time_epoch) threads = dependency('threads') libseccomp = dependency('libseccomp') +conf.set10('HAVE_SECCOMP', libseccomp.found()) if libseccomp.found() - conf.set10('HAVE_SECCOMP', libseccomp.found()) - if libseccomp.version().version_compare('>=2.5.0') # https://github.com/seccomp/libseccomp/commit/dead12bc788b259b148cc4d93b970ef0bd602b1a conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true) + else + conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', false) endif if libseccomp.version().version_compare('>=2.0.0') # https://github.com/seccomp/libseccomp/commit/6220c8c0fc479d97b6d3e3166a4e46fbfe25a3c0 conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true) + else + conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', false) endif seccomp_headers = ''' @@ -307,44 +320,34 @@ if libseccomp.found() # We get -1 if the size cannot be determined if cc.sizeof(decl, prefix : seccomp_headers, args : '-D_GNU_SOURCE') > 0 conf.set10('HAVE_' + decl.underscorify().to_upper(), true) + else + conf.set10('HAVE_' + decl.underscorify().to_upper(), false) endif endforeach endif libselinux = dependency('libselinux', required : false) -if libselinux.found() - conf.set10('HAVE_SELINUX', libselinux.found()) -endif +conf.set10('HAVE_SELINUX', libselinux.found()) libapparmor = dependency('libapparmor', required : false) -if libapparmor.found() - conf.set10('HAVE_APPARMOR', libapparmor.found()) -endif +conf.set10('HAVE_APPARMOR', libapparmor.found()) libopenssl = dependency('openssl', required : false) -if libopenssl.found() - conf.set10('HAVE_OPENSSL', libopenssl.found()) -endif +conf.set10('HAVE_OPENSSL', libopenssl.found()) libcap = dependency('libcap', required : false) if not libcap.found() # Compat with Ubuntu 14.04 which ships libcap w/o .pc file libcap = cc.find_library('cap', required : false) endif - -if libcap.found() - conf.set10('HAVE_LIBCAP', libcap.found()) -endif +conf.set10('HAVE_LIBCAP', libcap.found()) libcap_static = dependency('libcap', required : false, static : true) if not libcap_static.found() # Compat with Ubuntu 14.04 which ships libcap w/o .pc file libcap_static = cc.find_library('cap', required : false, static : true) endif - -if libcap_static.found() - conf.set10('HAVE_STATIC_LIBCAP', libcap_static.found()) -endif +conf.set10('HAVE_STATIC_LIBCAP', libcap_static.found()) have = cc.has_function('strchrnul', prefix : '#include ', args : '-D_GNU_SOURCE') conf.set10('HAVE_STRCHRNUL', have) @@ -370,7 +373,6 @@ liblxc_includes = [basic_includes, include_directories( subdir('src/include') subdir('src/lxc/tools/include') -subdir('hooks') subdir('src/lxc') liblxc = shared_library( @@ -397,38 +399,21 @@ liblxc_dep = declare_dependency( libselinux, libapparmor]) +dummy_config_data = configuration_data() +dummy_config_data.set_quoted('DUMMY_VARIABLE', '1') + +hook_programs = [] +subdir('hooks') + +template_scripts = [] +subdir('templates') + cmd_programs = [] subdir('src/lxc/cmd') public_programs = [] subdir('src/lxc/tools') -cmd_programs += executable( - 'lxc-init', - cmd_lxc_init_sources, - include_directories: cmd_liblxc_includes, - dependencies : liblxc_dep, - install : true) - -cmd_programs += executable( - 'init.lxc.static', - cmd_lxc_init_sources, - include_directories: cmd_liblxc_includes, - link_with : [liblxc_static], - link_args : ['-static'], - c_args : ['-DNO_LXC_CONF'], - dependencies : [libcap_static], - install : true) - -hook_programs = [] - -hook_programs += executable( - 'unmount-namespace', - hooks_unmount_namespace_sources, - include_directories : hooks_include_directories, - install : true, - install_dir : lxchookdir) - found_syscalls = [] missing_syscalls = [] @@ -593,7 +578,9 @@ status = [ 'log path: @0@'.format(lxclogpath), 'lxc path: @0@'.format(lxcpath), 'lxc template config: @0@'.format(lxctemplateconfig), - 'lxc template directory: @0@'.format(lxctemplatedir)] + 'lxc template directory: @0@'.format(lxctemplatedir), + 'lxc user network config: @0@'.format(lxc_user_network_conf), + 'lxc user network database: @0@'.format(lxc_user_network_db)] alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch)).stdout().strip() diff --git a/meson_options.txt b/meson_options.txt index bab30ec6b..0989055df 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -30,3 +30,9 @@ option('global-config', type : 'string', value : 'lxc/lxc.conf', option('docdir', type : 'string', description : 'documentation directory') + +option('user-network-conf', type : 'string', value : 'lxc/lxc-usernet', + description : 'user network interface configuration file') + +option('user-network-db', type : 'string', value : 'lxc/nics', + description : 'user network database') diff --git a/src/lxc/cmd/lxc_init.c b/src/lxc/cmd/lxc_init.c index 6491e2406..e21e72654 100644 --- a/src/lxc/cmd/lxc_init.c +++ b/src/lxc/cmd/lxc_init.c @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +#include "config.h" + #include #include #include @@ -20,7 +19,6 @@ #include "version.h" #include "compiler.h" -#include "config.h" #include "initutils.h" #include "memory_utils.h" #include "parse.h" diff --git a/src/lxc/cmd/lxc_monitord.c b/src/lxc/cmd/lxc_monitord.c index 8f3ef023f..a194fbea8 100644 --- a/src/lxc/cmd/lxc_monitord.c +++ b/src/lxc/cmd/lxc_monitord.c @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +#include "config.h" + #include #include #include @@ -24,7 +23,6 @@ #include "lxc.h" #include "af_unix.h" -#include "config.h" #include "log.h" #include "mainloop.h" #include "monitor.h" @@ -409,8 +407,9 @@ int main(int argc, char *argv[]) * if-empty-statement construct is to quiet the * warn-unused-result warning. */ - if (lxc_write_nointr(pipefd, "S", 1)) + if (lxc_write_nointr(pipefd, "S", 1)) { ; + } close(pipefd); } diff --git a/src/lxc/cmd/lxc_user_nic.c b/src/lxc/cmd/lxc_user_nic.c index 16ee4651d..83e79cd1e 100644 --- a/src/lxc/cmd/lxc_user_nic.c +++ b/src/lxc/cmd/lxc_user_nic.c @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +#include "config.h" + #include #include #include @@ -30,7 +29,6 @@ #include #include "compiler.h" -#include "config.h" #include "file_utils.h" #include "log.h" #include "memory_utils.h" @@ -42,7 +40,7 @@ #include "syscall_wrappers.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif @@ -111,11 +109,11 @@ static char *get_username(void) __do_free char *buf = NULL; struct passwd pwent; struct passwd *pwentp = NULL; - size_t bufsize; + ssize_t bufsize; int ret; bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); - if (bufsize == -1) + if (bufsize < 0) bufsize = 1024; buf = malloc(bufsize); @@ -144,7 +142,7 @@ static char **get_groupnames(void) int ret, i; struct group grent; struct group *grentp = NULL; - size_t bufsize; + ssize_t bufsize; ngroups = getgroups(0, NULL); if (ngroups < 0) { @@ -174,7 +172,7 @@ static char **get_groupnames(void) } bufsize = sysconf(_SC_GETGR_R_SIZE_MAX); - if (bufsize == -1) + if (bufsize < 0) bufsize = 1024; buf = malloc(bufsize); @@ -659,6 +657,7 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, size_t length = 0; int ret; size_t slen; + ssize_t nbytes; char *owner; char nicname[IFNAMSIZ]; struct alloted_s *n; @@ -755,7 +754,8 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid, return NULL; } - if (lxc_pwrite_nointr(fd, newline, slen, length) != slen) { + nbytes = lxc_pwrite_nointr(fd, newline, slen, length); + if (nbytes < 0 || (size_t)nbytes != slen) { CMD_SYSERROR("Failed to append new entry \"%s\" to database file", newline); if (lxc_netdev_delete_by_name(nicname) != 0) diff --git a/src/lxc/cmd/lxc_usernsexec.c b/src/lxc/cmd/lxc_usernsexec.c index a83444dad..96a1182a3 100644 --- a/src/lxc/cmd/lxc_usernsexec.c +++ b/src/lxc/cmd/lxc_usernsexec.c @@ -1,8 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif +#include "config.h" + #include #include #include @@ -22,7 +21,6 @@ #include "compiler.h" #include "conf.h" -#include "config.h" #include "hlist.h" #include "list.h" #include "log.h" @@ -228,13 +226,13 @@ static int read_default_map(char *fnam, int which, char *user) static int find_default_map(void) { __do_free char *buf = NULL; - size_t bufsize; + ssize_t bufsize; struct passwd pwent; int ret = -1; struct passwd *pwentp = NULL; bufsize = sysconf(_SC_GETPW_R_SIZE_MAX); - if (bufsize == -1) + if (bufsize < 0) bufsize = 1024; buf = malloc(bufsize); @@ -261,12 +259,14 @@ static int find_default_map(void) return 0; } -static bool is_in_ns_range(long id, struct id_map *map) +static bool is_in_ns_range(unsigned long id, struct id_map *map) { if (id < map->nsid) return false; + if (id >= map->nsid + map->range) return false; + return true; } diff --git a/src/lxc/cmd/meson.build b/src/lxc/cmd/meson.build index 410e4689c..d41809998 100644 --- a/src/lxc/cmd/meson.build +++ b/src/lxc/cmd/meson.build @@ -6,7 +6,8 @@ cmd_liblxc_includes = include_directories( '../cgroups', '../lsm', '../storage', - '../../include') + '../../include', + '../../../') cmd_common_sources = files( '../af_unix.c', @@ -148,12 +149,9 @@ cmd_lxc_init_static_sources = files( '../string_utils.c', '../string_utils.h') + include_sources -cmd_lxc_monitord_sources = files('lxc_monitord.c') + cmd_common_sources -cmd_lxc_user_nic_sources = files('lxc_user_nic.c') + cmd_common_sources -cmd_lxc_usernsexec_sources = files('lxc_usernsexec.c') + cmd_common_sources - -dummy_config_data = configuration_data() -dummy_config_data.set_quoted('DUMMY_VARIABLE', '1') +cmd_lxc_monitord_sources = files('lxc_monitord.c') + cmd_common_sources + netns_ifaddrs_sources +cmd_lxc_user_nic_sources = files('lxc_user_nic.c') + cmd_common_sources + netns_ifaddrs_sources +cmd_lxc_usernsexec_sources = files('lxc_usernsexec.c') + cmd_common_sources + netns_ifaddrs_sources cmd_lxc_checkconfig = configure_file( configuration : dummy_config_data, @@ -167,3 +165,43 @@ cmd_lxc_update_config = configure_file( input : 'lxc-update-config.in', output : 'lxc-update-config') install_data(join_paths(project_build_root, 'src/lxc/cmd/lxc-update-config'), install_dir : bindir) + +cmd_lxc_update_config_data = configuration_data() + +cmd_programs += executable( + 'init.lxc.static', + cmd_lxc_init_sources, + include_directories: cmd_liblxc_includes, + link_with : [liblxc_static], + link_args : ['-static'], + c_args : ['-DNO_LXC_CONF'], + dependencies : [libcap_static], + install : true) + +cmd_programs += executable( + 'lxc-init', + cmd_lxc_init_sources, + include_directories: cmd_liblxc_includes, + dependencies : liblxc_dep, + install : true) + +cmd_programs += executable( + 'lxc-monitord', + cmd_lxc_monitord_sources, + include_directories: cmd_liblxc_includes, + dependencies : liblxc_dep, + install : true) + +cmd_programs += executable( + 'lxc-user-nic', + cmd_lxc_user_nic_sources, + include_directories: cmd_liblxc_includes, + dependencies : liblxc_dep, + install : true) + +cmd_programs += executable( + 'lxc-usernsexec', + cmd_lxc_usernsexec_sources, + include_directories: cmd_liblxc_includes, + dependencies : liblxc_dep, + install : true) diff --git a/src/lxc/initutils.c b/src/lxc/initutils.c index 218125c1a..24baecc88 100644 --- a/src/lxc/initutils.c +++ b/src/lxc/initutils.c @@ -17,7 +17,7 @@ #include "memory_utils.h" #include "process_utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/log.h b/src/lxc/log.h index 80fb49c36..2a6da40e9 100644 --- a/src/lxc/log.h +++ b/src/lxc/log.h @@ -304,7 +304,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ * Helper macro to define errno string. */ #if HAVE_STRERROR_R - #ifndef HAVE_DECL_STRERROR_R + #if !HAVE_DECL_STRERROR_R #ifdef STRERROR_R_CHAR_P char *strerror_r(int errnum, char *buf, size_t buflen); #else diff --git a/src/lxc/mainloop.c b/src/lxc/mainloop.c index ba20224ae..7c8f5d86a 100644 --- a/src/lxc/mainloop.c +++ b/src/lxc/mainloop.c @@ -84,7 +84,7 @@ static inline void cleanup_handler(struct lxc_async_descr *descr, delete_handler(handler); } -#ifndef HAVE_LIBURING +#if !HAVE_LIBURING static inline int __lxc_mainloop_io_uring(struct lxc_async_descr *descr, int timeout_ms) { @@ -514,7 +514,7 @@ void lxc_mainloop_close(struct lxc_async_descr *descr) } if (descr->type == LXC_MAINLOOP_IO_URING) { -#ifdef HAVE_LIBURING +#if HAVE_LIBURING io_uring_queue_exit(descr->ring); munmap(descr->ring, sizeof(struct io_uring)); #else diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c index c9d4bcc9e..3ae807f1e 100644 --- a/src/lxc/monitor.c +++ b/src/lxc/monitor.c @@ -30,7 +30,7 @@ #include "state.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/network.c b/src/lxc/network.c index b87cf57e7..ad43694f2 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -39,7 +39,7 @@ #include "syscall_wrappers.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/pam/pam_cgfs.c b/src/lxc/pam/pam_cgfs.c index 01167fa47..31e671062 100644 --- a/src/lxc/pam/pam_cgfs.c +++ b/src/lxc/pam/pam_cgfs.c @@ -31,11 +31,11 @@ #include #include -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif -#ifndef HAVE_STRLCAT +#if !HAVE_STRLCAT #include "strlcat.h" #endif diff --git a/src/lxc/storage/btrfs.c b/src/lxc/storage/btrfs.c index 270eb057e..686a8986c 100644 --- a/src/lxc/storage/btrfs.c +++ b/src/lxc/storage/btrfs.c @@ -23,11 +23,11 @@ #include "storage.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif -#ifndef HAVE_STRLCAT +#if !HAVE_STRLCAT #include "strlcat.h" #endif diff --git a/src/lxc/storage/nbd.c b/src/lxc/storage/nbd.c index e27a98102..c35f9e865 100644 --- a/src/lxc/storage/nbd.c +++ b/src/lxc/storage/nbd.c @@ -19,7 +19,7 @@ #include "syscall_wrappers.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/storage/rbd.c b/src/lxc/storage/rbd.c index e1505e264..ea3593bd7 100644 --- a/src/lxc/storage/rbd.c +++ b/src/lxc/storage/rbd.c @@ -14,7 +14,7 @@ #include "storage_utils.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index 8fb8fe6b4..c840c68de 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -40,7 +40,7 @@ #include "utils.h" #include "zfs.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/storage/storage_utils.c b/src/lxc/storage/storage_utils.c index f50682159..4f329bd90 100644 --- a/src/lxc/storage/storage_utils.c +++ b/src/lxc/storage/storage_utils.c @@ -28,7 +28,7 @@ #include "syscall_wrappers.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/lxc/tools/include/getsubopt.c b/src/lxc/tools/include/getsubopt.c index 96d582ac0..01d91d690 100644 --- a/src/lxc/tools/include/getsubopt.c +++ b/src/lxc/tools/include/getsubopt.c @@ -6,7 +6,7 @@ #include "config.h" -#ifndef HAVE_STRCHRNUL +#if !HAVE_STRCHRNUL #include "strchrnul.h" #endif diff --git a/src/lxc/tools/lxc_copy.c b/src/lxc/tools/lxc_copy.c index 976efc36f..c7158cc0b 100644 --- a/src/lxc/tools/lxc_copy.c +++ b/src/lxc/tools/lxc_copy.c @@ -24,7 +24,7 @@ #include "storage_utils.h" #include "utils.h" -#ifndef HAVE_GETSUBOPT +#if !HAVE_GETSUBOPT #include "include/getsubopt.h" #endif diff --git a/src/tests/api_reboot.c b/src/tests/api_reboot.c index bf051b8b5..af12d6237 100644 --- a/src/tests/api_reboot.c +++ b/src/tests/api_reboot.c @@ -31,7 +31,7 @@ #include "lxctest.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/arch_parse.c b/src/tests/arch_parse.c index 95792ddd1..f8a0a46d2 100644 --- a/src/tests/arch_parse.c +++ b/src/tests/arch_parse.c @@ -30,7 +30,7 @@ #include "../lxc/lxc.h" #include "../lxc/memory_utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/attach.c b/src/tests/attach.c index f4ff5efbb..45c93390b 100644 --- a/src/tests/attach.c +++ b/src/tests/attach.c @@ -32,7 +32,7 @@ #include -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/cgpath.c b/src/tests/cgpath.c index 81b2162fe..46ae0259d 100644 --- a/src/tests/cgpath.c +++ b/src/tests/cgpath.c @@ -35,7 +35,7 @@ #include "lxctest.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/device_add_remove.c b/src/tests/device_add_remove.c index a03f7d19a..eb146090f 100644 --- a/src/tests/device_add_remove.c +++ b/src/tests/device_add_remove.c @@ -24,7 +24,7 @@ #include "memory_utils.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/get_item.c b/src/tests/get_item.c index 5ebe5508d..e5836f350 100644 --- a/src/tests/get_item.c +++ b/src/tests/get_item.c @@ -31,7 +31,7 @@ #include "lxctest.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/src/tests/shortlived.c b/src/tests/shortlived.c index c66e97ede..7c723ead2 100644 --- a/src/tests/shortlived.c +++ b/src/tests/shortlived.c @@ -31,7 +31,7 @@ #include "lxctest.h" #include "utils.h" -#ifndef HAVE_STRLCPY +#if !HAVE_STRLCPY #include "strlcpy.h" #endif diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in old mode 100644 new mode 100755 diff --git a/templates/lxc-download.in b/templates/lxc-download.in old mode 100644 new mode 100755 index ebec0b487..e8570692a --- a/templates/lxc-download.in +++ b/templates/lxc-download.in @@ -21,9 +21,9 @@ set -eu -LOCALSTATEDIR="@LOCALSTATEDIR@" -LXC_HOOK_DIR="@LXCHOOKDIR@" -LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" +LOCALSTATEDIR=@LOCALSTATEDIR@ +LXC_HOOK_DIR=@LXCHOOKDIR@ +LXC_TEMPLATE_CONFIG=@LXCTEMPLATECONFIG@ # Defaults DOWNLOAD_ARCH= diff --git a/templates/lxc-local.in b/templates/lxc-local.in old mode 100644 new mode 100755 index f94a150c7..d14c2e2e5 --- a/templates/lxc-local.in +++ b/templates/lxc-local.in @@ -22,8 +22,8 @@ set -eu -LXC_HOOK_DIR="@LXCHOOKDIR@" -LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" +LXC_HOOK_DIR=@LXCHOOKDIR@ +LXC_TEMPLATE_CONFIG=@LXCTEMPLATECONFIG@ LXC_NAME= LXC_PATH= diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in old mode 100644 new mode 100755 index a46949b68..06a0be5f6 --- a/templates/lxc-oci.in +++ b/templates/lxc-oci.in @@ -33,9 +33,9 @@ for bin in skopeo umoci jq; do fi done -LOCALSTATEDIR="@LOCALSTATEDIR@" -LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" -LXC_HOOK_DIR="@LXCHOOKDIR@" +LOCALSTATEDIR=@LOCALSTATEDIR@ +LXC_TEMPLATE_CONFIG=@LXCTEMPLATECONFIG@ +LXC_HOOK_DIR=@LXCHOOKDIR@ # Some useful functions cleanup() { diff --git a/templates/meson.build b/templates/meson.build new file mode 100644 index 000000000..7fbfbbc48 --- /dev/null +++ b/templates/meson.build @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +template_scripts = configure_file( + configuration : dummy_config_data, + input : 'lxc-busybox.in', + output : 'lxc-busybox') +install_data(join_paths(project_build_root, 'templates/lxc-busybox'), install_dir : lxctemplatedir) + +template_config_data = configuration_data() +template_config_data.set_quoted('LXCHOOKDIR', lxchookdir) +template_config_data.set_quoted('LXCTEMPLATECONFIG', lxctemplateconfig) +template_config_data.set_quoted('LOCALSTATEDIR', localstatedir) +template_config_data.set_quoted('PACKAGE_VERSION', meson.project_version()) + +template_scripts = configure_file( + configuration : template_config_data, + input : 'lxc-download.in', + output : 'lxc-download') +install_data(join_paths(project_build_root, 'templates/lxc-download'), install_dir : lxchookdir) + +template_scripts = configure_file( + configuration : template_config_data, + input : 'lxc-local.in', + output : 'lxc-local') +install_data(join_paths(project_build_root, 'templates/lxc-local'), install_dir : lxchookdir) + +template_scripts = configure_file( + configuration : template_config_data, + input : 'lxc-oci.in', + output : 'lxc-oci') +install_data(join_paths(project_build_root, 'templates/lxc-oci'), install_dir : lxchookdir)