Browse Source

Update lmk scripts.

Poikilos 4 days ago
parent
commit
1137129c92
  1. 3
      utilities/install-lmk
  2. 45
      utilities/pull-lmk

3
utilities/install-lmk

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #!/usr/bin/python3 # #!/usr/bin/python3
# based on EnlivenMinetest/utilities/install-lmk # based on EnlivenMinetest/utilities/install-lmk
@ -15,6 +15,7 @@ Developers: If /opt/minebest/mtkit is present, that will be used.
See hierosoft.hminetestsrc documentation for more info. See hierosoft.hminetestsrc documentation for more info.
''' '''
from __future__ import print_function
import re import re
import sys import sys
import os import os

45
utilities/pull-lmk

@ -1,18 +1,53 @@
#!/bin/bash #!/bin/bash
OFFLINE=false OFFLINE=false
UPDATE_MIRROR=false
for var in "$@" for var in "$@"
do do
if [ "x$var" == "x--offline" ]; then if [ "x$var" == "x--offline" ]; then
OFFLINE=true OFFLINE=true
elif [ "x$var" == "x--update-mirror" ]; then
UPDATE_MIRROR=true
fi fi
done done
if [ -d "/opt/rjkbin" ]; then if [ -d "/opt/rjkbin" ]; then
echo "Error: This should *not* be run on the server that has the master copy." echo "Error: This should *not* be run on the server that has the master copy."
exit 1 exit 1
fi 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= 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 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 "assemble/***" \
--include "mtbin/***" \ --include "mtbin/***" \
--include "mtcache/***" \ --include "mtcache/***" \
@ -23,13 +58,15 @@ if [ "x$OFFLINE" = "xfalse" ]; then
code=$? code=$?
if [ $code -eq 0 ]; then if [ $code -eq 0 ]; then
echo "[pull-lmk] * downloading /opt/minebest...OK" echo "[pull-lmk] OK (Downloading /opt/minebest)"
else else
echo "[pull-lmk] * downloading /opt/minebest...FAILED" echo "[pull-lmk] FAILED (Downloading /opt/minebest)"
exit $code exit $code
fi fi
fi fi
echo
echo
echo "Performing build locally..."
# l: copy symlinks as symlinks # l: copy symlinks as symlinks
# L: transform symlink into referent file/dir # L: transform symlink into referent file/dir
# except this one (master copy on build server points to /var/mtworlds!): # except this one (master copy on build server points to /var/mtworlds!):

Loading…
Cancel
Save