diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 886fb54..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=ICEcoder for YunoHost -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 - -[Install] -WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index 82177db..f07b841 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Code editor awesomeness ...in your browser", "fr": "Un éditeur de code impressionnant ...dans votre navigateur" }, - "version": "1.2~ynh1", + "version": "2.0.0~ynh1", "url": "https://icecoder.net/", "license": "AGPL-3.0-only", "maintainer": { @@ -30,14 +30,16 @@ "example": "example.com" }, { - "name": "path", - "type": "path", - "help": { - "en": "Choose the internal path for this app (We recommand to set it to the internal path of a Custom Webapp).", - "fr": "Choisissez le chemin interne de cette application (nous vous recommandons de le définir sur le chemin interne d'une Custom Webapp)." + "name": "app_id", + "type": "string", + "ask": { + "en": "Indicate the ID of the Custom Webapp where you want to install this app", + "fr": "Indiquez l'ID de la Custom Webapp dans laquelle vous voulez installer cette app" }, - "example": "/var/www/my_webapp/www/icecoder", - "default": "/var/www/my_webapp/www/icecoder" + "help": { + "en": "You can get the ID in Custom Webapp's settings.", + "fr": "Vous pouvez obtenir l'ID dans les paramètres de la Webapp personnalisée." + } } ] } diff --git a/scripts/backup b/scripts/backup index 567b188..3e23255 100755 --- a/scripts/backup +++ b/scripts/backup @@ -44,14 +44,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 660484e..33a4df7 100755 --- a/scripts/install +++ b/scripts/install @@ -21,8 +21,8 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH - +app_id=$YNH_APP_ARG_APP_ID +path_url="/in-$app_id-folder" ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -51,13 +51,15 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" -final_path=$path_url +final_path=/var/www/$YNH_APP_ARG_APP_ID/www/icecoder + +#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -65,6 +67,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=app_id --value=$app_id #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -79,6 +82,8 @@ 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" +#================================================= + #================================================= # GENERIC FINALIZATION #================================================= @@ -89,6 +94,9 @@ ynh_setup_source --dest_dir="$final_path" ### Then, if write authorization is needed, any access should be given only to directories ### that really need such authorization. +# Set permissions to app files +chown -R $YNH_APP_ARG_APP_ID $final_path + #================================================= # SETUP LOGROTATE #================================================= @@ -105,18 +113,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# SETUP PERMISSIONS -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -if [[ $path_url =~ my_webapp ]] -then - chown -R my_webapp $final_path -else - chown -R www-data.www-data $final_path -fi - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 97ad898..1fcfa68 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -28,27 +27,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -# Remove the log files -ynh_secure_remove --file="/var/log/$app/" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index da00f18..ed09db3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,13 +27,16 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +app_id=$(ynh_app_setting_get --app=$app --key=app_id) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before restore this app!" + ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ @@ -58,18 +61,7 @@ ynh_restore_file --origin_path="$final_path" # RESTORE USER RIGHTS #================================================= -if [[ $path_url =~ my_webapp ]] -then - chown -R my_webapp $final_path -else - chown -R www-data.www-data $final_path -fi - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +chown -R $app_id $final_path #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index a079094..bd9048a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -104,25 +104,12 @@ fi #================================================= # GENERIC FINALIZATION #================================================= -# SECURE FILES AND DIRECTORIES +# PERMISSIONS SETUP #================================================= - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - - - # Configure internal permissions for ICEcoder chown -R $app $final_path - - #================================================= # END OF SCRIPT #=================================================