diff options
Diffstat (limited to 'tmwdelta.sh')
-rwxr-xr-x | tmwdelta.sh | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/tmwdelta.sh b/tmwdelta.sh index d003ed2..e8e8f6e 100755 --- a/tmwdelta.sh +++ b/tmwdelta.sh @@ -5,25 +5,37 @@ repofile="https://github.com/themanaworld/tmwa-client-data/archive/master.zip" # repofile First directory name repofirstdir="tmwa-client-data-master" +# Music repo +musicrepo="https://github.com/themanaworld/tmw-music/archive/master.zip" +# repofile First directory name +musicrepofirstdir="tmw-music-master" + # Modified data info patchrepoaddr="liviorecchia.gitlab.io" -patchreponame="testworld" +patchreponame="tmw-warworld" +# It must be an absolute path to your existing client data repo. It doesn't matter if it's empty +patchrepopath=$HOME/tmw_devel/$patchreponame # That's the directory with content modified from original zip NOT the modified repo patchdir="_patch" # Working file names repotemp="original.zip" +repotempmusic="music.zip" update(){ echo "Downloading original files" rm $repotemp wget $repofile -O $repotemp + wget $musicrepo -O $repotempmusic + } restore(){ echo "Uncompressing original data" rm $repofirstdir -Rf unzip $repotemp + rm $musicrepofirstdir -Rf + unzip $repotempmusic rm ../_uncompressed -Rf } @@ -34,44 +46,47 @@ patch(){ mkdir _uncompressed # copy TMW files and then those in patching directory cp $repofirstdir/* _uncompressed/ -urf --preserve=all + cp $musicrepofirstdir/* _uncompressed/music -urf --preserve=all + echo "Patching original data" cp $patchdir/* _uncompressed/ -rf #--preserve=all # remove all _includes.xml files from patching directory! echo "Packing files for updates" - mkdir $patchreponame cd _uncompressed # change to uncompressed patched files directory # Zip compress any subdirectory (-r), show the remaining data to be compressed (-db), maxing out compression -0, and following file system updates (-FS) - zip ../$patchreponame/graphics -r -0 -FS graphics - zip ../$patchreponame/items -r -0 -FS items - zip ../$patchreponame/maps -r -0 -FS maps - zip ../$patchreponame/monsters -r -0 -FS monsters - zip ../$patchreponame/music -r -0 -FS music - zip ../$patchreponame/npcs -r -0 -FS npcs - zip ../$patchreponame/quests -r -0 -FS quests - zip ../$patchreponame/rules -r -0 -FS rules - zip ../$patchreponame/sfx -r -0 -FS sfx - zip ../$patchreponame/tilesets -r -0 -FS tilesets - zip ../$patchreponame/rootdir -r -0 -FS *.* + zip $patchrepopath/graphics -r -0 -FS graphics + zip $patchrepopath/items -r -0 -FS items + zip $patchrepopath/maps -r -0 -FS maps + zip $patchrepopath/monsters -r -0 -FS monsters + zip $patchrepopath/music -r -0 -FS music + zip $patchrepopath/npcs -r -0 -FS npcs + zip $patchrepopath/quests -r -0 -FS quests + zip $patchrepopath/rules -r -0 -FS rules + zip $patchrepopath/sfx -r -0 -FS sfx + zip $patchrepopath/tilesets -r -0 -FS tilesets + zip $patchrepopath/rootdir -r -0 -FS *.* cd .. echo "Computing resources' adler32 checksums" - cd $patchreponame # entering repo directory + #cd $patchreponame # entering repo directory #jacksum -a adler32 -x *.zip > .za32 # writing a temp file with checksums - ../adler32 0 *.zip > .za32 +thisdir=$(pwd) +cd $patchrepopath + $($thisdir/adler32 0 *.zip > .za32) echo "Creating resource.xml" declare -a array readarray -t array < .za32 - echo '<?xml version="1.0"?>' > resources.xml # overwrite resource file - echo '<updates>' >> resources.xml + echo '<?xml version="1.0"?>' > $patchrepopath/resources.xml # overwrite resource file + echo '<updates>' >> $patchrepopath/resources.xml for element in "${array[@]}" # scan temp file lines for data do IFS=$(echo -e ' \t ') read -r -a array2 <<< "${element}" # split by tabs - echo "<update type='data' file='${array2[0]}' hash='${array2[1]}'/>" >> resources.xml + echo "<update type='data' file='${array2[0]}' hash='${array2[1]}'/>" >> $patchrepopath/resources.xml done - echo '</updates>' >> resources.xml + echo '</updates>' >> $patchrepopath/resources.xml rm .za32 # remove temp file #echo "Deleting uncompressed directory" #rm ../_uncompressed -Rf @@ -81,11 +96,12 @@ patch(){ mkdir $HOME/.local/share/mana/updates/$patchrepoaddr/$patchreponame/ cp *.zip $HOME/.local/share/mana/updates/$patchrepoaddr/$patchreponame/ cp resources.xml $HOME/.local/share/mana/updates/$patchrepoaddr/$patchreponame/resources.xml + chmod 0777 $HOME/.local/share/mana/updates/$patchrepoaddr/$patchreponame -R } push(){ echo "Git pushing" - cd $patchreponame + cd $patchrepopath git add . git commit -m "Test of resource packing" git push -u origin master |