2016-01-12 17:56:59 +00:00
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
[ -z "$DF_DIR" ] && DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux"
|
2016-01-19 21:44:33 +00:00
|
|
|
env_dir="@env@"
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
update_path() {
|
2016-01-19 21:44:33 +00:00
|
|
|
local path="$1"
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
mkdir -p "$DF_DIR/$(dirname "$path")"
|
|
|
|
# If user has replaced these data directories, let them stay.
|
|
|
|
if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then
|
|
|
|
rm -f "$DF_DIR/$path"
|
2016-01-19 21:44:33 +00:00
|
|
|
ln -s "$env_dir/$path" "$DF_DIR/$path"
|
2016-01-12 17:56:59 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
forcecopy_path() {
|
2016-01-19 21:44:33 +00:00
|
|
|
local path="$1"
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
mkdir -p "$DF_DIR/$(dirname "$path")"
|
|
|
|
rm -rf "$DF_DIR/$path"
|
2016-01-19 21:44:33 +00:00
|
|
|
cp -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path"
|
2016-01-12 17:56:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p "$DF_DIR"
|
|
|
|
|
|
|
|
cat <<EOF >&2
|
|
|
|
Using $DF_DIR as Dwarf Fortress overlay directory.
|
|
|
|
If you do any changes in it, don't forget to clean it when updating the game version!
|
|
|
|
We try to detect changes based on data directories being symbolic links -- keep this in mind.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2016-01-19 21:44:33 +00:00
|
|
|
cd "$env_dir"
|
2016-01-12 17:56:59 +00:00
|
|
|
for i in data/init/* data/!(init|index|announcement) raw; do
|
2016-01-19 21:44:33 +00:00
|
|
|
update_path "$i"
|
2016-01-12 17:56:59 +00:00
|
|
|
done
|
|
|
|
|
2016-01-19 21:44:33 +00:00
|
|
|
forcecopy_path data/index
|
2016-01-12 17:56:59 +00:00
|
|
|
# For some reason, it's needed to be writable...
|
2016-01-19 21:44:33 +00:00
|
|
|
forcecopy_path data/announcement
|
2016-02-07 12:54:49 +00:00
|
|
|
forcecopy_path data/help
|
2016-02-10 18:37:54 +00:00
|
|
|
forcecopy_path data/dipscript
|