diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-01-20 00:44:33 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-01-26 03:06:07 +0300 |
commit | d3b642ce9ad056b60d8cfa576dd3fa800ec57ba4 (patch) | |
tree | 9149b17b22e896a5d966d9fab00d48ea74deb108 /pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in | |
parent | 7fe01a7279a8a9630ac42b2c7c9dd291c4a7a9a9 (diff) |
dwarf-fortress-wrapper: add themes support
Theme can be specified either as a derivation or as a string, in which case it will be taken by name from a pre-defined set of themes available in nixpkgs.
Diffstat (limited to 'pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in')
-rw-r--r-- | pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in index ac59934f767d1..1fd6178895db2 100644 --- a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in +++ b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in @@ -1,27 +1,25 @@ shopt -s extglob [ -z "$DF_DIR" ] && DF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux" -game_dir="@dwarfFortress@" +env_dir="@env@" update_path() { - local pkg_dir="$1" - local path="$2" + local path="$1" 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" - ln -s "$pkg_dir/$path" "$DF_DIR/$path" + ln -s "$env_dir/$path" "$DF_DIR/$path" fi } forcecopy_path() { - local pkg_dir="$1" - local path="$2" + local path="$1" mkdir -p "$DF_DIR/$(dirname "$path")" rm -rf "$DF_DIR/$path" - cp -rL --no-preserve=all "$pkg_dir/$path" "$DF_DIR/$path" + cp -rL --no-preserve=all "$env_dir/$path" "$DF_DIR/$path" } mkdir -p "$DF_DIR" @@ -33,11 +31,11 @@ We try to detect changes based on data directories being symbolic links -- keep EOF -cd "$game_dir" +cd "$env_dir" for i in data/init/* data/!(init|index|announcement) raw; do - update_path "$game_dir" "$i" + update_path "$i" done -forcecopy_path "$game_dir" data/index +forcecopy_path data/index # For some reason, it's needed to be writable... -forcecopy_path "$game_dir" data/announcement +forcecopy_path data/announcement |