Browse Source

improved installer

can install to any directory now (since program has its own scripts and
colors.txt), and installer installs to chunkymap folder in HOME folder
master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
9cd252b736
  1. 10
      README.md
  2. 4
      chunkymap-regen.py
  3. 2
      chunkymap-signals example - verbose_enable True.txt
  4. 0
      colors-missing.txt
  5. 4
      install-chunkymap-on-ubuntu-from-web.sh
  6. 57
      install-chunkymap-on-ubuntu.sh
  7. 2
      install-chunkymap-on-windows.py
  8. 12
      minetestoffline.py
  9. 6
      replace-with-current-user.py
  10. 4
      unused/chunkymap-cronjob
  11. 4
      unused/chunkymap-players-cronjob
  12. 2
      unused/chunkymap-regen-players.sh
  13. 2
      unused/chunkymap-regen.sh
  14. 2
      unused/set-minutely-crontab-job.sh
  15. 2
      unused/set-minutely-players-crontab-job.sh
  16. 21
      update-chunkymap-installer-only.sh
  17. 15
      update-chunkymap-on-ubuntu-from-web.sh

10
README.md

@ -10,7 +10,7 @@ This program comes without any warranty, to the extent permitted by applicable l
* Runs as python script (loop by default to reduce disc reads since stores certain info) run like:
python chunkymap-regen.py
or to get back to it later with screen -r, instead install screen command (or tmux may work) then run:
screen -t chunkymapregen python /home/owner/minetest/util/chunkymap-regen.py
screen -t chunkymapregen python $HOME/chunkymap/chunkymap-regen.py
#where -t chunkymapregen just names the screen chunkymapregen
#Then if you are using screen and want to leave the output without terminating the process press Ctrl a d
#NOTE: now that loop is default, cron job scripts, which now disable loop for compatibility with new version, are ALL optional and NOT recommended
@ -18,9 +18,9 @@ This program comes without any warranty, to the extent permitted by applicable l
* Change program options (or stop it) while looping or rendering by placing chunkymap-signals.txt in the same directory as chunkymap-regen.py (see chunkymap-signals example files)
* to maintain stability of your text editor, save the file, close it, then move/copy it to the directory (or save it as something else then rename it to chunkymap-signals.txt).
* alternatively, in *nix do something like:
echo "refresh_map_enable:False" > ~/minetest/util/chunkymap-signals.txt
echo "refresh_map_enable:False" > $HOME/chunkymap/chunkymap-signals.txt
sleep 15s
echo "loop_enable:False" > ~/minetest/util/chunkymap-signals.txt
echo "loop_enable:False" > $HOME/chunkymap/chunkymap-signals.txt
* list of signals:
loop_enable:True
loop_enable:False
@ -83,7 +83,7 @@ world_path
* 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 directory,
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 [replace-with-current-user.py, which is automatically called by install, will change /home/owner to current user's directory in each script that install copies to $HOME/minetest/util])
(since install-chunkymap-on-ubuntu.sh DOES replace "/home/owner" with current user's home [replace-with-current-user.py, which is automatically called by install, will change /home/owner to current user's directory in each script that install copies to $HOME/chunkymap])
then go to Terminal and run:
`minetestserver`
then when it is finished loading, press Ctrl C then run:
@ -108,7 +108,7 @@ world_path
* Run install-chunkymap-on-windows.bat
(which just runs C:\Python27\python install-chunkymap-on-windows.py)
(the installer will automatically download and install numpy and Pillow)
* OPTIONAL manual install:
* or OPTIONALLY manual install what the above script does:
* put these files anywhere
* python 2.7.x such as from python.org
* run get_python_architecture.py to make sure you know whether to download the following in 32-bit or 64-bit

4
chunkymap-regen.py

@ -862,8 +862,8 @@ class MTChunks:
# cmd_string = "/usr/games/minetest-mapper --input \""+minetestinfo.get_var("primary_world_path")+"\" --draworigin --geometry "+geometry_value_string+" --output \""+tmp_png_path+"\""+cmd_suffix
# such as sudo python minetestmapper --input "/home/owner/.minetest/worlds/FCAGameAWorld" --geometry -32:-32+64+64 --output /var/www/html/minetest/try1.png
# OR try PYTHON version (looks for expertmm fork which has geometry option like C++ version does):
#script_path = "/home/owner/minetest/util/minetestmapper.py"
#region_capable_script_path = "/home/owner/minetest/util/chunkymap/minetestmapper.py"
#script_path = "$HOME/chunkymap/minetestmapper.py"
#region_capable_script_path = "$HOME/chunkymap/minetestmapper-expertmm.py"
# region_capable_script_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minetestmapper.py")
# if os.path.isfile(region_capable_script_path):
# script_path=region_capable_script_path

2
chunkymap-signals example - verbose_enable True.txt

@ -1,3 +1,3 @@
#or echo "verbose_enable:True" > $HOME/minetest/util/chunkymap-signals.txt
#or echo "verbose_enable:True" > $HOME/chunkymap/chunkymap-signals.txt
verbose_enable:True

0
nocolors.txt → colors-missing.txt

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

@ -1,6 +1,8 @@
#!/bin/sh
cd $HOME
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
if [ -d "$HOME/minetest-stuff/minetest-chunkymap" ]; then
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
fi
CHUNKYMAP_INSTALLER_DIR=$HOME/Downloads/minetest-chunkymap
if [ ! -d "$HOME/Downloads" ]; then
mkdir "$HOME/Downloads"

57
install-chunkymap-on-ubuntu.sh

@ -2,28 +2,42 @@
cd $HOME
MT_MY_WEBSITE_PATH=/var/www/html/minetest
if [ -d "$HOME/minetest-stuff/minetest-chunkymap" ]; then
#remove deprecated path:
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
fi
CHUNKYMAP_INSTALLER_PATH=$HOME/Downloads/minetest-chunkymap
if [ ! -d "$HOME/Downloads" ]; then
mkdir "$HOME/Downloads"
fi
if [ ! -d "$HOME/Downloads/minetest-chunkymap" ]; then
echo "please run install-chunkymap-on-ubuntu-from-web.sh or update-chunkymap-installer-only.sh first.";
else
#else run everything from here down
#MINETEST_UTIL=$HOME/minetest/util
#CHUNKYMAP_DEST=$MINETEST_UTIL
CHUNKYMAP_DEST=$HOME/chunkymap
MINETEST_UTIL=$HOME/minetest/util
CHUNKYMAP_DEST=$MINETEST_UTIL
#cd $HOME/Downloads
#rm -f $HOME/minetestmapper-numpy.py
#wget https://github.com/spillz/minetest/raw/master/util/minetestmapper-numpy.py
#since colors.txt is in $HOME/minetest/util:
cp -f "$CHUNKYMAP_INSTALLER_PATH/minetestmapper-numpy.py" "$HOME/minetest/util/minetestmapper-numpy.py"
#cp -f "$CHUNKYMAP_INSTALLER_PATH/minetestmapper-numpy.py" "$HOME/minetest/util/minetestmapper-numpy.py"
#if [ ! -d "$CHUNKYMAP_DEST" ]; then
# mkdir "$CHUNKYMAP_DEST"
#fi
#if [ ! -d "$CHUNKYMAP_DEST/unused/" ]; then
# mkdir "$CHUNKYMAP_DEST/unused/"
#fi
#NOTE: chmod +x is done last (see below)
mv -Rvf "$CHUNKYMAP_INSTALLER_PATH" "$CHUNKYMAP_DEST"
rm "$CHUNKYMAP_DEST/*.bat"
rm "$CHUNKYMAP_DEST/install-chunkymap-on-windows.py"
#region DEPRECATED
if [ ! -d "$CHUNKYMAP_DEST" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir "$CHUNKYMAP_DEST"
fi
if [ ! -d "$CHUNKYMAP_DEST/unused/" ]; then
mkdir "$CHUNKYMAP_DEST/unused/"
fi
cp -f "$CHUNKYMAP_INSTALLER_PATH/chunkymap-regen.py" "$CHUNKYMAP_DEST/"
#chmod +x "$CHUNKYMAP_DEST/chunkymap-regen.py"
@ -57,6 +71,14 @@ cp --no-clobber $CHUNKYMAP_INSTALLER_PATH/chunkymap-signals* "$CHUNKYMAP_DEST/"
cd "$CHUNKYMAP_INSTALLER_PATH"
python replace-with-current-user.py # the py file only manipulates the minetest/util directory
# so chmod those files AFTER running the py above (since it rewrites them and therefore removes x attribute if present):
fi
#endregion DEPRECATED
chmod +x "$CHUNKYMAP_DEST/chunkymap-regen-loop.sh"
chmod -x "$CHUNKYMAP_DEST/unused/chunkymap-regen.sh"
chmod -x "$CHUNKYMAP_DEST/unused/chunkymap-regen-players.sh"
@ -64,6 +86,14 @@ chmod -x "$CHUNKYMAP_DEST/unused/chunkymap-cronjob"
chmod -x "$CHUNKYMAP_DEST/unused/set-minutely-crontab-job.sh"
chmod -x "$CHUNKYMAP_DEST/unused/set-minutely-players-crontab-job.sh"
#if [ -f "$HOME/update-chunkymap-on-ubuntu-from-web.sh" ]; then
cp -f "HOME/chunkymap/update-chunkymap-on-ubuntu-from-web.sh" "HOME/update-chunkymap-on-ubuntu-from-web.sh"
#fi
#cp -f "HOME/chunkymap/install-chunkymap-on-ubuntu-from-web.sh" "HOME/install-chunkymap-on-ubuntu-from-web.sh"
rm "HOME/install-chunkymap-on-ubuntu-from-web.sh"
rm "HOME/mapper-refresh-minetestserver.bat"
rm "HOME/mapper-refresh-minetestserver"
sudo apt-get install python-numpy python-pil python-leveldb
echo ""
echo "To see what needs to be in your $MT_MY_WEBSITE_PATH directory (if you don't use that directory, modify chunkymap-regen.py to use your directory):"
@ -81,4 +111,5 @@ echo
# NOTE: colors.txt should ALREADY be in $HOME/minetest/util
fi

2
install-chunkymap-on-windows.py

@ -57,6 +57,7 @@ def web_get_DEPRECATED(url, file_name):
view_traceback()
return file_name
python_folder_path = os.path.dirname(sys.executable)
print("")
@ -201,6 +202,7 @@ if python_folder_name.lower()[:7]!="python3":
outs.close()
print(" OR by double-clicking")
print(" "+run_bat_path)
raw_input("Press enter to exit.")
else:
raw_input("Cannot detect nor install "+installed_pillow_path+" so installation cannot continue. Try downloading "+downloaded_pillow_name+" to '"+downloads_path+"' then run this script again. Press enter to exit.")
else:

12
minetestoffline.py

@ -55,6 +55,9 @@ if os.path.isdir(deprecated_players_offline_storage_path):
print("Using offline players_offline_storage_path:")
print(" "+players_offline_storage_path)
print(" (used for inventory recovery and other offline storage features)")
give_path = os.path.join(players_offline_storage_path, "give")
print("give_path:")
print(" (used for give commands for inventory leftover if more to transfer after filling destination inventory)")
#players_offline_storage_path = os.path.join("C:\\Users\\jgustafson\\Desktop\\Backup\\fcalocal\\home\\owner\\.minetest\\worlds\\FCAGameAWorld", players_offline_storage_name)
irl_person_csv_name = None
irl_person_csv_path = None
@ -94,7 +97,7 @@ class MinetestInventoryItem:
owner = None # optional, only used for debug output
name = None
qty = None
param = None
param = None # normally toolid
suffix = None
#If addend is negative, will return negative if can't take that many, otherwise 0
@ -640,6 +643,10 @@ def debug_log_replay_to_offline_player_storage(debug_txt_path, this_players_offl
#outs.write(line+"\n")
#outs.close()
def player_inventory_transfer(from_playerid, to_playerid):
from_player_path = os.path.join(players_path, from_playerid)
to_player_path = os.path.join(players_path, to_playerid)
to_player_givescript_path = os.path.join(give_path, to_playerid)
#recover_player_files_by_content("C:\\1.RaiseDataRecovery", "C:\\Users\\jgustafson\\Desktop\\Backup\\fcalocal\\home\\owner\\.minetest\\worlds\\FCAGameAWorld\\players")
@ -653,13 +660,12 @@ def debug_log_replay_to_offline_player_storage(debug_txt_path, this_players_offl
give_path = os.path.join(players_offline_storage_path, "give")
#convert_storage_to_give_commands_DEPRECATED(players_offline_storage_path, give_path, irl_person_csv_path)
#move_storage_to_players(players_offline_storage_path, players_path, give_path, change_player_position_enable=True)
### FOR TESTING PURPOSES:
# C:\Users\jgustafson\Desktop\Backup\fcalocal\home\owner\.minetest\worlds\FCAGameAWorld\players\
#minetestplayer = MinetestPlayer("mrg")

6
replace-with-current-user.py

@ -12,7 +12,7 @@ filenames.append(os.path.join("unused","set-minutely-crontab-job.sh"))
filenames.append("chunkymap-regen-loop.sh")
home_path = expanduser("~")
home_minetest_chunkymap_path = os.path.join(home_path,"minetest/util")
home_minetest_chunkymap_path = os.path.join(home_path,"chunkymap")
#home_minetest_chunkymap_unused_path = os.path.join(home_minetest_chunkymap_path, "unused")
#for dirname, dirnames, filenames in os.walk(home_minetest_chunkymap_path):
if "\\" not in home_minetest_chunkymap_path:
@ -35,7 +35,7 @@ if "\\" not in home_minetest_chunkymap_path:
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."
print "FAILED to rewrite the file '"+file_path+"' (to change chunkymap 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 "SKIPPED "+filename+" since not installed (probably ok since deprecated files are still listed here)"
@ -44,4 +44,4 @@ if "\\" not in 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 directory as itself instead of using the minecraftserver minetest/util directory)"
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 directory as itself instead of using the minetestserver chunkymap directory)"

4
unused/chunkymap-cronjob

@ -1,9 +1,9 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
#python /home/owner/minetest/util/chunkymap-regen.py
#python $HOME/chunkymap/chunkymap-regen.py
#-1 FOR LESS THAN ONE MINUTE AGO:
#lol won't work because if the py doesn't run the players won't be updated
#MT_PLAYERS_ACTIVE_COUNT=$(find /var/www/html/minetest/chunkymapdata/players -type f -mmin -1 | wc -l)
#if[ $MT_PLAYERS_ACTIVE_COUNT -gt 0 ]; then
flock -n /var/run/chunkymap-regen.lockfile -c /home/owner/minetest/util/chunkymap-regen.sh
flock -n /var/run/chunkymap-regen.lockfile -c $HOME/chunkymap/chunkymap-regen.sh
#fi

4
unused/chunkymap-players-cronjob

@ -1,11 +1,11 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
#python /home/owner/minetest/util/chunkymap-regen.py
#python $HOME/chunkymap/chunkymap-regen.py
#-1 FOR LESS THAN ONE MINUTE AGO:
#lol won't work because if the py doesn't run the players won't be updated
#MT_PLAYERS_ACTIVE_COUNT=$(find /var/www/html/minetest/chunkymapdata/players -type f -mmin -1 | wc -l)
#if[ $MT_PLAYERS_ACTIVE_COUNT -gt 0 ]; then
flock -n /var/run/chunkymap-regen.lockfile -c /home/owner/minetest/util/chunkymap-regen-players.sh
flock -n /var/run/chunkymap-regen.lockfile -c $HOME/chunkymap/chunkymap-regen-players.sh
#fi

2
unused/chunkymap-regen-players.sh

@ -1,4 +1,4 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
python /home/owner/minetest/util/chunkymap-regen.py --skip-map true --noloop true
python $HOME/chunkymap/chunkymap-regen.py --skip-map true --noloop true

2
unused/chunkymap-regen.sh

@ -1,5 +1,5 @@
#!/bin/sh
# NOTE: only works since all scripts in /etc/cron.*/ or crontab run as root
python /home/owner/minetest/util/chunkymap-regen.py --no-loop true
python $HOME/chunkymap/chunkymap-regen.py --no-loop true

2
unused/set-minutely-crontab-job.sh

@ -11,7 +11,7 @@ then
cp /etc/crontab "crontab.1st"
fi
crontab -l > "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root /home/owner/minetest/util/chunkymap-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root $HOME/chunkymap/chunkymap-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
crontab "$MT_CHUNKYMAP_CRON_TMP"
rm "$MT_CHUNKYMAP_CRON_TMP"

2
unused/set-minutely-players-crontab-job.sh

@ -11,7 +11,7 @@ then
cp /etc/crontab "crontab.1st"
fi
crontab -l > "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root /home/owner/minetest/util/chunkymap-players-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
echo "* * * * * root $HOME/chunkymap/chunkymap-players-cronjob" >> "$MT_CHUNKYMAP_CRON_TMP"
crontab "$MT_CHUNKYMAP_CRON_TMP"
rm "$MT_CHUNKYMAP_CRON_TMP"

21
update-chunkymap-installer-only.sh

@ -1,6 +1,8 @@
#!/bin/sh
cd $HOME
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
if [ -d "$HOME/minetest-stuff/minetest-chunkymap" ]; then
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
fi
CHUNKYMAP_INSTALLER_DIR=$HOME/Downloads/minetest-chunkymap
if [ ! -d "$HOME/Downloads" ]; then
mkdir "$HOME/Downloads"
@ -10,13 +12,22 @@ cd $HOME/Downloads
if [ -f master.zip ]; then
rm master.zip
fi
if [ -d "$HOME/Downloads/minetest-chunkymap" ]; then
rm -Rf "$HOME/Downloads/minetest-chunkymap"
fi
if [ -d "$HOME/Downloads/minetest-chunkymap-master" ]; then
rm -Rf "$HOME/Downloads/minetest-chunkymap-master"
fi
wget https://github.com/expertmm/minetest-chunkymap/archive/master.zip
rm -f minetest-chunkymap.zip
if [ -f minetest-chunkymap.zip ]; then
rm -f minetest-chunkymap.zip
fi
mv master.zip minetest-chunkymap.zip
rm -Rf minetest-chunkymap-master
unzip minetest-chunkymap.zip
#mv minetest-chunkymap-master minetest-chunkymap
rm -Rf "$CHUNKYMAP_INSTALLER_DIR"
if [ -d "$CHUNKYMAP_INSTALLER_DIR" ]; then
rm -Rf "$CHUNKYMAP_INSTALLER_DIR"
fi
mv minetest-chunkymap-master "$CHUNKYMAP_INSTALLER_DIR"
#cd minetest-chunkymap
chmod +x "$CHUNKYMAP_INSTALLER_DIR/install-chunkymap-on-ubuntu.sh"
@ -24,4 +35,4 @@ chmod +x "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-installer-only.sh"
chmod +x "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-on-ubuntu-from-web.sh"
#mv -f "$CHUNKYMAP_INSTALLER_DIR/install-chunkymap-on-ubuntu.sh" "$HOME/Downloads/"
mv -f "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-on-ubuntu-from-web.sh" "$HOME/"
cp -f "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-on-ubuntu-from-web.sh" "$HOME/"

15
update-chunkymap-on-ubuntu-from-web.sh

@ -1,6 +1,8 @@
#!/bin/sh
cd $HOME
#rm -Rf $HOME/minetest-stuff/minetest-chunkymap
if [ -d "$HOME/minetest-stuff/minetest-chunkymap" ]; then
rm -Rf $HOME/minetest-stuff/minetest-chunkymap
fi
CHUNKYMAP_INSTALLER_DIR=$HOME/Downloads/minetest-chunkymap
if [ ! -d "$HOME/Downloads" ]; then
mkdir "$HOME/Downloads"
@ -9,15 +11,18 @@ fi
#cd $CHUNKYMAP_INSTALLER_DIR
#chmod +x update-chunkymap-installer-only.sh
cd $HOME/Downloads
if [ -f "update-chunkymap-installer-only.sh" ]; then
#if [ -f "update-chunkymap-installer-only.sh" ]; then
# move misplaced file from older versions:
mv -f update-chunkymap-installer-only.sh "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-installer-only.sh"
fi
#mv -f update-chunkymap-installer-only.sh "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-installer-only.sh"
#fi
sh "$CHUNKYMAP_INSTALLER_DIR/update-chunkymap-installer-only.sh"
#./install-chunkymap-on-ubuntu.sh
chmod +x "$CHUNKYMAP_INSTALLER_DIR/install-chunkymap-on-ubuntu.sh"
echo ""
echo "running install-chunkymap-on-ubuntu.sh..."
sh "$CHUNKYMAP_INSTALLER_DIR/install-chunkymap-on-ubuntu.sh"
echo "...returned to update-chunkymap-on-ubuntu-from-web.sh"
echo ""
MT_MY_WEBSITE_PATH=/var/www/html/minetest
# IF already installed to default MT_MY_WEBSITE_PATH, update the files:

Loading…
Cancel
Save