aboutsummaryrefslogtreecommitdiff
path: root/dbx-init
blob: 0cf9ac327b2d05e0fc9e863ae9d1468deccac88e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only

set -euo pipefail

if [[ ! -f /run/.containerenv ]]; then
    echo "ERROR: not in a container" >&2
fi

h="/dbx"
u="${1:-1000}"
g="${2:-1000}"

dnf install -y \
    fish \
    fzf \
    netcat \
    ripgrep \
    tini \
    vim-enhanced

if [[ ! -d "$h" ]]; then
    usermod \
        --home "$h" \
        --groups wheel \
        --password "" \
        --shell $(command -v fish) \
        $(id -nu "$u")

    mkdir --parents "$h"
    chown --recursive "$u:$g" "$h"
fi

echo "=== READY TO ROLL! ==="
touch /run/.dbxenv
exec tini sleep -- infinity