#!/bin/sh
# Runs at live boot only. Sets DCONF_PROFILE=live for the live user
# so the live dconf database is used instead of the installed default.

# Source live-config variables (provides LIVE_USERNAME etc.)
. /etc/live/config.conf 2>/dev/null || true
LIVE_USER="${LIVE_USERNAME:-vesperos}"
LIVE_HOME="/home/${LIVE_USER}"

if [ -d "${LIVE_HOME}" ]; then
    mkdir -p "${LIVE_HOME}/.config/environment.d"
    echo 'DCONF_PROFILE=live' > "${LIVE_HOME}/.config/environment.d/dconf.conf"
    chown -R "${LIVE_USER}:${LIVE_USER}" "${LIVE_HOME}/.config"
fi
