#!/bin/bash ### App file generated with YoloGen, the Yunohost app generator, version . # This is the tutorial version of the app. # It contains extra commands to explain what should be done in case you want to adjust some part of the script. # Once you are done, you may remove them. source _common.sh source /usr/share/yunohost/helpers ### Install parameters are automatically saved as settings ### ### Settings are automatically loaded as bash variables ### in every app script context, therefore typically these will exist: ### - $domain ### - $path ### - $language ### ... etc ### ### Resources defined in the manifest are provisioned prior to this script ### and corresponding settings are also available, such as: ### - $install_dir ### - $port ### - $db_name ### ... ### ### $app is the app id (i.e. 'example' for first install, ### or 'example__2', '__3'... for multi-instance installs) #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression "Installing dependencies..." #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression "Setting up source files..." ### `ynh_setup_source` is used to install an app from a zip or tar.gz file, ### downloaded from an upstream source, as defined in the manifest.toml ynh_setup_source --dest_dir="$install_dir" # $install_dir will automatically be initialized with some decent # permission by default ... however, you may need to recursively reapply # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression "Adding app's configuration file..." ### You can add specific configuration files. ### ### Typically, put your template conf file in ../conf/your_config_file ### The template may contain strings such as __FOO__ or __FOO_BAR__, ### which will automatically be replaced by the values of $foo and $foo_bar ### ### ynh_config_add will also keep track of the config file's checksum, ### which later during upgrade may allow to automatically backup the config file ### if it's found that the file was manually modified ### ### Check the documentation of `ynh_config_add` for more info. ynh_config_add --template="" --destination="$install_dir/" # FIXME: this should be handled by the core in the future ### You may need to use chmod 600 instead of 400, ### for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/" chown "$app:$app" "$install_dir/" ### For more complex cases where you want to replace stuff using regexes, ### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) ### When doing so, you also need to manually call ynh_store_file_checksum ### ### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/" ### ynh_store_file_checksum --file="$install_dir/" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config using the conf/nginx.conf template ynh_config_add_nginx #================================================= # INSTALL APP #================================================= ynh_script_progression "Installing $app..." pushd $install_dir #some_command --build popd #================================================= # FINALIZE APP INSTALL WITH CURL #================================================= ynh_script_progression "Finalizing installation..." ### Use these lines only if the app installation needs to be finalized through ### web forms. We generally don't want to ask the final user, ### so we're going to use curl to automatically fill the fields and submit the ### forms. # ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" #================================================= # END OF SCRIPT #================================================= ynh_script_progression "Installation of $app completed"