Browse Source

Add web install for minetestmapper from source.

master
poikilos 5 years ago
parent
commit
f370cb89e8
  1. 38
      minetestmapper-deps.sh
  2. 55
      minetestmapper-web-install.sh

38
minetestmapper-deps.sh

@ -0,0 +1,38 @@
#!/bin/bash
customDie() {
echo
echo
echo "ERROR:"
echo "$1"
echo "You'll need to manually install:"
echo "libgd sqlite3 LevelDB hiredis Postgres"
echo
echo
exit 1
}
PACKAGE_TYPE=
if [ -f "`command -v apt`" ]; then
INSTALL_CMD="apt -y install"
PACKAGE_TYPE="deb"
elif [ -f "`command -v apt-get`" ]; then
INSTALL_CMD="apt-get -y install"
PACKAGE_TYPE="deb"
elif [ -f "`command -v dnf`" ]; then
INSTALL_CMD="dnf -y install"
PACKAGE_TYPE="rpm"
elif [ -f "`command -v yum`" ]; then
INSTALL_CMD="yum -y install"
PACKAGE_TYPE="rpm"
else
customDie "Your package system is not implemented in this script."
fi
if [ "@$PACKAGE_TYPE" = "@deb" ]; then
sudo $INSTALL_CMD libgd-dev libsqlite3-dev libleveldb-dev libhiredis-dev libpq-dev
elif [ "@$PACKAGE_TYPE" = "@rpm" ]; then
sudo $INSTALL_CMD gd-devel sqlite-devel leveldb-devel hiredis-devel libpq-devel
else
customDie "The package names for your OS are unknown."
fi

55
minetestmapper-web-install.sh

@ -0,0 +1,55 @@
#!/bin/bash
customDie() {
echo
echo
echo "ERROR:"
echo "$1"
echo
echo
exit 1
}
_REPO_NAME=minetestmapper
if [ -z "$_INSTALL_PATH" ]; then
_INSTALL_PATH="$HOME/$_REPO_NAME"
fi
_EXE_NAME=minetestmapper
_REPO_URL="https://github.com/minetest/$_REPO_NAME.git"
if [ -z "$REPOS_PATH" ]; then
REPOS_PATH=~/Downloads/git
fi
mkdir -p $REPOS_PATH
REPO_PATH="$REPOS_PATH/$_REPO_NAME"
if [ ! -d "$REPOS_PATH" ]; then
mkdir -p "$REPOS_PATH" || customDie "mkdir -p \"$REPOS_PATH\" failed."
fi
cd "$REPOS_PATH" || customDie "cd \"$REPOS_PATH\" failed."
if [ -d "$REPO_PATH" ]; then
cd "$REPO_PATH" || customDie "cd \"$REPO_PATH\" failed."
git pull || customDie "git pull failed in `pwd`."
else
git clone "$_REPO_URL" "$REPO_PATH" || customDie "git clone \"$_REPO_URL\" \"$REPO_PATH\" failed."
fi
echo "* compiling in `pwd`..."
cmake . -DENABLE_LEVELDB=1 -DENABLE_POSTGRES=1 -DENABLE_REDIS=1 || customDie "cmake . failed in `pwd`."
make -j$(nproc) || customDie "make failed in `pwd`."
_EXE_PATH="`pwd`/$_EXE_NAME"
if [ -f "$_EXE_PATH" ]; then
echo "* finished compiling \"$_EXE_PATH\""
mkdir -p "$_INSTALL_PATH" || "mkdir -p \"$_INSTALL_PATH\" failed."
#cp "$_EXE_PATH" "$_INSTALL_PATH" || "cp \"$_EXE_PATH\" \"$_INSTALL_PATH\" failed."
rsync -rtu "`pwd`/" "$_INSTALL_PATH" || "rsync -rtu \"`pwd`/\" \"$_INSTALL_PATH\" failed."
# -u: skip files that are newer on the receiver
EXE_DEST_PATH="$_INSTALL_PATH/$_EXE_NAME"
if [ -f "$EXE_DEST_PATH" ]; then
echo "* installed \"$EXE_DEST_PATH\""
else
customDie "* installing \"$EXE_DEST_PATH\" failed."
fi
else
echo "* finished compiling in `pwd` (but $_EXE_PATH was not detected)"
fi
Loading…
Cancel
Save