2021-06-29 04:42:37 +02:00
|
|
|
#!@stdenv_shell@ -e
|
2016-01-12 18:56:59 +01:00
|
|
|
shopt -s extglob
|
|
|
|
|
2020-08-21 22:54:25 +02:00
|
|
|
[ -z "$DF_DIR" ] && export 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
|
|
|
|
2021-06-29 04:42:37 +02:00
|
|
|
@mkdir@ -p "$DF_DIR/$(dirname "$path")"
|
2016-01-12 18:56:59 +01:00
|
|
|
# If user has replaced these data directories, let them stay.
|
|
|
|
if [ ! -e "$DF_DIR/$path" ] || [ -L "$DF_DIR/$path" ]; then
|
2021-06-29 04:42:37 +02:00
|
|
|
@rm@ -f "$DF_DIR/$path"
|
|
|
|
@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
|
|
|
|
2021-06-29 04:42:37 +02:00
|
|
|
@mkdir@ -p "$DF_DIR/$(dirname "$path")"
|
|
|
|
@rm@ -rf "$DF_DIR/$path"
|
|
|
|
@cp@ -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path"
|
2016-01-12 18:56:59 +01:00
|
|
|
}
|
|
|
|
|
2021-06-29 04:42:37 +02:00
|
|
|
@mkdir@ -p "$DF_DIR"
|
2016-01-12 18:56:59 +01:00
|
|
|
|
2021-06-29 04:42:37 +02:00
|
|
|
@cat@ <<EOF >&2
|
2016-01-12 18:56:59 +01:00
|
|
|
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
|