Browse Source

improved installer scripts

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
e403becad5
  1. 17
      README.md
  2. 3
      chunkymap-cronjob
  3. 3
      chunkymap-regen.sh
  4. 6
      get_python_architecture.py
  5. 10
      install-chunkymap-on-ubuntu-from-web.sh
  6. 25
      install-chunkymap-on-ubuntu.sh
  7. 2
      mapper-pyarch.py
  8. 39
      replace-with-current-user.py
  9. 2
      set-minutely-crontab-job.sh

17
README.md

@ -9,15 +9,20 @@ This program comes without any warranty, to the extent permitted by applicable l
## Requirements:
* A minetest version compatible with minetestmapper-numpy.py Made by Jogge, modified by celeron55
* Python 2.7 (any 2.7.x)
* Other requirements for Windows are below; other requirements for Ubuntu are installed by install-chunkymap-on-ubuntu.sh (for other distros, modify it and send me a copy as a GitHub issue as described below in the Installation section)
* Other requirements for Windows are below; other requirements for GNU/Linux are flock command (only if you schedule the chunkymap-cronjob script), and anything installed by install-chunkymap-on-ubuntu.sh (for other distros, modify it and send me a copy as a GitHub issue as described below in the Installation section)
## Installation
(NOTE: map refresh skips existing tiles unless you delete the related png and text files in your chunkymapdata folder)
* change set-minutely-crontab-job.sh to replace "owner" with the user that has the minetest folder (with util folder under it, not .minetest)
* Install the git version of minetest (or otherwise install 0.4.13 or other version compatible with the map generators used by chunkymap)
* IF you are using Ubuntu go to a terminal, cd to this folder, then run
* If you are not using Ubuntu, first edit the installer for your distro (and please send the modified file to me [submit as new issue named such as: DISTRONAME installer except instead of DISTRONAME put the distro you made work])
* If you are using Ubuntu
* Install the git version of minetest (or otherwise install 0.4.13 or other version compatible with the map generators used by chunkymap)
OPTION 2: IF you are using Ubuntu go to a terminal, cd to this folder,
then switch user to the one that will run minetestserver
(since install-chunkymap-on-ubuntu.sh DOES replace "/home/owner" with current user's home in all chunkymap scripts in destination folder)
then go to Terminal and run:
`minetestserver`
then when it is finished loading, press Ctrl C then run:
`chmod +x install-chunkymap-on-ubuntu.sh && ./install-chunkymap-on-ubuntu.sh`
otherwise first edit the file for your distro (and please send the modified file to me [submit as new issue named such as: DISTRONAME installer except instead of DISTRONAME put the distro you made work])
* IF you are using a distro such as Ubuntu 14.04 where first line of /etc/crontab is "m h dom mon dow user command" then if you want regular refresh of map then run
(otherwise first edit the script to fit your crontab then)
`chmod +x set-minutely-crontab-job.sh && ./set-minutely-crontab-job.sh`
@ -25,7 +30,7 @@ This program comes without any warranty, to the extent permitted by applicable l
* put these files anywhere
* manually schedule a task in Task Scheduler to run C:\Python27\python chunkymap-regen.py every minute
* python 2.7.x such as from python.org
* run mapper-pyarch.py to make sure you know whether to download the following in 32-bit or 64-bit
* run get_python_architecture.py to make sure you know whether to download the following in 32-bit or 64-bit
Administrator Command Prompt (to find it in Win 10, right-click windows menu)
* update python package system:
`C:\python27\python -m pip install --upgrade pip wheel setuptools`

3
chunkymap-cronjob

@ -1,3 +1,4 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
python /home/owner/minetest/utils/chunkymap-regen.py
#python /home/owner/minetest/utils/chunkymap-regen.py
flock -n /var/run/chunkymap-regen.lockfile -c /home/owner/minetest/util/chunkymap-regen.sh

3
chunkymap-regen.sh

@ -0,0 +1,3 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
python /home/owner/minetest/utils/chunkymap-regen.py

6
get_python_architecture.py

@ -0,0 +1,6 @@
import platform
print ""
print platform.architecture()[0]
print ""
print "Your architecture (64-bit or 32-bit) should be shown above."
input("Press enter to exit.")

10
install-chunkymap-on-ubuntu-from-web.sh

@ -0,0 +1,10 @@
#!/bin/sh
cd ~/minetest-stuff
rm master.zip
wget https://github.com/expertmm/minetest-chunkymap/archive/master.zip
mv master.zip minetest-chunkymap.zip
unzip minetest-chunkymap.zip
mv minetest-chunkymap-master minetest-chunkymap
cd minetest-chunkymap
chmod +x install-chunkymap-on-ubuntu.sh
./install-chunkymap-on-ubuntu.sh

25
install-chunkymap-on-ubuntu.sh

@ -1,9 +1,24 @@
#!/bin/sh
MINETEST_UTIL=$HOME/minetest/util
CHUNKYMAP_DEST=$MINETEST_UTIL
sudo apt-get install python-numpy python-pil
cd ~
rm -f ~/minetestmapper-numpy.py
wget https://github.com/spillz/minetest/raw/master/util/minetestmapper-numpy.py
#cd ~
#rm -f ~/minetestmapper-numpy.py
#wget https://github.com/spillz/minetest/raw/master/util/minetestmapper-numpy.py
#since colors.txt is in ~/minetest/util:
mv minetestmapper-numpy.py ~/minetest/util/minetestmapper-numpy.py
cp
cp -f minetestmapper-numpy.py $HOME/minetest/util/minetestmapper-numpy.py
mkdir "$CHUNKYMAP_DEST"
cp -f chunkymap-regen.py "$CHUNKYMAP_DEST/"
#chmod +x "$CHUNKYMAP_DEST/chunkymap-regen.py"
cp -f chunkymap-regen.sh "$CHUNKYMAP_DEST/"
chmod +x "$CHUNKYMAP_DEST/chunkymap-regen.sh"
cp -f chunkymap-cronjob "$CHUNKYMAP_DEST/"
chmod +x "$CHUNKYMAP_DEST/chunkymap-cronjob"
cp -f set-minutely-crontab-job.sh "$CHUNKYMAP_DEST/"
chmod +x "$CHUNKYMAP_DEST/set-minutely-crontab-job.sh"
python replace-with-current-user.py
# NOTE: colors.txt should ALREADY be in ~/minetest/util

2
mapper-pyarch.py

@ -1,2 +0,0 @@
import platform
print platform.architecture()[0]

39
replace-with-current-user.py

@ -0,0 +1,39 @@
#!/usr/bin/env python2
import os
from os.path import expanduser
filenames = list()
filenames.append("chunkymap-cronjob")
filenames.append("chunkymap-regen.sh")
filenames.append("set-minutely-crontab-job.sh")
home_path = expanduser("~")
home_minetest_chunkymap_path = os.path.join(home_path,"minetest/util")
#for dirname, dirnames, filenames in os.walk(home_minetest_chunkymap_path):
if "\\" not in home_minetest_chunkymap_path:
if os.path.isdir(home_minetest_chunkymap_path):
for filename in filenames:
file_path = os.path.join(home_minetest_chunkymap_path, filename)
temp_path = file_path+".tmp"
os.rename(file_path, temp_path)
if not os.path.isfile(file_path):
ins = open(temp_path, 'r')
outs = open(file_path, 'w')
line = True
while line:
line = ins.readline()
if line:
line = line.replace("/home/owner", home_path)
outs.write(line, "\n")
outs.close()
os.remove(temp_path)
ins.close()
else:
print "FAILED to rewrite the file '"+file_path+"' (to change minetest util path to '"+home_minetest_chunkymap_path+"')--perhaps it is in use. Make the file writeable then try running "+__FILE__+" again."
input("Press enter to continue...")
else:
print "FAILED to find '"+home_minetest_chunkymap_path+"'"
print "Please install a compatible version of minetest-server package, run minetestserver once, then if you were running a chunkymap installer that called this py file, re-run that installer (otherwise re-run this script if you are sure that installer was successful)."
input("Press enter to continue...")
else:
print "This script only works on GNU/Linux systems (it is not needed on Windows, since on Windows, chunkymap will detect the scripts and colors.txt in the same folder as itself instead of using the minecraftserver minetest/util folder)"

2
set-minutely-crontab-job.sh

@ -3,4 +3,4 @@ sudo su -
# NOTE: this works only since user is a field on Ubuntu (on some GNU/Linux systems it is not, which is implied by omission at http://www.adminschoice.com/crontab-quick-reference)
# Minute, Hour, Day of Month, Month (1 to 12), Day of Week
# m h dom mon dow user command
echo "* * * * * root /home/owner/minetest/utils/chunkymap-cronjob" >> /etc/crontab
echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> /etc/crontab
Loading…
Cancel
Save