about summary refs log tree commit diff
path: root/nixos/modules/tasks/tty-backgrounds-combine.sh
blob: 55c3a1ebfa8abb3cde12a8f9a676dab82a81d7c1 (plain) (blame)
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
source $stdenv/setup

ttys=($ttys)
themes=($themes)

mkdir -p $out

defaultName=$(cd $default && ls | grep -v default)
echo $defaultName
ln -s $default/$defaultName $out/$defaultName
ln -s $defaultName $out/default

for ((n = 0; n < ${#ttys[*]}; n++)); do
    tty=${ttys[$n]}
    theme=${themes[$n]}

    echo "TTY $tty -> $theme"

    if [ "$theme" != default ]; then
        themeName=$(cd $theme && ls | grep -v default)
        ln -sfn $theme/$themeName $out/$themeName
    else
        themeName=default
    fi

    if test -e $out/$tty; then
        echo "Multiple themes defined for the same TTY!"
        exit 1
    fi

    ln -sfn $themeName $out/$tty
done