|
|
|
@ -1,18 +1,53 @@ |
|
|
|
#!/bin/bash |
|
|
|
OFFLINE=false |
|
|
|
UPDATE_MIRROR=false |
|
|
|
for var in "$@" |
|
|
|
do |
|
|
|
if [ "x$var" == "x--offline" ]; then |
|
|
|
OFFLINE=true |
|
|
|
elif [ "x$var" == "x--update-mirror" ]; then |
|
|
|
UPDATE_MIRROR=true |
|
|
|
fi |
|
|
|
done |
|
|
|
if [ -d "/opt/rjkbin" ]; then |
|
|
|
echo "Error: This should *not* be run on the server that has the master copy." |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
if [ -f ~/.config/EnlivenMinetest/settings.rc ]; then |
|
|
|
source ~/.config/EnlivenMinetest/settings.rc |
|
|
|
else |
|
|
|
>&2 echo "No ~/.config/EnlivenMinetest/settings.rc, using defaults." |
|
|
|
fi |
|
|
|
DEFAULT_MINEBEST_HOST=mtio |
|
|
|
if [ -z "$MINEBEST_HOST" ]; then |
|
|
|
MINEBEST_HOST=$DEFAULT_MINEBEST_HOST |
|
|
|
fi |
|
|
|
echo "MINEBEST_HOST=$MINEBEST_HOST" |
|
|
|
code= |
|
|
|
if [ ! -d "/opt/minebest" ]; then |
|
|
|
cat <<END |
|
|
|
/opt/minebest does not exist. First do: |
|
|
|
sudo mkdir /opt/minebest |
|
|
|
sudo chown -R $USER:$USER /opt/minebest |
|
|
|
END |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
if [ "x$OFFLINE" = "xfalse" ]; then |
|
|
|
rsync -rtlv --delete mtio:/opt/minebest/ /opt/minebest \ |
|
|
|
if [ "$UPDATE_MIRROR" = "true" ]; then |
|
|
|
if [ "$MINEBEST_HOST" != "$DEFAULT_MINEBEST_HOST" ]; then |
|
|
|
echo "Asking $MINEBEST_HOST to update its own copy of minebest..." |
|
|
|
ssh "$MINEBEST_HOST" 'rsync -rtlv --delete mtio:/opt/minebest/ /opt/minebest \ |
|
|
|
--include "assemble/***" \ |
|
|
|
--include "mtbin/***" \ |
|
|
|
--include "mtcache/***" \ |
|
|
|
--include "mtkit/***" \ |
|
|
|
--include "mtkit.txt" \ |
|
|
|
--exclude "*"' |
|
|
|
fi |
|
|
|
fi |
|
|
|
echo "Updating minebest from $MINEBEST_HOST..." |
|
|
|
|
|
|
|
rsync -rtlv --delete $MINEBEST_HOST:/opt/minebest/ /opt/minebest \ |
|
|
|
--include "assemble/***" \ |
|
|
|
--include "mtbin/***" \ |
|
|
|
--include "mtcache/***" \ |
|
|
|
@ -23,13 +58,15 @@ if [ "x$OFFLINE" = "xfalse" ]; then |
|
|
|
code=$? |
|
|
|
|
|
|
|
if [ $code -eq 0 ]; then |
|
|
|
echo "[pull-lmk] * downloading /opt/minebest...OK" |
|
|
|
echo "[pull-lmk] OK (Downloading /opt/minebest)" |
|
|
|
else |
|
|
|
echo "[pull-lmk] * downloading /opt/minebest...FAILED" |
|
|
|
echo "[pull-lmk] FAILED (Downloading /opt/minebest)" |
|
|
|
exit $code |
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
echo |
|
|
|
echo |
|
|
|
echo "Performing build locally..." |
|
|
|
# l: copy symlinks as symlinks |
|
|
|
# L: transform symlink into referent file/dir |
|
|
|
# except this one (master copy on build server points to /var/mtworlds!): |
|
|
|
|