1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/digiscreen_ynh.git synced 2024-09-03 18:26:15 +02:00
This commit is contained in:
Éric Gaspar 2024-01-14 13:12:24 +01:00
parent 5667a797d9
commit 8f24e8a95a
6 changed files with 4 additions and 119 deletions

View file

@ -34,6 +34,7 @@ ram.build = "500M"
ram.runtime = "100M" ram.runtime = "100M"
[install] [install]
[install.domain] [install.domain]
type = "domain" type = "domain"
@ -41,27 +42,7 @@ ram.runtime = "100M"
type = "path" type = "path"
default = "/digiscreen" default = "/digiscreen"
[install.apikey_pixabay]
ask.en = "Your Pixabay API key"
ask.fr = "Votre clé dAPI Pixabay"
help.en = "Optional: a Pixabay API key will let you chose a background by entering keywords."
help.fr = "Optionnel : une clé dAPI Pixabay vous permettra de choisir un fond décran en entrant un mot clé."
type = "string"
example = "123456abc"
optional = true
[install.apikey_google_youtube]
ask.en = "Your Google API key"
ask.fr = "Votre clé dAPI Google"
help.en = "Optional: a Google API key will let you insert videos from YouTube on your Digiscreen"
help.fr = "Optionnel : une clé dAPI Google vous permettra dafficher des vidéos de YouTube sur votre Digiscreen."
type = "string"
example = "123456abc"
optional = true
[install.init_main_permission] [install.init_main_permission]
help.en = "If public, any visitor can use this app and thus will benefit from your API keys for Pixabay and YouTube."
help.fr = "Si lapplication est publique, nimporte quel visiteur pourra utiliser cette application et bénéficiera donc de vos clés dAPI pour Pixabay et YouTube."
type = "group" type = "group"
default = "visitors" default = "visitors"
@ -80,5 +61,5 @@ ram.runtime = "100M"
[resources.ports] [resources.ports]
[resources.apt] [resources.apt]
packages = ["php8.2-fpm"] packages = "php8.2-sqlite3"

View file

@ -4,23 +4,10 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
nodejs_version="14"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
_digiscreen_build() {
pushd "$install_dir/sources"
echo "VUE_APP_PIXABAY_API_KEY=$apikey_pixabay" >> .env
echo "VUE_APP_GOOGLE_API_KEY=$apikey_google_youtube" >> .env
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run build
popd
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -9,31 +9,13 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight 3
ynh_install_nodejs --nodejs_version="$nodejs_version"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/sources" ynh_setup_source --dest_dir="$install_dir/sources"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
_digiscreen_build
mv "$install_dir/sources/dist" "$install_dir/www"
ynh_secure_remove --file="$install_dir/sources"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir"

View file

@ -14,15 +14,10 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -15,65 +15,13 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# migrate camelCase to snake_case
if [[ -z "$apikey_pixabay" ]]; then
# migrate camelCase to snake_case
pixabay="$(ynh_app_setting_get --app="$app" --key=pixabay)"
apikey_pixabay="$pixabay"
ynh_app_setting_set --app="$app" --key="apikey_pixabay" --value="$apikey_pixabay"
ynh_app_setting_delete --app="$app" --key="pixabay"
fi
if [[ -z "$apikey_google_youtube" ]]; then
googleYoutube="$(ynh_app_setting_get --app="$app" --key=googleYoutube)"
apikey_google_youtube="$googleYoutube"
ynh_app_setting_set --app="$app" --key="apikey_google_youtube" --value="$apikey_google_youtube"
ynh_app_setting_delete --app="$app" --key="googleYoutube"
fi
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight 3
ynh_install_nodejs --nodejs_version="$nodejs_version"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] ynh_setup_source --dest_dir="$install_dir" --keep="inc/digiwords.db"
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir/sources"
_digiscreen_build
# backup...
if [ -f "$install_dir/www/inc/digiwords.db" ]; then
mv "$install_dir/www/inc/digiwords.db" "$install_dir"
fi
# upgrade...
ynh_secure_remove --file="$install_dir/www"
mv "$install_dir/sources/dist" "$install_dir/www"
if [ -f "$install_dir/digiwords.db" ]; then
# restore
mkdir -p "$install_dir/www/inc"
mv "$install_dir/digiwords.db" "$install_dir/www/inc"
fi
fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir"
@ -82,7 +30,6 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
ynh_add_fpm_config ynh_add_fpm_config

View file

@ -3,10 +3,3 @@
test_format = 1.0 test_format = 1.0
[default] [default]
args.apikey_pixabay = "cafe1007"
args.apikey_google_youtube = "1337c0c4"
test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.name = "First release"
test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.args.pixabay = "cafe1007"
test_upgrade_from.3bb42cd71bcca77b7f642859bf5048317586a500.args.googleYoutube = "1337c0c4"