#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= app_id=$YNH_APP_ARG_APP_ID sub_path=$YNH_APP_ARG_SUB_PATH app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= ynh_script_progression --message="Validating installation parameters..." final_path=$(ynh_app_setting_get --app=$app_id --key=final_path)$sub_path/icecoder test -e "/var/www/$(ynh_app_setting_get --app=$app_id --key=final_path)" || ynh_die --message="You don't have installed $app before installing this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=sub_path --value=$sub_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app_id:www-data "$final_path" #================================================= # GENERIC FINALIZATION #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed"