diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/check_process b/check_process index d4f8799..9184984 100644 --- a/check_process +++ b/check_process @@ -1,19 +1,14 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet minetest_game ; Manifest - domain="domain.tld" (DOMAIN) + domain="domain.tld" pvp=1 servername="packagecheck" game="minetest_game" creative=0 damage=1 - is_public=0 (PUBLIC|public=1|private=0) + is_public=0 password="pass" - port="30000" (PORT) + port="30000" ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/_common.sh b/scripts/_common.sh index eba6ffc..30c621b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,4 +1,3 @@ - #!/bin/bash #================================================= @@ -8,6 +7,10 @@ # dependencies used by the app pkg_dependencies="build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev" +#================================================= +# PERSONAL HELPERS +#================================================= + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index a211def..d65b5ee 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,9 +15,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action + ynh_clean_check_starting } - # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -42,12 +41,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# BACKUP THE HOME DIR -#================================================= - -ynh_backup --src_path="$home_path" - #================================================= # SPECIFIC BACKUP #================================================= @@ -62,7 +55,14 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP THE HOME DIR +#================================================= + +ynh_backup --src_path="$home_path" --is_big + #================================================= # END OF SCRIPT #================================================= + ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 397b246..409a9c3 100755 --- a/scripts/install +++ b/scripts/install @@ -14,9 +14,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action + ynh_clean_check_starting } - # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -33,7 +32,6 @@ damage=$YNH_APP_ARG_DAMAGE servername=$YNH_APP_ARG_SERVERNAME app=$YNH_APP_INSTANCE_NAME -path_url="/" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -41,7 +39,7 @@ path_url="/" ynh_script_progression --message="Validating installation parameters..." final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST @@ -49,9 +47,7 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=game --value=$game -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=pvp --value=$pvp ynh_app_setting_set --app=$app --key=creative --value=$creative ynh_app_setting_set --app=$app --key=damage --value=$damage @@ -64,11 +60,12 @@ ynh_app_setting_set --app=$app --key=servername --value=$servername #================================================= ynh_script_progression --message="Finding an available port..." -# Find a free port +# Find an available port port=$(ynh_find_port 30000) -# Open this port -ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port ynh_app_setting_set --app=$app --key=port --value=$port +# Open the port +ynh_script_progression --message="Configuring firewall..." +ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port #================================================= # INSTALL DEPENDENCIES @@ -77,15 +74,6 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -ynh_script_progression --message="Setting up source files..." - -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" - #================================================= # CREATE DEDICATED USER #================================================= @@ -97,9 +85,30 @@ ynh_app_setting_set --app=$app --key=home_path --value=$home_path # Create a system user ynh_system_user_create --username=$app --home_dir=$home_path --use_shell +mkdir -p "$home_path" +chmod 750 "$home_path" +chmod -R o-rwx "$home_path" +chown -R $app:$app "$home_path" + #================================================= -# COPY CONFIG FILE +# DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Setting up source files..." + +ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" + +#================================================= +# SPECIFIC SETUP +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." mkdir -p $home_path/.minetest/worlds/ cp -a ../conf/minetest.conf $home_path/.minetest/ @@ -113,28 +122,31 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_systemd_config #================================================= -# SPECIFIC SETUP +# BUILDING #================================================= -# Compile Minetest -pushd /opt/yunohost/$app +ynh_script_progression --message="Building Minetest..." + # Install the game if [ $game = "capturetheflag" ]; then -git clone --recursive https://github.com/MT-CTF/capturetheflag.git games/capturetheflag + pushd $final_path + git clone --recursive https://github.com/MT-CTF/capturetheflag.git games/capturetheflag + popd else -# Download Minetest Game -ynh_setup_source --dest_dir=/opt/yunohost/$app/games/minetest_game --source_id=minetest_game + # Download Minetest Game + ynh_setup_source --dest_dir=$final_path/games/minetest_game --source_id=minetest_game fi -cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE - -make -j$(nproc) +pushd $final_path + 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 #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_script_progression --message="Adding a configuration file..." ### `ynh_replace_string` is used to replace a string in a file. ### (It's compatible with sed regular expressions syntax) @@ -143,37 +155,23 @@ popd if [ $is_public -eq 1 ]; then announce="true" else - announce="fase" + announce="false" fi ynh_add_config --template="../conf/minetest.conf" --destination="$home_path/.minetest/minetest.conf" #================================================= -# CREATE WORLD +# CREATE LOG DIRECTORY #================================================= +ynh_script_progression --message="Creating log directory..." mkdir -p /var/log/$app # Set permissions on logs chown -R $app:$app /var/log/$app -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf" - #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R root: $final_path -chown -R $app: $home_path - #================================================= # SETUP LOGROTATE #================================================= @@ -183,20 +181,22 @@ ynh_script_progression --message="Configuring log rotation..." ynh_use_logrotate #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= -# RELOAD MINETEST +# START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Reloading Minetest..." +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/minetest.log" --line_match="listening on" #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index f67f958..a4dfeb7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -23,20 +23,20 @@ home_path=$(ynh_app_setting_get --app=$app --key=home_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service" + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service" +ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,7 +44,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies" +ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -52,19 +52,15 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" -ynh_secure_remove --file="$home_path" - -# Remove the log files -ynh_secure_remove "/var/log/$app" #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration" +ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate @@ -79,12 +75,24 @@ then ynh_exec_warn_less yunohost firewall disallow UDP $port fi +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE VARIOUS FILES +#================================================= +ynh_script_progression --message="Removing various files..." + +ynh_secure_remove --file="$home_path" + +# Remove the log files +ynh_secure_remove --file="/var/log/$app" + #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 686b6b4..195f489 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,33 +15,24 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action + ynh_clean_check_starting } - # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) home_path=$(ynh_app_setting_get --app=$app --key=home_path) port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -50,16 +41,16 @@ ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir=$home_path --use_shell -# Restore home_path -ynh_restore_file --origin_path="$home_path" - #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." -# Restore permissions on app files -chown -R root: $final_path -chown -R $app: $home_path +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -71,6 +62,22 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring various files..." + +# Restore home_path +ynh_restore_file --origin_path="$home_path" --not_mandatory + +mkdir -p "$home_path" +chmod 750 "$home_path" +chmod -R o-rwx "$home_path" +chown -R $app:$app "$home_path" + +mkdir /var/log/$app -p +chown -R $app: /var/log/$app + #================================================= # RESTORE SYSTEMD #================================================= @@ -79,13 +86,6 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -mkdir /var/log/$app -p -chown -R $app: /var/log/$app - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -93,21 +93,22 @@ ynh_script_progression --message="Integrating service in YunoHost..." 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..." + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/minetest.log" --line_match="listening on" + #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION -#================================================= -# RELOAD MINETEST -#================================================= -ynh_script_progression --message="Reloading minetest..." - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bba5fe3..7f3e463 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,9 +30,35 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + ynh_clean_check_starting + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -66,23 +92,13 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Making sure dedicated system user exists..." -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir=$home_path --use_shell - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -99,6 +115,10 @@ then ynh_setup_source --dest_dir="$final_path" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" + #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -106,22 +126,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$home_path --use_shell - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # COPY CONFIG FILE #================================================= @@ -138,30 +142,32 @@ fi # SPECIFIC UPGRADE #================================================= # Compile Minetest -pushd /opt/yunohost/$app + # Install the game if [ $game = "capturetheflag" ]; then -# Download Capture The Flag + # Download Capture The Flag -# To avoid mess remove this first -ynh_secure_remove games/capturetheflag/ -# Then clone the latest version from git -git clone --recursive https://github.com/MT-CTF/capturetheflag.git games/capturetheflag + pushd $final_path + # To avoid mess remove this first + ynh_secure_remove games/capturetheflag/ + # Then clone the latest version from git + git clone --recursive https://github.com/MT-CTF/capturetheflag.git games/capturetheflag + popd else -# Download Minetest Game -ynh_setup_source --dest_dir=/opt/yunohost/$app/games/minetest_game --source_id=minetest_game + # Download Minetest Game + ynh_setup_source --dest_dir=$final_path/games/minetest_game --source_id=minetest_game fi -cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE - -make -j$(nproc) +pushd $final_path + 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 #================================================= -# MODIFY A CONFIG FILE +# UPDATE A CONFIG FILE #================================================= - +ynh_script_progression --message="Updating a configuration file..." if [ $is_public -eq 1 ]; then announce="true" else @@ -170,6 +176,16 @@ fi ynh_add_config --template="../conf/minetest.conf" --destination="$home_path/.minetest/minetest.conf" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_config + +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= @@ -179,27 +195,18 @@ ynh_script_progression --message="Upgrading logrotate configuration..." ynh_use_logrotate --non-append #================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path -chown -R $app: $home_path - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= -# RELOAD MINETEST +# START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Restarting Minetest..." +ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="restart" --log_path="/var/log/$app/$app.log" --line_match="listening on" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on" #================================================= # END OF SCRIPT