2016-01-12 18:56:59 +01:00
|
|
|
shopt -s extglob
|
|
|
|
|
|
|
|
[ -z "$DF_DIR" ] && DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux"
|
2016-01-19 22:44:33 +01:00
|
|
|
env_dir="@env@"
|
2018-05-11 06:55:06 +02:00
|
|
|
exe="$env_dir/@exe@"
|
2016-01-12 18:56:59 +01:00
|
|
|
|
|
|
|
update_path() {
|
2016-01-19 22:44:33 +01:00
|
|
|
local path="$1"
|
2016-01-12 18:56:59 +01: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 22:44:33 +01:00
|
|
|
ln -s "$env_dir/$path" "$DF_DIR/$path"
|
2016-01-12 18:56:59 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
forcecopy_path() {
|
2016-01-19 22:44:33 +01:00
|
|
|
local path="$1"
|
2016-01-12 18:56:59 +01:00
|
|
|
|
|
|
|
mkdir -p "$DF_DIR/$(dirname "$path")"
|
|
|
|
rm -rf "$DF_DIR/$path"
|
2016-01-19 22:44:33 +01:00
|
|
|
cp -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path"
|
2016-01-12 18:56:59 +01: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 22:44:33 +01:00
|
|
|
cd "$env_dir"
|
2016-01-12 18:56:59 +01:00
|
|
|
for i in data/init/* data/!(init|index|announcement) raw; do
|
2016-01-19 22:44:33 +01:00
|
|
|
update_path "$i"
|
2016-01-12 18:56:59 +01:00
|
|
|
done
|
|
|
|
|
2016-01-19 22:44:33 +01:00
|
|
|
forcecopy_path data/index
|
2016-01-12 18:56:59 +01:00
|
|
|
# For some reason, it's needed to be writable...
|
2016-01-19 22:44:33 +01:00
|
|
|
forcecopy_path data/announcement
|
2016-02-07 13:54:49 +01:00
|
|
|
forcecopy_path data/help
|
2016-02-10 19:37:54 +01:00
|
|
|
forcecopy_path data/dipscript
|