1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #1461 from holta/minetest-rpi

Minetest (Minecraft clone) for RPi, building on PR #1454
This commit is contained in:
A Holt 2019-02-07 22:30:50 -05:00 committed by GitHub
commit b448988d95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 395 additions and 0 deletions

View file

@ -15,6 +15,12 @@
when: calibreweb_install
tags: calibre-web
- name: MINETEST
include_role:
name: minetest
when: minetest_install
tags: minetest
- name: Recording STAGE 9 HAS COMPLETED ====================
lineinfile:
dest: "{{ iiab_env_file }}"

24
roles/minetest/README.rst Normal file
View file

@ -0,0 +1,24 @@
===============
Minetest README
===============
For the first release, the Minetest server can only be installed on a Raspberry Pi.
Please note that the initial configuration is for creative mode, and a number of mods are installed (see the list in `tasks/main.yml <tasks/main.yml>`_).
Connecting to the Server
------------------------
To connect to the server, you will also need to download Minetest client software for each of your client devices, e.g. from: https://www.minetest.net/downloads/
The port is nominally the standard 30000. This can be changed in `/etc/iiab/local_vars.yml <http://wiki.laptop.org/go/IIAB/FAQ#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_ using variable: ``minetest_port``
The admin user is the usual: ``Admin``
No password is required.
File Locations on Raspberry Pi
------------------------------
- The config file is: ``/etc/minetest/minetest.conf``
- The rest of the files are a normal layout based in: ``/library/games/minetest``

View file

@ -0,0 +1,12 @@
# minetest_install: False
# minetest_enabled: False
# minetest_port: 30000
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
minetest_runas_user: minetest
minetest_runas_group: minetest
minetest_config_file: /etc/minetest/minetest.conf
minetest_server_admin: Admin

View file

@ -0,0 +1,13 @@
# For rpi installs
- name: Set some facts for RPi
set_fact:
minetest_server_bin: /library/games/minetest/bin/minetestserver
minetest_world_dir: /library/games/minetest/worlds/world
minetest_game_dir: /library/games/minetest/games/minetest_game
# only works if server run as root
minetest_runas_user: root
minetest_runas_group: root
when: is_rpi
# For other installs TBD

View file

@ -0,0 +1,98 @@
# Give message and end play for unsupported platforms
# For now only support rpi
- name: No install except Raspberry Pi for now
debug:
msg: "No install except Raspberry Pi for now."
when: not is_rpi
# CAUTION: this stanza causes iiab-install to exit on Ubuntu/Debian/etc -- without completing roles/network
- name: Terminate play if not Raspberry Pi
meta: end_play
when: not is_rpi
- include_tasks: calc_vars.yml
- name: Ensure Linux group '{{ minetest_runas_group }}' exists
group:
name: "{{ minetest_runas_group }}"
state: present
when: minetest_runas_user != 'root'
- name: Ensure Linux user '{{ minetest_runas_user }}' exists
user:
name: "{{ minetest_runas_user }}"
groups: "{{ minetest_runas_group }}"
state: present
createhome: no
shell: /bin/false
when: minetest_runas_user != 'root'
- name: Check for minetest world file ({{ minetest_world_dir }}/world.mt)
stat:
path: "{{ minetest_world_dir }}/world.mt"
register: minetest_world
# rpi only
- include_tasks: rpi_minetest_install.yml
when: minetest_install and not minetest_world.stat.exists and is_rpi
# not rpi
- include_tasks: minetest_install.yml
when: minetest_install and not minetest_world.stat.exists and not is_rpi
# Install mods
- include: minetest_install_mods.yml
with_items:
- name: moreblocks
url: https://github.com/minetest-mods/moreblocks/archive/master.zip
- name: moreores
url: https://github.com/Calinou/moreores/archive/master.zip
- name: basic_materials
url: https://gitlab.com/VanessaE/basic_materials/-/archive/master/basic_materials-master.zip
- name: mesecons
url: https://github.com/minetest-mods/mesecons/archive/master.zip
- name: digilines
url: https://github.com/minetest-mods/digilines/archive/master.zip
- name: pipeworks
url: https://github.com/minetest-mods/pipeworks/archive/master.zip
- name: Minetest-WorldEdit
url: https://github.com/Uberi/Minetest-WorldEdit/archive/master.zip
when: minetest_install
# enable or disable
- name: Enable & Restart 'minetest-serve' service
systemd:
daemon_reload: yes
name: minetest-serve
enabled: yes
state: restarted
when: minetest_install and minetest_enabled
- name: Disable 'minetest-serve' service
systemd:
daemon_reload: yes
name: minetest-serve
enabled: no
state: stopped
when: minetest_install and not minetest_enabled
- name: Add 'minetest' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: minetest
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: Minetest Server
- option: description
value: '"Minetest is an open source clone of the Minecraft building blocks game."'
- option: minetest_world_dir
value: "{{ minetest_world_dir }}"
- option: minetest_port
value: "{{ minetest_port }}"
- option: minetest_enabled
value: "{{ minetest_enabled }}"
- option: minetest_world_dir
value: "{{ minetest_world_dir }}"

View file

@ -0,0 +1,82 @@
# For non-rpi installs
# Still a work in progress
# COMPARE tasks/calc_vars.yml
- name: Set some facts
set_fact:
minetest_server_bin: /usr/lib/minetest/minetestserver
# minetest_world_dir: /var/games/minetest-server/.minetest/worlds/world/ should be in library
minetest_mods_dir: /usr/share/games/minetest_game/mods/
# Taken care of near top of tasks/main.yml
#
#- name: Ensure Linux group '{{ minetest_runas_group }}' exists
# group:
# name: "{{ minetest_runas_group }}"
# state: present
# when: minetest_runas_user != 'root'
#
#- name: Ensure Linux user '{{ minetest_runas_user }}' exists
# user:
# name: "{{ minetest_runas_user }}"
# groups: "{{ minetest_runas_group }}"
# state: present
# createhome: no
# shell: /bin/false
# when: minetest_runas_user != 'root'
# SEE "Check for minetest world file" in tasks/main.yml
#
#- name: Create dir minetest_world_dir ({{ minetest_world_dir }})
# file:
# state: directory
# path: "{{ minetest_world_dir }}"
# owner: "{{ minetest_runas_user }}"
# group: "{{ minetest_runas_group }}"
# mode: 0755
#- name: Warn if not Raspberry Pi
# debug:
# msg: "No install except Raspberry Pi for now."
# when: not is_rpi
- name: Download Minetest if not package
get_url:
url: "{{ rpi_src_url }}"
dest: "{{ downloads_dir }}/{{ rpi_src }}"
timeout: "{{ download_timeout }}"
#when: is_rpi
- name: Install Minetest if not package
debug:
msg: "placeholder."
#when: is_rpi
- name: Create /etc/minetest
file:
state: directory
path: /etc/minetest
owner: root
group: root
mode: 0755
# - name: move files to world dir
- name: 'Change minetest_server_bin: /usr/bin/minetest-server if not RPi'
set_fact:
minetest_server_bin: /usr/bin/minetest-server
#when: not is_rpi
- name: Create minetest-server service and minetest.conf file
template:
backup: no
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
with_items:
- { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' }
# - name: Start minetest

View file

@ -0,0 +1,28 @@
- name: Check if mod already installed
stat:
path: "{{ minetest_game_dir }}/mods/{{ item.name }}"
register: minetest_mod
- name: Download one minetest mod
get_url:
url: "{{item.url}}"
dest: "{{ downloads_dir }}/{{ item.name }}.zip"
mode: 0440
when: not minetest_mod.stat.exists
- name: Extract mod into mods of current game
unarchive:
src: "{{ downloads_dir }}/{{ item.name }}.zip"
dest: "{{ minetest_game_dir }}/mods"
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
when: not minetest_mod.stat.exists
- name: Check if mod name has 'master' in it
stat:
path: "{{ minetest_game_dir }}/mods/{{ item.name }}-master"
register: minetest_mod_master
- name: Rename mod to canonical name if has '-master' in name
command: mv "{{ minetest_game_dir }}/mods/{{ item.name }}-master" "{{ minetest_game_dir }}/mods/{{ item.name }}"
when: minetest_mod_master.stat.exists

View file

@ -0,0 +1,67 @@
# For rpi installs
- name: Set some facts
set_fact:
rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz
rpi_src: minetest-0.4.17.1.tar.gz
- name: Install 'libhiredis-dev' package for Minetest
package:
name: libhiredis-dev
state: present
#- name: Minetest already installed - terminate play
# meta: end_play
# when: minetest_world.stat.exists
- name: Download Minetest {{ rpi_src_url }} for RPi
get_url:
url: "{{ rpi_src_url }}"
dest: "{{ downloads_dir }}/{{ rpi_src }}"
timeout: "{{ download_timeout }}"
- name: Create dirs /etc/minetest and /library/games
file:
state: directory
path: "{{ item }}"
owner: root
group: root
mode: 0755
with_items:
- /etc/minetest
- /library/games
- name: Create dir /var/log/minetest
file:
state: directory
path: /var/log/minetest
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
- name: Extract {{ downloads_dir }}/{{ rpi_src }} into /library/games
unarchive:
src: "{{ downloads_dir }}/{{ rpi_src }}"
dest: /library/games
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
- name: Create symbolic link /library/games/minetest
file:
state: link
src: /library/games/0.4.17.1
dest: /library/games/minetest
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
- name: Create /etc/minetest/minetest.conf and minetest-serve.service
template:
backup: no
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
with_items:
- { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' }

View file

@ -0,0 +1,14 @@
[Unit]
Description=Minetest Server
After=network.target
[Service]
Type=simple
User={{ minetest_runas_user }}
Group={{ minetest_runas_group }}
WorkingDirectory=/library/games/minetest
ExecStart={{ minetest_server_bin }} --port {{ minetest_port }} --config {{ minetest_config_file }} --logfile /var/log/minetest/minetest.log --world {{ minetest_world_dir }}
Restart=on-abort
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,32 @@
# Admin name
name = {{ minetest_server_admin }}
# Name of server
server_name = Internet in a Box Minetest Server
# Automaticaly report to masterserver
# set to true for public servers
server_announce = false
# Default game (default when creating a new world)
default_game = minetest
# Maximum number of players connected simultaneously
max_users = 15
# Whether to enable players killing each other
enable_pvp = false
# Set to true to enable creative mode (unlimited inventory)
creative_mode = true
# Enable players getting damage and dying
enable_damage = true
# Available privileges: interact, shout, teleport, settime, privs, ...
# See /privs in game for a full list on your server and mod configuration.
default_privs = interact, shout, teleport, settime, privs
# For mods
spawn_friendly_mobs = true
spawn_hostile_mobs = false

View file

@ -65,6 +65,7 @@ transmission_peer_port={{ transmission_peer_port }}
sugarizer_port={{ sugarizer_port }}
nodered_port={{ nodered_port }}
mosquitto_port={{ mosquitto_port }}
minetest_port={{ minetest_port }}
block_DNS={{ block_DNS }}
echo "LAN is $lan and WAN is $wan"
@ -104,6 +105,7 @@ if [ "$services_externally_visible" == "True" ]; then
$IPTABLES -A INPUT -p tcp --dport $mosquitto_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT
$IPTABLES -A INPUT -p udp --dport $minetest_port -m state --state NEW -i $wan -j ACCEPT
fi
if [ "$iiab_gateway_enabled" == "True" ]; then

View file

@ -436,6 +436,11 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_url: /books
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Minetest is an open source clone of the Minecraft building blocks game
minetest_install: False
minetest_enabled: False
minetest_port: 30000
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
# - http://download.iiab.io/content/OSM/vector-tiles/

View file

@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_url: /books
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Minetest is an open source clone of the Minecraft building blocks game
minetest_install: False
minetest_enabled: False
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
# - http://download.iiab.io/content/OSM/vector-tiles/

View file

@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_url: /books
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Minetest is an open source clone of the Minecraft building blocks game
minetest_install: False
minetest_enabled: False
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
# - http://download.iiab.io/content/OSM/vector-tiles/

View file

@ -289,6 +289,10 @@ calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_url: /books
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Minetest is an open source clone of the Minecraft building blocks game
minetest_install: False
minetest_enabled: False
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
# - http://download.iiab.io/content/OSM/vector-tiles/