2020-06-14 06:25:54 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
2024-07-12 12:53:33 +02:00
|
|
|
nodejs_version=12
|
|
|
|
|
2020-06-14 06:25:54 +02:00
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2024-07-12 13:22:18 +02:00
|
|
|
_configure_framagames() {
|
|
|
|
ynh_replace_string --target_file="$install_dir/sources/src/data/main.yml" \
|
|
|
|
--match_string="canonical: .*" \
|
|
|
|
--replace_string="canonical: https://$domain$path"
|
|
|
|
|
2024-07-12 13:35:02 +02:00
|
|
|
ynh_replace_string --target_file="$install_dir/sources/src/data/main.yml" \
|
|
|
|
--match_string="framanav: true" \
|
|
|
|
--replace_string="framanav: false"
|
|
|
|
|
2024-07-13 13:14:32 +02:00
|
|
|
# %/ is here to prevent double slash when path is /
|
2024-07-12 13:22:18 +02:00
|
|
|
ynh_replace_string --target_file="$install_dir/sources/config/env.js" \
|
2024-07-13 13:14:32 +02:00
|
|
|
--match_string=" basepath:.*" \
|
|
|
|
--replace_string=" basepath: '${path%/}/', wrong_path: false"
|
2024-07-12 13:22:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_build_install_framagames() {
|
|
|
|
pushd "$install_dir/sources"
|
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run commons
|
|
|
|
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run prod
|
|
|
|
popd
|
|
|
|
|
2024-07-12 13:39:11 +02:00
|
|
|
ynh_secure_remove --file="$install_dir/www"
|
2024-07-12 13:22:18 +02:00
|
|
|
mv -f "$install_dir/sources/dist" "$install_dir/www"
|
2024-07-12 18:13:36 +02:00
|
|
|
cp -r "$install_dir/sources/games/"* "$install_dir/www"
|
2024-07-12 21:43:23 +02:00
|
|
|
if [[ "$path" != "/" ]]; then
|
|
|
|
mv -f "$install_dir/www/$path/"* "$install_dir/www"
|
|
|
|
fi
|
2024-07-12 23:00:18 +02:00
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2024-07-12 13:22:18 +02:00
|
|
|
}
|
|
|
|
|
2020-06-14 06:25:54 +02:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|