summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-12 14:52:19 +0200
committerSimon Rettberg2017-07-12 14:52:19 +0200
commit404c8338eff24d42c559e26ce88923dbb047ebe5 (patch)
tree37b889c8552b2de930c385bebe94ec81530cf005
parent[init, etc] Pass system-uuid when fetching config & config.tgz (diff)
downloadmltk-404c8338eff24d42c559e26ce88923dbb047ebe5.tar.gz
mltk-404c8338eff24d42c559e26ce88923dbb047ebe5.tar.xz
mltk-404c8338eff24d42c559e26ce88923dbb047ebe5.zip
[rfs-stage31] Handle SLX_SYSTEMD_TARGET and SLX_NO_CONFIG_TGZ
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/activate_sysconfig23
1 files changed, 20 insertions, 3 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
index f9363758..d79b98ef 100644
--- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
+++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
@@ -47,8 +47,11 @@ SLX_PXE_GATEWAY='$GATEWAY'
SLX_PXE_DNS='$DNS_SERVER'
SLX_PXE_MAC='$BRIDGEMAC'
HEREEND
+ return 0
+}
- [ ! -e "${CONFIG}.tgz" ] && { echo "Cannot update. '$CONFIG' does not exist."; return 1; }
+install_config_tgz() {
+ [ ! -e "${CONFIG}.tgz" ] && { echo "Cannot install config.tgz. '${CONFIG}.tgz' does not exist."; return 1; }
# setup hardware clock
. "${CONFIG}"
@@ -105,6 +108,7 @@ if [ -e "/run/system-uuid" ]; then
cp "/run/system-uuid" "${FUTURE_ROOT}/etc/system-uuid"
fi
+# Set up /opt/openslx/config
fetch_text_config || drop_shell "Could not download remote config"
if ! ash -n "${CONFIG}-remote"; then
echo -e "\n\tFATAL: Could not download configuration!"
@@ -118,7 +122,20 @@ if ! ash -n "${CONFIG}-remote"; then
echo b > /proc/sysrq-trigger
fi
. "${CONFIG}-remote" || drop_shell "Could not source remote config"
-fetch_config_tgz || drop_shell "Could not download config.tgz"
-merge_text_config || drop_shell "Could not update sysconfig"
+merge_text_config || drop_shell "Could not update text based config"
+
+# Fetch config.tgz if desired
+if [ -z "$SLX_NO_CONFIG_TGZ" ]; then
+ fetch_config_tgz || drop_shell "Could not download config.tgz"
+ install_config_tgz || drop_shell "Could not extract config.tgz"
+fi
+
+# Change systemd target if desired
+if [ -n "$SLX_SYSTEMD_TARGET" ]; then
+ SLX_SYSTEMD_TARGET="${SLX_SYSTEMD_TARGET%.target}.target"
+ mkdir -p "${FUTURE_ROOT}/etc/systemd/system"
+ ln -sf "$SLX_SYSTEMD_TARGET" "${FUTURE_ROOT}/etc/systemd/system/default.target"
+fi
+
true