summaryrefslogtreecommitdiffstats
path: root/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-12 14:12:48 +0200
committerSimon Rettberg2017-07-12 14:12:48 +0200
commitc70af5479c890b109ffa12617def457e49f7baf1 (patch)
treee655d3fc498646a674dd437768ec074aab8d0746 /core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
parent[rfs-stage31] init: Create /tmp early, unmount before switchroot (diff)
downloadmltk-c70af5479c890b109ffa12617def457e49f7baf1.tar.gz
mltk-c70af5479c890b109ffa12617def457e49f7baf1.tar.xz
mltk-c70af5479c890b109ffa12617def457e49f7baf1.zip
[init, etc] Pass system-uuid when fetching config & config.tgz
Also save the system-uuid for later use in stage32+, which changed locations from /run to /etc - modules got updated accordingly
Diffstat (limited to 'core/rootfs/rootfs-stage31/data/inc/activate_sysconfig')
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/activate_sysconfig26
1 files changed, 18 insertions, 8 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
index ec98ff70..f9363758 100644
--- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
+++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig
@@ -9,11 +9,11 @@ CONFIG="${FUTURE_ROOT}/opt/openslx/config"
#
# This function downloads the config containing environment variables
#
-fetch_sysconfig() {
+fetch_text_config() {
[ -e "$CONFIG" ] && grep -E '^#_RCONFIG_TAG$' "$CONFIG" > /dev/null \
&& echo "Config already fetched." && return 0
- download "${SLX_BASE_PATH}/config" "${CONFIG}-remote" || return 1
+ download "${SLX_BASE_PATH}/config$UUID_URL" "${CONFIG}-remote" || return 1
echo "# Config fetched from $URL" >> "$CONFIG"
echo "#_RCONFIG_TAG" >> "$CONFIG"
@@ -23,10 +23,10 @@ fetch_sysconfig() {
#
# This function downloads the config.tgz and unpacks it to $TARGET_PATH <-- no it doesn't!
#
-fetch_config_files() {
+fetch_config_tgz() {
[ -e "${CONFIG}.tgz" ] && echo "config.tgz already downloaded." && return 0
- download "${SLX_BASE_PATH}/config.tgz" "${CONFIG}.tgz"
+ download "${SLX_BASE_PATH}/config.tgz$UUID_URL" "${CONFIG}.tgz"
}
@@ -34,7 +34,7 @@ fetch_config_files() {
#
# This function updates the downloaded config with the IP information
# received from /inc/setup_network <-- plus 500 other things
-update_sysconfig() {
+merge_text_config() {
# sanity checks
[ ! -e "${CONFIG}" ] && { echo "Cannot update. '$CONFIG' does not exist."; return 1; }
@@ -95,7 +95,17 @@ HEREEND
# MAIN PART
#
-fetch_sysconfig || drop_shell "Could not download remote config"
+# Determine machine uuid, save for later
+get-uuid
+if [ -e "/run/system-uuid" ]; then
+ UUID=$(cat "/run/system-uuid")
+ if [ -n "$UUID" ]; then
+ UUID_URL="?uuid=$UUID"
+ fi
+ cp "/run/system-uuid" "${FUTURE_ROOT}/etc/system-uuid"
+fi
+
+fetch_text_config || drop_shell "Could not download remote config"
if ! ash -n "${CONFIG}-remote"; then
echo -e "\n\tFATAL: Could not download configuration!"
echo -e "\tAborting boot since the system would be in an unusable state."
@@ -108,7 +118,7 @@ if ! ash -n "${CONFIG}-remote"; then
echo b > /proc/sysrq-trigger
fi
. "${CONFIG}-remote" || drop_shell "Could not source remote config"
-fetch_config_files || drop_shell "Could not download config.tgz"
-update_sysconfig || drop_shell "Could not update sysconfig"
+fetch_config_tgz || drop_shell "Could not download config.tgz"
+merge_text_config || drop_shell "Could not update sysconfig"
true