Skip to content

Commit b9e3c2e

Browse files
committed
Add user config bootstrap service and script for initial configuration, and include a cleanup step for lint
1 parent 929f5b2 commit b9e3c2e

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

build_files/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ dnf5 install -y --refresh niri alacritty dms
2323
dnf5 -y copr disable avengemedia/dms
2424
dnf5 -y copr disable avengemedia/danklinux
2525

26+
# Enable first-login DMS bootstrap for all users.
27+
systemctl --global enable dms-user-bootstrap.service
28+
2629
# Clean up before finalizing the image
30+
rm -rf /run/dnf
2731
rm -rf /tmp/*
2832
rm -rf /var/tmp/*
2933
dnf5 clean all
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Unit]
2+
Description=Bootstrap niri and dms user config
3+
Before=graphical-session-pre.target
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/usr/bin/bash /usr/libexec/dms-user-bootstrap.sh
8+
9+
[Install]
10+
WantedBy=graphical-session-pre.target
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/bash
2+
3+
set -euo pipefail
4+
5+
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}"
6+
STATE_FILE="$STATE_DIR/dms-user-bootstrap.done"
7+
8+
mkdir -p "$STATE_DIR"
9+
10+
if [[ -e "$STATE_FILE" ]]; then
11+
exit 0
12+
fi
13+
14+
mkdir -p "$HOME/.config"
15+
DEFAULT_NIRI_DIR="/usr/share/dms/niri"
16+
USER_NIRI_DIR="$HOME/.config/niri"
17+
DEFAULT_DANK_DIR="/usr/share/dms/DankMaterialShell"
18+
USER_DANK_DIR="$HOME/.config/DankMaterialShell"
19+
DEFAULT_ALACRITTY_DIR="/usr/share/dms/alacritty"
20+
USER_ALACRITTY_DIR="$HOME/.config/alacritty"
21+
22+
# Seed niri config
23+
if [[ ! -e "$USER_NIRI_DIR/config.kdl" && -d "$DEFAULT_NIRI_DIR" ]]; then
24+
cp -a "$DEFAULT_NIRI_DIR" "$USER_NIRI_DIR"
25+
fi
26+
27+
# Seed dank settings config
28+
if [[ ! -e "$USER_DANK_DIR/settings.json" && -d "$DEFAULT_DANK_DIR" ]]; then
29+
cp -a "$DEFAULT_DANK_DIR" "$USER_DANK_DIR"
30+
fi
31+
32+
# Seed alacritty config
33+
if [[ ! -e "$USER_ALACRITTY_DIR/alacritty.toml" && -d "$DEFAULT_ALACRITTY_DIR" ]]; then
34+
cp -a "$DEFAULT_ALACRITTY_DIR" "$USER_ALACRITTY_DIR"
35+
fi
36+
37+
touch "$STATE_FILE"

0 commit comments

Comments
 (0)