User Tools

Site Tools


dev:tutorials:repository

Setting up a repository

A shinsekai repository is a direct-link http directory containing two manifest files (client.manifest and server.manifest). A manifest file is a list of files, one per line : “<relative_path> <signature>“ (folders or files with space in the name will not work properly).

Example of manifests:

server.manifest
MovementTool.lua 9996528134ae1229601975f77e5b72aa
Manager.lua 79e70af2e6caa372057d477320843d2e
objects/hemisphere.sho 15d48c6f7f8c15837981ea9919182127
objects/death_respawn.sho 7bb3225f42b9e1443cfa4920b666d02b
objects/cube.sho ff0a692a1083d814febb4f8fd52bf978
client.manifest
textures/skydome_night.jpg 511fa8789cd314353b04cc23302a2615
MovementTool.lua 9996528134ae1229601975f77e5b72aa
Manager.lua 79e70af2e6caa372057d477320843d2e
objects/hemisphere.sho 15d48c6f7f8c15837981ea9919182127
objects/death_respawn.sho 7bb3225f42b9e1443cfa4920b666d02b
objects/cube.sho ff0a692a1083d814febb4f8fd52bf978

(the texture will only be downloaded by the clients)

In this case, the signatures are generated using md5sum, but you can use any signature you want (without space characters). When downloading a repository, the manifest file is compared with the local manifest file, checking differences and updating changes.

Here is an example bash script used to generate a manifest file in the current directory:

repo-hash.sh
#!/bin/bash
 
files=$(find -type f -not -name "*.manifest" -not -name "*.sh" -not -name "*~" -not -name ".*" -not -path "*/.*/*")
 
for file in $files
do
  if [[ $file != $0 ]]
  then
    md5=$(md5sum $file | tr -s " " | cut -d" " -f1)
    name=$(echo $file | sed "s/^..\(.*\)$/\1/g")
    echo "$name $md5"
  fi
done
./repo-hash.sh > server.manifest && cp server.manifest client.manifest
# you can then delete the lines that aren't shared in each manifest

A more structured way could be the creation of three sub-directories “client”, “server” and “common”, then add specific resources to them and generate the two manifest files by looking in those directories.

Each file and directory listed in the manifest should be available in direct download, also be sure to set the correct permissions.

chmod -R 777 . # the barbarian way
dev/tutorials/repository.txt · Last modified: 2017/04/03 01:52 by archzenvald