summaryrefslogtreecommitdiff
blob: 8594e0bcefafbd1955df1f8e04dad17f38bced6a (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
#!/bin/sh

gamesdir=/opt/dwarf-fortress
install="$HOME/.dwarf-fortress"

do_install() {
	cp -rn "$gamesdir"/data "$install"/
	# DF gets unhappy when this is out of sync
	cp -f "$gamesdir"/data/index "$install"/data/
	cp -rsn "$gamesdir"/* "$install"/
}

if [[ -d "$install" ]]; then
	# delete dangling symlinks
	find -L "$install/" -type l -delete
	# ignore "are the same file" errors
	do_install 2>/dev/null
else
	mkdir "$install" || exit
	do_install || exit
fi

cd "$install" || exit
exec ./libs/Dwarf_Fortress "$@"