summaryrefslogtreecommitdiffstats
path: root/core/modules/init-bwlp
diff options
context:
space:
mode:
authorSimon Rettberg2020-12-07 12:11:34 +0100
committerSimon Rettberg2020-12-07 12:11:34 +0100
commita34f7d2d7f7ee7333abe982c55f8ce35a7b12308 (patch)
treed4bcb2e56aa130127596f9104445c6692bb464ee /core/modules/init-bwlp
parent[rootfs-stage31] Add hook mechanism (diff)
downloadmltk-a34f7d2d7f7ee7333abe982c55f8ce35a7b12308.tar.gz
mltk-a34f7d2d7f7ee7333abe982c55f8ce35a7b12308.tar.xz
mltk-a34f7d2d7f7ee7333abe982c55f8ce35a7b12308.zip
[init-bwlp] Add module for bwlp-specific init stuff
Diffstat (limited to 'core/modules/init-bwlp')
-rw-r--r--core/modules/init-bwlp/data/inc/post-config-tgz.d/50-install-certificates26
-rw-r--r--core/modules/init-bwlp/module.build14
-rw-r--r--core/modules/init-bwlp/module.conf2
3 files changed, 42 insertions, 0 deletions
diff --git a/core/modules/init-bwlp/data/inc/post-config-tgz.d/50-install-certificates b/core/modules/init-bwlp/data/inc/post-config-tgz.d/50-install-certificates
new file mode 100644
index 00000000..0b4e74bd
--- /dev/null
+++ b/core/modules/init-bwlp/data/inc/post-config-tgz.d/50-install-certificates
@@ -0,0 +1,26 @@
+#!/bin/ash
+
+# $FUTURE_ROOT - root dir of final stage 4 (config.tgz extracted to here)
+# $CONFIG - current path to /opt/openslx/config (changes to this end up in stage 4)
+
+# Set up SSL communication with server
+if [ -d "${FUTURE_ROOT}/opt/openslx/ssl" ] && ! rmdir "${FUTURE_ROOT}/opt/openslx/ssl"; then
+ # Copy certs and symlinks to CA path
+ cp -a "${FUTURE_ROOT}"/opt/openslx/ssl/* "${FUTURE_ROOT}/etc/ssl/certs/"
+ # Append to combined ca bundle
+ find "${FUTURE_ROOT}/opt/openslx/ssl" -type f -exec cat {} \; \
+ >> "${FUTURE_ROOT}/etc/ssl/certs/ca-certificates.crt"
+ # Move certs (without symlinks), so they will be re-included if we run update-ca-certificates later
+ mkdir -p "${FUTURE_ROOT}/usr/local/share/ca-certificates"
+ find "${FUTURE_ROOT}/opt/openslx/ssl" -type f \
+ -exec mv {} "${FUTURE_ROOT}/usr/local/share/ca-certificates/" \;
+ # Delete symlinks
+ find "${FUTURE_ROOT}/opt/openslx/ssl" -type l -delete
+ # Add entry to /etc/hosts for boot server (satellite server)
+ # Change all the URLs in config to use SSL
+ if [ -n "$SLX_REMOTE_SSL" ] && ! grep -qF 'satellite.bwlehrpool' "/etc/hosts"; then
+ echo "$SLX_REMOTE_SSL satellite.bwlehrpool" >> "/etc/hosts"
+ sed -i "s,http://${SLX_REMOTE_SSL}/,https://satellite.bwlehrpool/," "${CONFIG}"
+ fi
+fi
+true
diff --git a/core/modules/init-bwlp/module.build b/core/modules/init-bwlp/module.build
new file mode 100644
index 00000000..135bddfc
--- /dev/null
+++ b/core/modules/init-bwlp/module.build
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+fetch_source () {
+ :
+}
+
+build () {
+ :
+}
+
+post_copy() {
+ :
+}
+
diff --git a/core/modules/init-bwlp/module.conf b/core/modules/init-bwlp/module.conf
new file mode 100644
index 00000000..b595af09
--- /dev/null
+++ b/core/modules/init-bwlp/module.conf
@@ -0,0 +1,2 @@
+#!/bin/bash
+# (void)