summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-06-12 14:21:40 +0200
committerSimon Rettberg2024-06-12 14:21:40 +0200
commit4aebbd2a76e48ace73a9f290887f42af60644446 (patch)
tree47c61d556b2f2c5d523790c0c61ef095d232e05f
parent[busybox] module-setup: Bail out if build fails (diff)
downloadsystemd-init-4aebbd2a76e48ace73a9f290887f42af60644446.tar.gz
systemd-init-4aebbd2a76e48ace73a9f290887f42af60644446.tar.xz
systemd-init-4aebbd2a76e48ace73a9f290887f42af60644446.zip
[slx-extra-script] New module to run script from URL
-rw-r--r--dev-tools/example-openslx.config12
-rwxr-xr-xmodules.d/slx-extra-script/hooks/s3-extra-script.sh10
-rwxr-xr-xmodules.d/slx-extra-script/module-setup.sh13
3 files changed, 27 insertions, 8 deletions
diff --git a/dev-tools/example-openslx.config b/dev-tools/example-openslx.config
index 6d0a1fc2..728eb5ea 100644
--- a/dev-tools/example-openslx.config
+++ b/dev-tools/example-openslx.config
@@ -12,9 +12,6 @@ SLX_DNBD3_RID='1'
# If empty the whole device will be used (no partition assumed).
# e.g. 'SLX_SYS' if built with git://git.openslx.org/openslx-ng/packer-templates
SLX_SYSTEM_PARTITION_IDENTIFIER='SLX_SYS'
-# Script to run and set the read only device.
-# (e.g. "lvm_scan && read_only_partition=/dev/centos/root")
-SLX_SYSTEM_PARTITION_PREPARATION_SCRIPT=''
# Local device (HDD) to use as a scratch space to combine with the DNBD3 image
# to make it writable via device mapper. This can be an MBR type (e.g. 44) or
# a GPT label. If empty, a RAMdisk will be used as a fallback.
@@ -42,10 +39,9 @@ SLX_WRITABLE_DEVICE_IDENTIFIER='44'
SLX_WRITABLE_DEVICE_PARTITION_TABLE='
thin-snapshot root 100%
'
-# If empty we will end up in an empty fstab file. If you want to reuse the
-# original fstab (from the template system) provide a dummy script like "true".
-SLX_GENERATE_FSTAB_SCRIPT='
-echo "/dev/mapper/root / btrfs subvol=root 0 0" >> "$NEWROOT/etc/fstab"
-'
# Specifies mount options for the final root location.
SLX_MOUNT_ROOT_OPTIONS='-o subvol=root'
+# Additional configuration or initialization script to run in stage3,
+# before dnbd3root setup, to e.g. partition and format the disk.
+# Enable slx-extra-script module for this to work!
+SLX_EXTRA_SCRIPT_URL='http://server/extra-script.sh'
diff --git a/modules.d/slx-extra-script/hooks/s3-extra-script.sh b/modules.d/slx-extra-script/hooks/s3-extra-script.sh
new file mode 100755
index 00000000..3a8d4ff4
--- /dev/null
+++ b/modules.d/slx-extra-script/hooks/s3-extra-script.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# -*- coding: utf-8 -*-
+# region imports
+. /etc/openslx
+# endregion
+
+[ -z "$SLX_EXTRA_SCRIPT_URL" ] && exit 0
+slx-tools download_retry --slx-time 20 -sS "$SLX_EXTRA_SCRIPT_URL" > /tmp/extra-init || exit 1
+chmod +x /tmp/extra-init
+exec /tmp/extra-init
diff --git a/modules.d/slx-extra-script/module-setup.sh b/modules.d/slx-extra-script/module-setup.sh
new file mode 100755
index 00000000..02f61391
--- /dev/null
+++ b/modules.d/slx-extra-script/module-setup.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+check() {
+ return 255
+}
+depends() {
+ echo conf-tgz
+}
+install() {
+ slx_service "s3-extra-script" "Execute extra script from URL" \
+ --wafter "s3-fetch-config.service" \
+ --before "s3-dnbd3root.service"
+}