1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00

Remove postgresql support

This commit is contained in:
Rafi594 2019-10-22 17:52:18 +02:00
parent 8efb4fbe4f
commit f237277d78
7 changed files with 11 additions and 131 deletions

View file

@ -3,10 +3,9 @@
# Move this file from check_process.default to check_process when you have filled it. # Move this file from check_process.default to check_process when you have filled it.
;; Test complet sans postgresql ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
use_postgresql=0
pvp=1 pvp=1
servername="packagecheck" servername="packagecheck"
creative=0 creative=0
@ -26,46 +25,11 @@
multi_instance=0 multi_instance=0
incorrect_path=0 incorrect_path=0
port_already_use=1 port_already_use=1
change_url=0 change_url=1
;; Test complet avec postgresql
; Manifest
domain="domain.tld" (DOMAIN)
use_postgresql=1
pvp=1
servername="packagecheck"
creative=0
damage=1
is_public=0 (PUBLIC|public=1|private=0)
password="pass"
port="30000" (PORT)
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=0
port_already_use=1
change_url=0
;;; Levels ;;; Levels
Level 1=auto # If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 2=auto
Level 3=auto
# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it.
# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well.
Level 4=0
Level 5=auto Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -6,7 +6,7 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql postgresql9.6 postgresql-contrib 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-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev" 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-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -26,8 +26,6 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
postgresql=$(ynh_app_setting_get --app=$app --key=postgresql)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -48,17 +46,6 @@ ynh_print_info --message="Backing up Minetest data..."
ynh_backup --src_path="/home/yunohost.app/$app" ynh_backup --src_path="/home/yunohost.app/$app"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
if [ $postgresql -eq 1 ]
then
ynh_print_info --message="Backing up the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
fi
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================

View file

@ -22,7 +22,6 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
use_postgresql=$YNH_APP_ARG_USE_POSTGRESQL
pvp=$YNH_APP_ARG_PVP pvp=$YNH_APP_ARG_PVP
creative=$YNH_APP_ARG_CREATIVE creative=$YNH_APP_ARG_CREATIVE
damage=$YNH_APP_ARG_DAMAGE damage=$YNH_APP_ARG_DAMAGE
@ -60,7 +59,6 @@ ynh_print_info --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=use_postgresql --value=$use_postgresql
ynh_app_setting_set --app=$app --key=pvp --value=$pvp 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=creative --value=$creative
ynh_app_setting_set --app=$app --key=damage --value=$damage ynh_app_setting_set --app=$app --key=damage --value=$damage
@ -98,23 +96,6 @@ ynh_print_info --message="Installing dependencies..."
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
if [ $use_postgresql -eq 1 ]
then
ynh_print_info --message="Creating a PostgreSQL database..."
# Create a database, an user and its password. Then store the password in the app's config
#
# After executing this helper, the password of the created database will be available in $db_pwd
# It will also be stored as "psqlpwd" into the app settings.
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -178,12 +159,8 @@ ynh_add_systemd_config
cd /opt/yunohost/$app cd /opt/yunohost/$app
# Download Minetest Game # Download Minetest Game
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5 git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5
if [ $use_postgresql -eq 1 ]
then
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_POSTGRESQL=TRUE -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
else
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
fi
make -j$(nproc) make -j$(nproc)
@ -220,13 +197,6 @@ fi
chown -R minetest:minetest /var/log/minetest chown -R minetest:minetest /var/log/minetest
systemctl start minetest systemctl start minetest
if [ $use_postgresql -eq 1 ]
then
systemctl stop minetest
echo "pgsql_connection = host=127.0.0.1 user=$db_user password=$db_pwd dbname=$db_name" > $home_path/.minetest/worlds/world/world.mt
sleep 5
/opt/yunohost/$app/bin/minetestserver --migrate postgresql --world $home_path/.minetest/worlds/world
fi
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM

View file

@ -18,10 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
use_postgresql=$(ynh_app_setting_get --app=$app --key=use_postgresql)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -44,17 +41,6 @@ ynh_print_info --message="Stopping and removing the systemd service"
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
if [ $use_postgresql -eq 1 ]
then
ynh_print_info --message="Removing the PostgreSQL database"
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --user=$db_user --db=$db_name
fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================

View file

@ -27,8 +27,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
postgresql=$(ynh_app_setting_get --app=$app --key=postgresql)
home_path=$(ynh_app_setting_get --app=$app --key=home_path) home_path=$(ynh_app_setting_get --app=$app --key=home_path)
#================================================= #=================================================
@ -81,19 +79,6 @@ ynh_print_info --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
if [ $postgresql -eq 1 ]
then
ynh_print_info --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
fi
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -19,8 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
use_postgresql=$(ynh_app_setting_get --app=$app --key=use_postgresql)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -36,12 +34,6 @@ elif [ "$is_public" = "No" ]; then
is_public=0 is_public=0
fi fi
# If db_name doesn't exist, create it
if [ -z $db_name ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z $final_path ]; then if [ -z $final_path ]; then
final_path=/var/www/$app final_path=/var/www/$app
@ -115,14 +107,10 @@ ynh_add_systemd_config
cd /opt/yunohost/$app cd /opt/yunohost/$app
# Download Minetest Game # Download Minetest Game
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5 git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5
if [ $use_postgresql -eq 1 ]
then
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_POSTGRESQL=TRUE -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
else
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
fi
make -j 2 cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
make -j$(nproc)
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
@ -150,11 +138,11 @@ ynh_use_logrotate --non-append
chown -R root: $final_path chown -R root: $final_path
#================================================= #=================================================
# RELOAD NGINX # RELOAD MINETEST
#================================================= #=================================================
ynh_print_info --message="Reloading nginx web server..." ynh_print_info --message="Restarting Minetest..."
systemctl reload nginx systemctl restart minetest
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT