summaryrefslogtreecommitdiff
path: root/home/scripts/theme.sh
blob: 830f56b82e3c941ef4e5a6560c5ec979712be830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# usage: theme.sh <theme_name>

source log.sh "theme.sh"

THEME="$1"
log DEBUG "setting theme $THEME"

THEME_SRC="$XDG_CONFIG_HOME/theme"
THEME_DEST="$HOME/.theme"
log DEBUG "src $THEME_SRC -> dest $THEME_DEST"

THEME_TEMPL="{{THEME}}"

find -L "$THEME_SRC/" -type f | while read source_file; do
	destination_file=`echo "$source_file" | sed "s|^$THEME_SRC|$THEME_DEST|g"`
	mkdir -p `dirname $destination_file`
	log DEBUG "src $source_file -> dest $destination_file"
	cat "$source_file" | sed "s|$THEME_TEMPL|$THEME|g" > $destination_file
done