Skip to content

Commit d5c7b0e

Browse files
authored
Merge pull request #156 from gardenlinux/dbgimport
Preload debug container
2 parents d90b1e9 + 033e594 commit d5c7b0e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Import debug container image
3+
ConditionPathExists=|/opt/dbgimage/debug.tar
4+
ConditionFirstBoot=yes
5+
After=containerd.service
6+
Requires=containerd.service
7+
8+
[Service]
9+
ExecStart=/bin/sh -c 'ctr image import --base-name "$(cat /opt/dbgimage/debug.tar.name)" /opt/dbgimage/debug.tar && rm -f /opt/dbgimage/debug.tar && rm -f /opt/dbgimage/debug.tar.name && rm -f /opt/dbgimage/image'
10+
Type=oneshot
11+
12+
[Install]
13+
WantedBy=multi-user.target

features/_usi/initrd.include/usr/bin/persist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ if [ "$ENABLE_HUGEPAGE_SETUP" = "true" ]; then
9494
objcopy --add-section .cmdline=/tmp/cmdlinef --change-section-vma .cmdline=$(printf 0x%x $offs) $addon "$addon_dir/hugepages.addon.efi"
9595
fi
9696

97+
# debug container
98+
DBG_CONTAINER_IMPORT="/sysroot/opt/dbgimage"
99+
DBG_CONTAINER_IMAGE_DUMP="debug.tar"
100+
DBG_CONTAINER_FILE="/sysroot/opt/dbgimage/image"
101+
102+
mkdir -p "$DBG_CONTAINER_IMPORT"
103+
if [ -f "$DBG_CONTAINER_FILE" ]; then
104+
oras backup --output "$DBG_CONTAINER_IMPORT/$DBG_CONTAINER_IMAGE_DUMP" "$(cat "$DBG_CONTAINER_FILE")"
105+
cat "$DBG_CONTAINER_FILE" | cut -d: -f 1 > "$DBG_CONTAINER_IMPORT/$DBG_CONTAINER_IMAGE_DUMP.name"
106+
else
107+
echo "no container image file provided, skipping..."
108+
fi
109+
110+
97111
# Network config generation
98112
if [[ -x /sysroot/opt/persist/network_up.sh ]]; then
99113
chroot /sysroot /opt/persist/network_up.sh

0 commit comments

Comments
 (0)