mirror of
https://github.com/systemd/systemd
synced 2025-11-20 17:24:45 +01:00
Compare commits
4 Commits
53ff5b361f
...
e8a0463c16
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a0463c16 | ||
|
|
1929f43199 | ||
|
|
0ce88a9132 | ||
|
|
2a5e68e27d |
@ -7,6 +7,7 @@ Distribution=|ubuntu
|
|||||||
[Content]
|
[Content]
|
||||||
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
PrepareScripts=%D/mkosi/mkosi.conf.d/debian-ubuntu/systemd.prepare
|
||||||
Packages=
|
Packages=
|
||||||
|
bsdextrautils
|
||||||
hostname
|
hostname
|
||||||
iproute2
|
iproute2
|
||||||
mount
|
mount
|
||||||
|
|||||||
@ -93,6 +93,10 @@ executables += [
|
|||||||
'name' : 'systemd-import-generator',
|
'name' : 'systemd-import-generator',
|
||||||
'sources' : files('import-generator.c'),
|
'sources' : files('import-generator.c'),
|
||||||
},
|
},
|
||||||
|
test_template + {
|
||||||
|
'sources' : files('test-tar-extract.c'),
|
||||||
|
'type' : 'manual',
|
||||||
|
},
|
||||||
test_template + {
|
test_template + {
|
||||||
'sources' : files('test-qcow2.c'),
|
'sources' : files('test-qcow2.c'),
|
||||||
'objects' : ['systemd-importd'],
|
'objects' : ['systemd-importd'],
|
||||||
@ -100,6 +104,7 @@ executables += [
|
|||||||
'conditions' : ['HAVE_ZLIB'],
|
'conditions' : ['HAVE_ZLIB'],
|
||||||
'type' : 'manual',
|
'type' : 'manual',
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
install_data('org.freedesktop.import1.conf',
|
install_data('org.freedesktop.import1.conf',
|
||||||
|
|||||||
37
src/import/test-tar-extract.c
Normal file
37
src/import/test-tar-extract.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
|
||||||
|
#include "fd-util.h"
|
||||||
|
#include "libarchive-util.h"
|
||||||
|
#include "main-func.h"
|
||||||
|
#include "tar-util.h"
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
static int run(int argc, char **argv) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
test_setup_logging(LOG_DEBUG);
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||||
|
"Need two arguments exactly: <input> <output>");
|
||||||
|
|
||||||
|
r = dlopen_libarchive();
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
_cleanup_close_ int input_fd = open(argv[1], O_RDONLY | O_CLOEXEC);
|
||||||
|
if (input_fd < 0)
|
||||||
|
return log_error_errno(input_fd, "Cannot open %s: %m", argv[1]);
|
||||||
|
|
||||||
|
_cleanup_close_ int output_fd = open(argv[2], O_DIRECTORY | O_CLOEXEC);
|
||||||
|
if (output_fd < 0)
|
||||||
|
return log_error_errno(output_fd, "Cannot open %s: %m", argv[2]);
|
||||||
|
|
||||||
|
r = tar_x(input_fd, output_fd, /* flags= */ TAR_SELINUX);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "tar_x failed: %m");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_MAIN_FUNCTION(run);
|
||||||
@ -472,8 +472,8 @@ RootImage=$MINIMAL_IMAGE.raw
|
|||||||
ExtensionImages=/tmp/app0.raw /tmp/app1.raw:nosuid
|
ExtensionImages=/tmp/app0.raw /tmp/app1.raw:nosuid
|
||||||
# Relevant only for sanitizer runs
|
# Relevant only for sanitizer runs
|
||||||
UnsetEnvironment=LD_PRELOAD
|
UnsetEnvironment=LD_PRELOAD
|
||||||
ExecStart=bash -c '/opt/script0.sh | grep ID'
|
ExecStart=bash -o pipefail -c '/opt/script0.sh | grep ID'
|
||||||
ExecStart=bash -c '/opt/script1.sh | grep ID'
|
ExecStart=bash -o pipefail -c '/opt/script1.sh | grep ID'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
EOF
|
EOF
|
||||||
@ -490,7 +490,7 @@ mkdir "$VDIR" "$EMPTY_VDIR"
|
|||||||
ln -s /tmp/app0.raw "$VDIR/${VBASE}_0.raw"
|
ln -s /tmp/app0.raw "$VDIR/${VBASE}_0.raw"
|
||||||
ln -s /tmp/app1.raw "$VDIR/${VBASE}_1.raw"
|
ln -s /tmp/app1.raw "$VDIR/${VBASE}_1.raw"
|
||||||
|
|
||||||
systemd-run -P -p ExtensionImages="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" bash -c '/opt/script1.sh | grep ID'
|
systemd-run -P -p ExtensionImages="$VDIR -$EMPTY_VDIR -$NONEXISTENT_VDIR" bash -o pipefail -c '/opt/script1.sh | grep ID'
|
||||||
|
|
||||||
rm -rf "$VDIR" "$EMPTY_VDIR"
|
rm -rf "$VDIR" "$EMPTY_VDIR"
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ EnvironmentFile=-/usr/lib/systemd/systemd-asan-env
|
|||||||
PrivateTmp=disconnected
|
PrivateTmp=disconnected
|
||||||
BindPaths=/tmp/markers/
|
BindPaths=/tmp/markers/
|
||||||
ExtensionDirectories=-${VDIR}
|
ExtensionDirectories=-${VDIR}
|
||||||
ExecStart=bash -x -c ' \\
|
ExecStart=bash -o pipefail -x -c ' \\
|
||||||
trap "{ \\
|
trap "{ \\
|
||||||
systemd-notify --reloading; \\
|
systemd-notify --reloading; \\
|
||||||
(ls /etc | grep marker || echo no-marker) >/tmp/markers/50g; \\
|
(ls /etc | grep marker || echo no-marker) >/tmp/markers/50g; \\
|
||||||
@ -628,7 +628,7 @@ EnvironmentFile=-/usr/lib/systemd/systemd-asan-env
|
|||||||
PrivateTmp=disconnected
|
PrivateTmp=disconnected
|
||||||
BindPaths=/tmp/markers/
|
BindPaths=/tmp/markers/
|
||||||
ExtensionImages=-$VDIR2
|
ExtensionImages=-$VDIR2
|
||||||
ExecStart=bash -x -c ' \\
|
ExecStart=bash -o pipefail -x -c ' \\
|
||||||
trap "{ \\
|
trap "{ \\
|
||||||
systemd-notify --reloading; \\
|
systemd-notify --reloading; \\
|
||||||
(ls /etc | grep marker || echo no-marker) >/tmp/markers/50h; \\
|
(ls /etc | grep marker || echo no-marker) >/tmp/markers/50h; \\
|
||||||
@ -666,7 +666,7 @@ BindPaths=/tmp/markers/
|
|||||||
RootImage=$MINIMAL_IMAGE.raw
|
RootImage=$MINIMAL_IMAGE.raw
|
||||||
ExtensionDirectories=-${VDIR}
|
ExtensionDirectories=-${VDIR}
|
||||||
NotifyAccess=all
|
NotifyAccess=all
|
||||||
ExecStart=bash -x -c ' \
|
ExecStart=bash -x -o pipefail -c ' \
|
||||||
trap '"'"' \
|
trap '"'"' \
|
||||||
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
||||||
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
||||||
@ -701,7 +701,7 @@ BindPaths=/tmp/markers/
|
|||||||
RootDirectory=/tmp/vpickminimg
|
RootDirectory=/tmp/vpickminimg
|
||||||
ExtensionDirectories=-${VDIR}
|
ExtensionDirectories=-${VDIR}
|
||||||
NotifyAccess=all
|
NotifyAccess=all
|
||||||
ExecStart=bash -x -c ' \
|
ExecStart=bash -x -o pipefail -c ' \
|
||||||
trap '"'"' \
|
trap '"'"' \
|
||||||
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
||||||
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
||||||
@ -731,7 +731,7 @@ RootImage=$MINIMAL_IMAGE.raw
|
|||||||
ExtensionImages=-$VDIR2 /tmp/app0.raw
|
ExtensionImages=-$VDIR2 /tmp/app0.raw
|
||||||
PrivateUsers=yes
|
PrivateUsers=yes
|
||||||
NotifyAccess=all
|
NotifyAccess=all
|
||||||
ExecStart=bash -x -c ' \
|
ExecStart=bash -x -o pipefail -c ' \
|
||||||
trap '"'"' \
|
trap '"'"' \
|
||||||
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
|
||||||
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
stdbuf -o1K printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user