mirror of
https://github.com/YunoHost-Apps/minetest_ynh.git
synced 2024-09-03 20:36:00 +02:00
89 lines
2.9 KiB
Bash
Executable file
89 lines
2.9 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:$app "$install_dir"
|
|
|
|
#=================================================
|
|
# BUILDING
|
|
#=================================================
|
|
ynh_script_progression --message="Building Minetest..."
|
|
|
|
# Install the game
|
|
if [ $game = "capturetheflag" ]; then
|
|
# Download Capture The Flag
|
|
ynh_setup_source --dest_dir=$install_dir/games/capturetheflag --source_id=capturetheflag
|
|
elif [ $game = "mineclonia" ]; then
|
|
# Download Mineclonia
|
|
ynh_setup_source --dest_dir=$install_dir/games/mineclonia --source_id=mineclonia
|
|
elif [ $game = "mineclone2" ]; then
|
|
# Download Mineclone2
|
|
ynh_setup_source --dest_dir=$install_dir/games/mineclone2 --source_id=mineclone2
|
|
else
|
|
# Download Minetest Game
|
|
ynh_setup_source --dest_dir=$install_dir/games/minetest_game --source_id=minetest_game
|
|
fi
|
|
|
|
# Install IrrlichtMt
|
|
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
|
|
|
|
pushd $install_dir
|
|
ynh_exec_warn_less cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
|
|
|
ynh_exec_warn_less make -j$(nproc)
|
|
popd
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
ynh_add_config --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
|
|
|
|
chmod 400 "$data_dir/.minetest/minetest.conf"
|
|
chown $app:$app "$data_dir/.minetest/minetest.conf"
|
|
|
|
#=================================================
|
|
# SETUP SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring a systemd service..."
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
mkdir -p /var/log/$app
|
|
chown -R $app:$app /var/log/$app
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_use_logrotate
|
|
|
|
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|