1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/veloren_ynh.git synced 2024-09-03 17:46:10 +02:00

Automated packaging v2 conversion

This commit is contained in:
Salamandar 2024-06-06 12:02:11 +02:00
parent aee92952ae
commit 86f1a97f83
9 changed files with 280 additions and 119 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://gitlab.com/veloren/veloren/-/archive/v0.10.0/veloren-v0.10.0.tar.gz
SOURCE_SUM=8bda76af18db8553556cb09a4126bb9c4e0956bcf021fbb93c019de450c38016
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=veloren-v0.10.0.tar.gz
SOURCE_EXTRACT=true

View file

@ -8,7 +8,7 @@ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__DATA_PATH__/ WorkingDirectory=__DATA_PATH__/
Environment=VELOREN_ASSETS=__FINAL_PATH__/ Environment=VELOREN_ASSETS=__FINAL_PATH__/
ExecStart=__FINALPATH__/target/release/veloren-server-cli --basic ExecStart=__INSTALL_DIR__/target/release/veloren-server-cli --basic
KillSignal=SIGUSR1 KillSignal=SIGUSR1
TimeoutStopSec=150 TimeoutStopSec=150
StandardOutput=append:/var/log/__APP__/__APP__.log StandardOutput=append:/var/log/__APP__/__APP__.log

168
manifest.toml Normal file
View file

@ -0,0 +1,168 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "veloren"
name = "Veloren server"
description.en = "Multiplayer voxel RPG inspired by games such as Cube World, Legend of Zelda: Breath of the Wild, Dwarf Fortress and Minecraft"
description.fr = "RPG voxel multijoueur inspiré de jeux tels que Cube World, Legend of Zelda : Breath of the Wild, Dwarf Fortress et Minecraft"
version = "0.10.0~ynh1"
maintainers = ["Jules Bertholet"]
[upstream]
license = "GPL-3.0-only"
website = "https://veloren.net/"
demo = "server.veloren.net:14004"
admindoc = "https://book.veloren.net/players/hosting-a-server.html"
userdoc = "https://book.veloren.net/players/"
code = "https://gitlab.com/veloren/veloren"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.1.3"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.server_name]
ask.en = "Choose a name for the server"
ask.fr = "Choisissez un nom pour le serveur"
type = "string"
default = "Veloren Alpha"
[install.description]
ask.en = "Choose a description for the server"
ask.fr = "Choisissez une déscription pour le serveur"
type = "string"
default = "This is the best Veloren server"
[install.auth_server_address]
ask.en = "Choose an auth server"
ask.fr = "Choisissez un serveur d'authentification"
type = "string"
default = "https://auth.veloren.net"
[install.max_players]
ask.en = "Set the maximum number of players that can connect to the server concurrently"
ask.fr = "Choisissez le nombre maximum de joueurs qui peuvent être connectès en méme temps"
type = "string"
default = "100"
[install.max_view_distance]
ask.en = "Choose the maximum view distance that clients may request"
ask.fr = "Choisissez la distance maximale de visualisation que peuvent demander les clients"
type = "string"
default = "30"
[install.max_player_group_size]
ask.en = "Choose the maximum size of player groups"
ask.fr = "Choisissez le nombre maximal de joueurs dans un groupe"
type = "string"
default = "6"
[install.generate_custom_world]
ask.en = "Generate a custom world map? (resource-intensive)"
ask.fr = "Générer une carte personnalisée ? (nécessite beaucoup de ressources)"
type = "boolean"
default = false
[install.world_seed]
ask.en = "Choose a seed for the custom map"
ask.fr = "Choisir une graine pour la carte personnalisé"
type = "string"
default = "59686"
[install.world_map_size_lg_x]
ask.en = "Choose the length of the east-west dimension of the custom map (base 2 logarithm)"
ask.fr = "Choisir la longueur de la dimension est-ouest de la carte personnalisé (logarithme base 2)"
help.en = "Current default is 10, leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 10, laisser vide pour ne pas changer"
type = "string"
optional = true
[install.world_map_size_lg_y]
ask.en = "Choose the length of the north-south dimension of the custom map (base 2 logarithm)"
ask.fr = "Choisir la longueur de la dimension nord-sud de la carte personnalisé (logarithme base 2)"
help.en = "Current default is 10. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 10. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.continent_scale_hack]
ask.en = "Choose the level of continent detail of the custom map"
ask.fr = "Choisir le niveau de détail des continents de la carte personnalisé"
help.en = "Current default is 2.0, 4.0 gives an Earth-like result. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 2.0, 4.0 donne un résultat semblable à la Terre. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.days_in_month]
ask.en = "Choose the number of days in a month for the custom map economy simulation"
ask.fr = "Choisir le nombre de jours par mois pour la simulation économique de la carte personnalisé"
help.en = "Current default is 30.0. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 30.0. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.months_in_year]
ask.en = "Choose the number of months in a year for the custom map economy simulation"
ask.fr = "Choisir le nombre de mois par an pour la simulation économique de la carte personnalisé"
help.en = "Current default is 12.0. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 12.0. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.months_in_tick]
ask.en = "Choose the number of months per tick for the custom map economy simulation"
ask.fr = "Choisir le nombre de mois par étape pour la simulation économique de la carte personnalisé"
help.en = "Current default is 3.0. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 3.0. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.years_in_history]
ask.en = "Choose the number of years in history for the custom map economy simulation"
ask.fr = "Choisir le nombre d'années dans l'histoire pour la simulation économique de la carte personnalisé"
help.en = "Current default is 500.0. Leave blank for unchanged"
help.fr = "Valeur par défault actuelle est 500.0. Laisser vide pour ne pas changer"
type = "string"
optional = true
[install.generate_economy_csv]
ask.en = "Choose whether to generate economy data CSV the custom map economy simulation"
ask.fr = "Choisir si générer un CSV de données pour la simulation économique de la carte personnalisé"
type = "boolean"
default = false
[install.allow_inter_site_trade]
ask.en = "Choose whether to allow inter-site trade for the custom map economy simulation"
ask.fr = "Choisir si permettre le commerce entre sites pour la simulation économique de la carte personnalisé"
type = "boolean"
default = true
[resources]
[resources.sources.main]
url = "https://gitlab.com/veloren/veloren/-/archive/v0.10.0/veloren-v0.10.0.tar.gz"
sha256 = "8bda76af18db8553556cb09a4126bb9c4e0956bcf021fbb93c019de450c38016"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
[resources.ports]
main.default = 14004
metrics.default = 12345
[resources.apt]
packages = "cargo, rustc, ca-certificates, librust-backtrace+libbacktrace-dev, build-essential, git, git-lfs"

View file

@ -5,14 +5,14 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="cargo rustc ca-certificates librust-backtrace+libbacktrace-dev build-essential git git-lfs" #REMOVEME? pkg_dependencies="cargo rustc ca-certificates librust-backtrace+libbacktrace-dev build-essential git git-lfs"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
function setup_source { function setup_source {
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$install_dir"
patch_source patch_source
@ -27,43 +27,43 @@ function patch_source {
if [ -z "$world_map_size_lg_y" ]; then if [ -z "$world_map_size_lg_y" ]; then
world_map_size_lg_y="10" world_map_size_lg_y="10"
fi fi
ynh_replace_string -m "MapSizeLg::new(Vec2 { x: [0-9]\{1,\}, y: [0-9]\{1,\} }" -r "MapSizeLg::new(Vec2 { x: $world_map_size_lg_x, y: $world_map_size_lg_y }" -f "$final_path/world/src/sim/mod.rs" ynh_replace_string -m "MapSizeLg::new(Vec2 { x: [0-9]\{1,\}, y: [0-9]\{1,\} }" -r "MapSizeLg::new(Vec2 { x: $world_map_size_lg_x, y: $world_map_size_lg_y }" -f "$install_dir/world/src/sim/mod.rs"
fi fi
if [ ! -z "$continent_scale_hack" ]; then if [ ! -z "$continent_scale_hack" ]; then
ynh_replace_string -m "continent_scale_hack = [0-9]\{1,\}\.[0-9]\{1,\}" -r "continent_scale_hack = $continent_scale_hack" -f "$final_path/world/src/sim/mod.rs" ynh_replace_string -m "continent_scale_hack = [0-9]\{1,\}\.[0-9]\{1,\}" -r "continent_scale_hack = $continent_scale_hack" -f "$install_dir/world/src/sim/mod.rs"
fi fi
if [ ! -z "$days_in_month" ]; then if [ ! -z "$days_in_month" ]; then
ynh_replace_string -m "MONTH: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "MONTH: f32 = $days_in_month" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_string -m "MONTH: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "MONTH: f32 = $days_in_month" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
if [ ! -z "$months_in_year" ]; then if [ ! -z "$months_in_year" ]; then
ynh_replace_string -m "YEAR: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "YEAR: f32 = $months_in_year" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_string -m "YEAR: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "YEAR: f32 = $months_in_year" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
if [ ! -z "$months_in_tick" ]; then if [ ! -z "$months_in_tick" ]; then
ynh_replace_string -m "TICK_PERIOD: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "TICK_PERIOD: f32 = $months_in_tick" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_string -m "TICK_PERIOD: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "TICK_PERIOD: f32 = $months_in_tick" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
if [ ! -z "$years_in_history" ]; then if [ ! -z "$years_in_history" ]; then
ynh_replace_string -m "HISTORY_DAYS: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "HISTORY_DAYS: f32 = $years_in_history" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_string -m "HISTORY_DAYS: f32 = [0-9]\{1,\}\.[0-9]\{1,\}" -r "HISTORY_DAYS: f32 = $years_in_history" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
if [ $generate_economy_csv -eq 1 ]; then if [ $generate_economy_csv -eq 1 ]; then
ynh_replace_special_string -m "GENERATE_CSV: bool = false" -r "GENERATE_CSV: bool = true" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_special_string -m "GENERATE_CSV: bool = false" -r "GENERATE_CSV: bool = true" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
if [ $allow_inter_site_trade -eq 0 ]; then if [ $allow_inter_site_trade -eq 0 ]; then
ynh_replace_special_string -m "INTER_SITE_TRADE: bool = true" -r "INTER_SITE_TRADE: bool = false" -f "$final_path/world/src/sim2/mod.rs" ynh_replace_special_string -m "INTER_SITE_TRADE: bool = true" -r "INTER_SITE_TRADE: bool = false" -f "$install_dir/world/src/sim2/mod.rs"
fi fi
} }
function set_permissions { function set_permissions {
mkdir -p "$final_path" mkdir -p "$install_dir"
chown -R root:$app "$final_path" chown -R root:$app "$install_dir"
chmod -R g=u,g-w,o-rwx "$final_path" chmod -R g=u,g-w,o-rwx "$install_dir"
mkdir -p "$data_path" mkdir -p "$data_path"
chown -R $app:$app "$data_path" chown -R $app:$app "$data_path"
@ -77,22 +77,22 @@ function install_rust {
sudo -u $app bash -c ' sudo -u $app bash -c '
curl https://sh.rustup.rs -sSf | sh -s -- -q -y 2>&1 curl https://sh.rustup.rs -sSf | sh -s -- -q -y 2>&1
source ~/.cargo/env source ~/.cargo/env
rustup toolchain install $(cat "'"$final_path/rust-toolchain"'") 2>&1 rustup toolchain install $(cat "'"$install_dir/rust-toolchain"'") 2>&1
' '
} }
function compile_server { function compile_server {
install_rust install_rust
chown -R $app:$app "$final_path" chown -R $app:$app "$install_dir"
pushd "$final_path" pushd "$install_dir"
sudo -u $app bash -c " sudo -u $app bash -c "
source ~/.cargo/env source ~/.cargo/env
NIX_GIT_HASH=\"cf2bdb20/2021-06-12-08:55\" NIX_GIT_TAG=\"v0.10.0\" VELOREN_ASSETS=\"$final_path/assets\" RUSTFLAGS=\"-D warnings\" VELOREN_USERDATA_STRATEGY=system cargo build --bin veloren-server-cli --release --quiet 2>&1 NIX_GIT_HASH=\"cf2bdb20/2021-06-12-08:55\" NIX_GIT_TAG=\"v0.10.0\" VELOREN_ASSETS=\"$install_dir/assets\" RUSTFLAGS=\"-D warnings\" VELOREN_USERDATA_STRATEGY=system cargo build --bin veloren-server-cli --release --quiet 2>&1
" "
popd popd
sudo -u $app ln -sf "$final_path/assets" "$data_path/assets" sudo -u $app ln -sf "$install_dir/assets" "$data_path/assets"
set_permissions set_permissions
} }
@ -103,7 +103,7 @@ function generate_custom_world {
add_configuration_files add_configuration_files
pushd "$data_path" pushd "$data_path"
grep -q "Server is ready to accept connections." <((sudo -u $app VELOREN_ASSETS="$final_path/assets" $final_path/target/release/veloren-server-cli --basic & echo $! >&3 ) 3>pid) grep -q "Server is ready to accept connections." <((sudo -u $app VELOREN_ASSETS="$install_dir/assets" $install_dir/target/release/veloren-server-cli --basic & echo $! >&3 ) 3>pid)
kill "$(<pid)" kill "$(<pid)"
fuser $port/tcp -k fuser $port/tcp -k
popd popd
@ -144,27 +144,27 @@ function add_configuration_files {
} }
function get_app_settings { function get_app_settings {
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
data_path=$(ynh_app_setting_get --app=$app --key=data_path) #REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path)
port=$(ynh_app_setting_get --app=$app --key=port) #REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
metrics_port=$(ynh_app_setting_get --app=$app --key=metrics_port) #REMOVEME? metrics_port=$(ynh_app_setting_get --app=$app --key=metrics_port)
server_name=$(ynh_app_setting_get --app=$app --key=server_name) #REMOVEME? server_name=$(ynh_app_setting_get --app=$app --key=server_name)
description=$(ynh_app_setting_get --app=$app --key=description) #REMOVEME? description=$(ynh_app_setting_get --app=$app --key=description)
auth_server_address=$(ynh_app_setting_get --app=$app --key=auth_server_address) #REMOVEME? auth_server_address=$(ynh_app_setting_get --app=$app --key=auth_server_address)
max_players=$(ynh_app_setting_get --app=$app --key=max_players) #REMOVEME? max_players=$(ynh_app_setting_get --app=$app --key=max_players)
max_view_distance=$(ynh_app_setting_get --app=$app --key=max_view_distance) #REMOVEME? max_view_distance=$(ynh_app_setting_get --app=$app --key=max_view_distance)
max_player_group_size=$(ynh_app_setting_get --app=$app --key=max_player_group_size) #REMOVEME? max_player_group_size=$(ynh_app_setting_get --app=$app --key=max_player_group_size)
generate_custom_world=$(ynh_app_setting_get --app=$app --key=generate_custom_world) #REMOVEME? generate_custom_world=$(ynh_app_setting_get --app=$app --key=generate_custom_world)
world_seed=$(ynh_app_setting_get --app=$app --key=world_seed) #REMOVEME? world_seed=$(ynh_app_setting_get --app=$app --key=world_seed)
world_map_size_lg_x=$(ynh_app_setting_get --app=$app --key=world_map_size_lg_x) #REMOVEME? world_map_size_lg_x=$(ynh_app_setting_get --app=$app --key=world_map_size_lg_x)
world_map_size_lg_y=$(ynh_app_setting_get --app=$app --key=world_map_size_lg_y) #REMOVEME? world_map_size_lg_y=$(ynh_app_setting_get --app=$app --key=world_map_size_lg_y)
continent_scale_hack=$(ynh_app_setting_get --app=$app --key=continent_scale_hack) #REMOVEME? continent_scale_hack=$(ynh_app_setting_get --app=$app --key=continent_scale_hack)
days_in_month=$(ynh_app_setting_get --app=$app --key=days_in_month) #REMOVEME? days_in_month=$(ynh_app_setting_get --app=$app --key=days_in_month)
months_in_year=$(ynh_app_setting_get --app=$app --key=months_in_year) #REMOVEME? months_in_year=$(ynh_app_setting_get --app=$app --key=months_in_year)
months_in_tick=$(ynh_app_setting_get --app=$app --key=months_in_tick) #REMOVEME? months_in_tick=$(ynh_app_setting_get --app=$app --key=months_in_tick)
years_in_history=$(ynh_app_setting_get --app=$app --key=years_in_history) #REMOVEME? years_in_history=$(ynh_app_setting_get --app=$app --key=years_in_history)
generate_economy_csv=$(ynh_app_setting_get --app=$app --key=generate_economy_csv) #REMOVEME? generate_economy_csv=$(ynh_app_setting_get --app=$app --key=generate_economy_csv)
allow_inter_site_trade=$(ynh_app_setting_get --app=$app --key=allow_inter_site_trade) #REMOVEME? allow_inter_site_trade=$(ynh_app_setting_get --app=$app --key=allow_inter_site_trade)
} }
#================================================= #=================================================

View file

@ -14,18 +14,18 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
get_app_settings get_app_settings
@ -38,7 +38,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE APP DATA DIR # BACKUP THE APP DATA DIR

View file

@ -13,50 +13,50 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
server_name=$YNH_APP_ARG_SERVER_NAME #REMOVEME? server_name=$YNH_APP_ARG_SERVER_NAME
description=$YNH_APP_ARG_DESCRIPTION #REMOVEME? description=$YNH_APP_ARG_DESCRIPTION
auth_server_address=$YNH_APP_ARG_AUTH_SERVER_ADDRESS #REMOVEME? auth_server_address=$YNH_APP_ARG_AUTH_SERVER_ADDRESS
max_players=$YNH_APP_ARG_MAX_PLAYERS #REMOVEME? max_players=$YNH_APP_ARG_MAX_PLAYERS
max_view_distance=$YNH_APP_ARG_MAX_VIEW_DISTANCE #REMOVEME? max_view_distance=$YNH_APP_ARG_MAX_VIEW_DISTANCE
max_player_group_size=$YNH_APP_ARG_MAX_PLAYER_GROUP_SIZE #REMOVEME? max_player_group_size=$YNH_APP_ARG_MAX_PLAYER_GROUP_SIZE
generate_custom_world=$YNH_APP_ARG_GENERATE_CUSTOM_WORLD #REMOVEME? generate_custom_world=$YNH_APP_ARG_GENERATE_CUSTOM_WORLD
world_seed=$YNH_APP_ARG_WORLD_SEED #REMOVEME? world_seed=$YNH_APP_ARG_WORLD_SEED
world_map_size_lg_x=$YNH_APP_ARG_WORLD_MAP_SIZE_LG_X #REMOVEME? world_map_size_lg_x=$YNH_APP_ARG_WORLD_MAP_SIZE_LG_X
world_map_size_lg_y=$YNH_APP_ARG_WORLD_MAP_SIZE_LG_Y #REMOVEME? world_map_size_lg_y=$YNH_APP_ARG_WORLD_MAP_SIZE_LG_Y
continent_scale_hack=$YNH_APP_ARG_CONTINENT_SCALE_HACK #REMOVEME? continent_scale_hack=$YNH_APP_ARG_CONTINENT_SCALE_HACK
days_in_month=$YNH_APP_ARG_DAYS_IN_MONTH #REMOVEME? days_in_month=$YNH_APP_ARG_DAYS_IN_MONTH
months_in_year=$YNH_APP_ARG_MONTHS_IN_YEAR #REMOVEME? months_in_year=$YNH_APP_ARG_MONTHS_IN_YEAR
months_in_tick=$YNH_APP_ARG_MONTHS_IN_TICK #REMOVEME? months_in_tick=$YNH_APP_ARG_MONTHS_IN_TICK
years_in_history=$YNH_APP_ARG_YEARS_IN_HISTORY #REMOVEME? years_in_history=$YNH_APP_ARG_YEARS_IN_HISTORY
generate_economy_csv=$YNH_APP_ARG_GENERATE_ECONOMY_CSV #REMOVEME? generate_economy_csv=$YNH_APP_ARG_GENERATE_ECONOMY_CSV
allow_inter_site_trade=$YNH_APP_ARG_ALLOW_INTER_SITE_TRADE #REMOVEME? allow_inter_site_trade=$YNH_APP_ARG_ALLOW_INTER_SITE_TRADE
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/yunohost/$app #REMOVEME? install_dir=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
data_path=/home/yunohost.app/$app data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="This path already contains a folder" test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=server_name --value=$server_name
ynh_app_setting_set --app=$app --key=description --value=$description ynh_app_setting_set --app=$app --key=description --value=$description
@ -81,16 +81,16 @@ ynh_app_setting_set --app=$app --key=allow_inter_site_trade --value=$allow_inter
#================================================= #=================================================
# FIND AND OPEN PORTS # FIND AND OPEN PORTS
#================================================= #=================================================
ynh_script_progression --message="Finding an available port..." --weight=1 #REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port # Find an available port
port=$(ynh_find_port --port=14004) #REMOVEME? port=$(ynh_find_port --port=14004)
ynh_print_info --message="Veloren server will run on port $port, which will be opened in the firewall" ynh_print_info --message="Veloren server will run on port $port, which will be opened in the firewall"
ynh_app_setting_set --app=$app --key=port --value=$port #REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
metrics_port=$(ynh_find_port --port=$(expr $port + 1)) #REMOVEME? metrics_port=$(ynh_find_port --port=$(expr $port + 1))
ynh_print_info --message="Prometheus metrics will be available at 127.0.0.1:$metrics_port/metrics" ynh_print_info --message="Prometheus metrics will be available at 127.0.0.1:$metrics_port/metrics"
ynh_app_setting_set --app=$app --key=metrics_port --value=$metrics_port #REMOVEME? ynh_app_setting_set --app=$app --key=metrics_port --value=$metrics_port
# Expose port publicly # Expose port publicly
@ -101,25 +101,25 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp Both $port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$data_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=155 ynh_script_progression --message="Setting up source files..." --weight=155
ynh_app_setting_set --app=$app --key=final_path --value=$final_path #REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
ynh_app_setting_set --app=$app --key=data_path --value=$data_path #REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
setup_source setup_source

View file

@ -12,9 +12,9 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
get_app_settings get_app_settings
@ -42,18 +42,18 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=10 #REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=10
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE APP DATA DIR # REMOVE APP DATA DIR
@ -95,10 +95,10 @@ ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app #REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -14,28 +14,28 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
get_app_settings get_app_settings
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 #REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \ #REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $install_dir "
test ! -d $data_path \ test ! -d $data_path \
|| ynh_die --message="There is already a directory: $data_path " || ynh_die --message="There is already a directory: $data_path "
@ -44,25 +44,25 @@ test ! -d $data_path \
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=15 #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=15
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
ynh_restore_file --origin_path="$data_path" --not_mandatory ynh_restore_file --origin_path="$data_path" --not_mandatory

View file

@ -12,9 +12,9 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 #REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
get_app_settings get_app_settings
@ -27,18 +27,18 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 #REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? ynh_restore_upgradebackup
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -52,17 +52,17 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 #REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10 #REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE