#!/bin/sh
set -euxo pipefail

profile_dir="$(dirname "$PROFILE_NEW_GENERATION")"
current="$profile_dir/current"
target="/run/current-profile"
tmp="/run/current-profile.tmp"
mkdir -p /run
rm -f "$tmp"
ln -s "$current" "$tmp"
mv -Tf "$tmp" "$target"
