#!/bin/sh # Give the sbtest channel5 core its own locale and data dir so install_maps.py never touches the live ones. # sbtest/share/locale/newcibn = symlinks to every live newcibn entry, except real copies of # group.txt, group_group.txt, mob_drop_item.txt and a real map/ dir (symlinks to each live map dir + a copied index). # sbtest/share/data = symlinks to the live data entries, except a real monster/ dir (symlinks per live folder). # Idempotent: existing entries are kept, so a rerun only adds what the live locale gained since. # Run on 203: sh sbtest_locale.sh (restart channel5 afterwards) set -e LIVE=/usr/metin2/server/share/locale SB=/usr/metin2/server/sbtest/share/locale CORE=/usr/metin2/server/channel5/first LIVEMAP=$(cd "$LIVE/newcibn/map" && pwd -P) LIVEDATA=/usr/metin2/server/share/data SBDATA=/usr/metin2/server/sbtest/share/data mkdir -p "$SB/newcibn/map" [ -e "$SB/english" ] || ln -s "$LIVE/english" "$SB/english" for e in "$LIVE"/newcibn/*; do n=${e##*/} case $n in map) continue ;; esac [ -e "$SB/newcibn/$n" ] || [ -L "$SB/newcibn/$n" ] && continue case $n in group.txt|group_group.txt) cp -p "$e" "$SB/newcibn/$n" ;; *) ln -s "$e" "$SB/newcibn/$n" ;; esac done # entries made into copies after the farm was first built for n in group.txt group_group.txt mob_drop_item.txt; do [ -L "$SB/newcibn/$n" ] && rm "$SB/newcibn/$n" && cp -p "$LIVE/newcibn/$n" "$SB/newcibn/$n" && echo "$n copied" done for e in "$LIVEMAP"/*; do n=${e##*/} [ -e "$SB/newcibn/map/$n" ] || [ -L "$SB/newcibn/map/$n" ] && continue case $n in index) cp -p "$e" "$SB/newcibn/map/index" ;; *) ln -s "$e" "$SB/newcibn/map/$n" ;; esac done mkdir -p "$SBDATA/monster" for e in "$LIVEDATA"/*; do n=${e##*/} [ "$n" = monster ] || [ -e "$SBDATA/$n" ] || [ -L "$SBDATA/$n" ] || ln -s "$e" "$SBDATA/$n" done for e in "$LIVEDATA"/monster/*; do [ -e "$SBDATA/monster/${e##*/}" ] || [ -L "$SBDATA/monster/${e##*/}" ] || ln -s "$e" "$SBDATA/monster/${e##*/}" done repoint() # { [ "$(readlink "$1")" = "$2" ] && return 0 echo "$1 was $(readlink "$1")" rm "$1" && ln -s "$2" "$1" } repoint "$CORE/locale" "$SB" repoint "$CORE/data" "$SBDATA" echo "channel5 locale -> $(readlink "$CORE/locale"); $(ls "$SB/newcibn" | wc -l) entries, $(ls "$SB/newcibn/map" | wc -l) map entries" echo "channel5 data -> $(readlink "$CORE/data"); $(ls "$SBDATA/monster" | wc -l) monster folders"