diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index ae4ef22..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/paperless-ngx/paperless-ngx/releases/download/v1.14.5/paperless-ngx-v1.14.5.tar.xz -SOURCE_SUM=355a5760cbc967c2bd6dcaf89f577aefd5acedd908361377976e04e17c95a8f9 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/paperless.conf.example b/conf/paperless.conf.example index 4ef0338..81304ec 100644 --- a/conf/paperless.conf.example +++ b/conf/paperless.conf.example @@ -19,13 +19,13 @@ PAPERLESS_DBPASS=__DB_PWD__ # Paths and folders PAPERLESS_SCRATCH_DIR=/tmp/__APP__ -PAPERLESS_CONSUMPTION_DIR=__DATADIR__/consume -PAPERLESS_DATA_DIR=__DATADIR__/data +PAPERLESS_CONSUMPTION_DIR=__DATA_DIR__/consume +PAPERLESS_DATA_DIR=__DATA_DIR__/data #PAPERLESS_TRASH_DIR= -PAPERLESS_MEDIA_ROOT=__DATADIR__/media +PAPERLESS_MEDIA_ROOT=__DATA_DIR__/media #PAPERLESS_STATICDIR=../static #PAPERLESS_FILENAME_FORMAT= -PAPERLESS_NLTK_DIR=__FINALPATH__/nltk_data +PAPERLESS_NLTK_DIR=__INSTALL_DIR__/nltk_data # Security and hosting diff --git a/conf/systemd-consumer.service b/conf/systemd-consumer.service index f3f4d06..1a1bf8b 100644 --- a/conf/systemd-consumer.service +++ b/conf/systemd-consumer.service @@ -6,8 +6,8 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/src/ -ExecStart=__FINALPATH__/venv/bin/python3 manage.py document_consumer +WorkingDirectory=__INSTALL_DIR__/src/ +ExecStart=__INSTALL_DIR__/venv/bin/python3 manage.py document_consumer StandardOutput=append:/var/log/__APP__/__APP__-consumer.log StandardError=inherit diff --git a/conf/systemd-scheduler.service b/conf/systemd-scheduler.service index 1bc4d39..240dbfe 100644 --- a/conf/systemd-scheduler.service +++ b/conf/systemd-scheduler.service @@ -6,8 +6,8 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/src/ -ExecStart=__FINALPATH__/venv/bin/celery --app paperless beat --loglevel INFO +WorkingDirectory=__INSTALL_DIR__/src/ +ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless beat --loglevel INFO StandardOutput=append:/var/log/__APP__/__APP__-scheduler.log StandardError=inherit diff --git a/conf/systemd-task-queue.service b/conf/systemd-task-queue.service index ea6d556..72982cc 100644 --- a/conf/systemd-task-queue.service +++ b/conf/systemd-task-queue.service @@ -6,8 +6,8 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/src/ -ExecStart=__FINALPATH__/venv/bin/celery --app paperless worker --loglevel INFO +WorkingDirectory=__INSTALL_DIR__/src/ +ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless worker --loglevel INFO StandardOutput=append:/var/log/__APP__/__APP__-task-queue.log StandardError=inherit diff --git a/conf/systemd.service b/conf/systemd.service index 636126f..1f93cdf 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,8 +8,8 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/src/ -ExecStart=__FINALPATH__/venv/bin/uvicorn --port=__PORT__ --log-level=warning paperless.asgi:application +WorkingDirectory=__INSTALL_DIR__/src/ +ExecStart=__INSTALL_DIR__/venv/bin/uvicorn --port=__PORT__ --log-level=warning paperless.asgi:application StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..7fbdfea --- /dev/null +++ b/manifest.toml @@ -0,0 +1,88 @@ +packaging_format = 2 + +id = "paperless-ngx" +name = "Paperless-ngx" +description.en = "Scan, index and archive all your physical documents" +description.fr = "Scannez, triez et archivez tous vos documents papiers" + +version = "1.14.5~ynh1" + +maintainers = ["Tagada"] + +[upstream] +license = "GPL-3.0-or-later" +website = "https://paperless-ngx.com" +demo = "https://demo.paperless-ngx.com/" +admindoc = "https://paperless-ngx.readthedocs.io/en/latest/index.html" +userdoc = "https://paperless-ngx.readthedocs.io/en/latest/usage_overview.html" +code = "https://github.com/paperless-ngx/paperless-ngx" +cpe = "???" # FIXME: No CPE yet... check https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=paperless + +[integration] +yunohost = ">= 11.0.0" +architectures = "all" +multi_instance = true +ldap = "false" +sso = "false" +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + full_domain = true + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + + [install.admin_pw] + ask.en = "Please chose a password for admin user." + type = "password" + + [install.init_main_permission] + type = "group" + default = false + + [install.is_public_api] + ask.en = "Should Paperless-ngx be accessible for apps." + type = "boolean" + default = false + +[resources] + [resources.sources] + + [resources.sources.main] + # This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with : + # ynh_setup_source --dest_dir="$install_dir" + # You can also define other assets than "main" and add --source_id="foobar" in the previous command + url = "https://github.com/paperless-ngx/paperless-ngx/releases/download/v1.14.5/paperless-ngx-v1.14.5.tar.xz" + sha256 = "355a5760cbc967c2bd6dcaf89f577aefd5acedd908361377976e04e17c95a8f9" + + # These infos are used by https://github.com/YunoHost/apps/blob/master/tools/autoupdate_app_sources/autoupdate_app_sources.py + # to auto-update the previous asset urls and sha256sum + manifest version + # assuming the upstream's code repo is on github and relies on tags or releases + # See the 'sources' resource documentation for more details + + autoupdate.strategy = "latest_github_release" + autoupdate.asset = "paperless-ngx-*.tar.xz" + + [resources.system_user] + + [resources.install_dir] + + [resources.data_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8095 + + [resources.apt] + packages = "python3, python3-pip, python3-dev, python3-venv, default-libmysqlclient-dev, fonts-liberation, imagemagick, gnupg, libpq-dev, libmagic-dev, mime-support, libzbar0, poppler-utils, postgresql, postgresql-contrib, unpaper, ghostscript, icc-profiles-free, qpdf, liblept5, libxml2, pngquant, zlib1g, tesseract-ocr, libatlas-base-dev, libxslt1-dev" + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index ff70f8e..d06f069 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,9 +5,9 @@ #================================================= # dependencies used by the app -pkg_dependencies="python3 python3-pip python3-dev python3-venv default-libmysqlclient-dev fonts-liberation imagemagick gnupg libpq-dev libmagic-dev mime-support libzbar0 poppler-utils postgresql postgresql-contrib " -ocr_pkg_dependencies="unpaper ghostscript icc-profiles-free qpdf liblept5 libxml2 pngquant zlib1g tesseract-ocr" -raspberry_pkg_dependencies="libatlas-base-dev libxslt1-dev" +#REMOVEME? pkg_dependencies="python3 python3-pip python3-dev python3-venv default-libmysqlclient-dev fonts-liberation imagemagick gnupg libpq-dev libmagic-dev mime-support libzbar0 poppler-utils postgresql postgresql-contrib " +#REMOVEME? ocr_pkg_dependencies="unpaper ghostscript icc-profiles-free qpdf liblept5 libxml2 pngquant zlib1g tesseract-ocr" +#REMOVEME? raspberry_pkg_dependencies="libatlas-base-dev libxslt1-dev" timezone=$(cat /etc/timezone) main_domain=$(cat /etc/yunohost/current_host) diff --git a/scripts/backup b/scripts/backup index f2ae68d..3d52553 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,24 +14,24 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. - true -} +# true +#} # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -47,13 +47,13 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= -ynh_backup --src_path="$datadir" --is_big +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 06c81d7..595a107 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,61 +13,61 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path="/" +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path="/" -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) -ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +#REMOVEME? paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) +#REMOVEME? ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -87,28 +87,30 @@ ynh_systemd_action --service_name="$app-task-queue" --action="stop" --log_path=" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf # Change the path in the NGINX config file if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -117,14 +119,14 @@ fi # MODIFY A CONFIGURATION #================================================= ynh_script_progression --message="Modifying a configuration file..." --weight=1 - +#REMOVEME? domain="$new_domain" -path_url="$new_path" +path="$new_path" -ynh_add_config --template="paperless.conf.example" --destination="$final_path/paperless.conf" +ynh_add_config --template="paperless.conf.example" --destination="$install_dir/paperless.conf" -chmod 400 "$final_path/paperless.conf" -chown $app:$app "$final_path/paperless.conf" +chmod 400 "$install_dir/paperless.conf" +chown $app:$app "$install_dir/paperless.conf" #================================================= # GENERIC FINALISATION @@ -141,9 +143,9 @@ ynh_systemd_action --service_name="$app-task-queue" --action="start" --log_path= #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 6d1be66..89145f9 100755 --- a/scripts/install +++ b/scripts/install @@ -14,97 +14,97 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC -is_public_api=$YNH_APP_ARG_IS_PUBLIC_API -admin=$YNH_APP_ARG_ADMIN -admin_pw=$YNH_APP_ARG_ADMIN_PW +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +path="/" +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? is_public_api=$YNH_APP_ARG_IS_PUBLIC_API +#REMOVEME? admin=$YNH_APP_ARG_ADMIN +#REMOVEME? admin_pw=$YNH_APP_ARG_ADMIN_PW -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/opt/yunohost/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? 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=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1 # FIXME: Only on a Raspberry Pi (armv6 v7?) # ynh_add_app_dependencies $raspberry_pkg_dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name +#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) +#REMOVEME? db_user=$db_name +#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION @@ -119,22 +119,22 @@ ynh_add_nginx_config #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." +#REMOVEME? ynh_script_progression --message="Installing Python dependencies..." -pushd $final_path +pushd $install_dir python3 -m venv venv - chown -R "$app:" "$final_path" + chown -R "$app:" "$install_dir" ( - source "$final_path/venv/bin/activate" - ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel - ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + source "$install_dir/venv/bin/activate" + ynh_exec_as $app $install_dir/venv/bin/pip3 install --upgrade pip setuptools wheel + ynh_exec_as $app $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" # Installing NLTK data - mkdir -p "$final_path/nltk_data" - chown -R "$app:" "$final_path/nltk_data" - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt + mkdir -p "$install_dir/nltk_data" + chown -R "$app:" "$install_dir/nltk_data" + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" snowball_data + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" stopwords + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" punkt deactivate ) @@ -145,16 +145,16 @@ popd #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir +#REMOVEME? data_dir=/home/yunohost.app/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir -mkdir -p "$datadir/consume" -mkdir -p "$datadir/data" -mkdir -p "$datadir/media" +mkdir -p "$data_dir/consume" +mkdir -p "$data_dir/data" +mkdir -p "$data_dir/media" -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:www-data "$data_dir" #================================================= # REMOVE TEMP DIRECTORY @@ -176,20 +176,20 @@ ynh_app_setting_set --app=$app --key=paperless_secret_key --value=$paperless_se ocr_language="eng" ynh_app_setting_set --app=$app --key=ocr_language --value=$ocr_language -ynh_add_config --template="paperless.conf.example" --destination="$final_path/paperless.conf" +ynh_add_config --template="paperless.conf.example" --destination="$install_dir/paperless.conf" -chmod 400 "$final_path/paperless.conf" -chown $app:$app "$final_path/paperless.conf" +chmod 400 "$install_dir/paperless.conf" +chown $app:$app "$install_dir/paperless.conf" #================================================= # SETUP THE DATABASE #================================================= ynh_script_progression --message="Setting up the database..." --weight=1 -pushd "$final_path/src" +pushd "$install_dir/src" ( - source "$final_path/venv/bin/activate" - ynh_exec_as $app $final_path/venv/bin/python manage.py migrate + source "$install_dir/venv/bin/activate" + ynh_exec_as $app $install_dir/venv/bin/python manage.py migrate deactivate ) popd @@ -199,11 +199,11 @@ popd #================================================= ynh_script_progression --message="Creating the admin user..." --weight=1 -pushd "$final_path/src" +pushd "$install_dir/src" ( - source "$final_path/venv/bin/activate" + source "$install_dir/venv/bin/activate" email=$(ynh_user_get_info $admin 'mail') - ynh_exec_as $app env "DJANGO_SUPERUSER_PASSWORD=$admin_pw" $final_path/venv/bin/python3 manage.py createsuperuser --noinput --username "$admin" --email "$email" + ynh_exec_as $app env "DJANGO_SUPERUSER_PASSWORD=$admin_pw" $install_dir/venv/bin/python3 manage.py createsuperuser --noinput --username "$admin" --email "$email" deactivate ) popd @@ -262,26 +262,26 @@ ynh_systemd_action --service_name="$app-task-queue" --action="start" --log_path= #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi -ynh_permission_create --permission="api" --url="/api" --allowed="all_users" --auth_header="false" --label="$app API" --show_tile="false" --protected="false" -if [ $is_public_api -eq 1 ] +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="all_users" --auth_header="false" --label="$app API" --show_tile="false" --protected="false" +#REMOVEME? if [ $is_public_api -eq 1 ] then - ynh_permission_update --permission="api" --add="visitors" +#REMOVEME? ynh_permission_update --permission="api" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 3931665..956b21c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -13,17 +13,17 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # STANDARD REMOVE @@ -63,18 +63,18 @@ ynh_remove_logrotate #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1 # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE DATA DIR @@ -84,7 +84,7 @@ ynh_secure_remove --file="$final_path" if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="$datadir" +#REMOVEME? ynh_secure_remove --file="$data_dir" fi #================================================= @@ -98,11 +98,11 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1 # Remove metapackage and its dependencies ynh_redis_remove_db "$redis_db" -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE FAIL2BAN CONFIGURATION @@ -130,10 +130,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 1bd65ad..3369893 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,30 +15,30 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) -ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) +#REMOVEME? ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db @@ -46,46 +46,46 @@ ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$datadir" --not_mandatory +ynh_restore_file --origin_path="$data_dir" --not_mandatory -mkdir -p "$datadir/consume" -mkdir -p "$datadir/data" -mkdir -p "$datadir/media" +mkdir -p "$data_dir/consume" +mkdir -p "$data_dir/data" +mkdir -p "$data_dir/media" -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R $app:$app "$data_dir" #================================================= # REMOVE TEMP DIRECTORY @@ -98,10 +98,10 @@ ynh_secure_remove --file="/tmp/$app" #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../settings/conf/paperless.conf.example" --destination="$final_path/paperless.conf" +ynh_add_config --template="../settings/conf/paperless.conf.example" --destination="$install_dir/paperless.conf" -chmod 400 "$final_path/paperless.conf" -chown $app:$app "$final_path/paperless.conf" +chmod 400 "$install_dir/paperless.conf" +chown $app:$app "$install_dir/paperless.conf" #================================================= # RESTORE FAIL2BAN CONFIGURATION @@ -117,24 +117,24 @@ chown $app:$app "$final_path/paperless.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." +#REMOVEME? ynh_script_progression --message="Installing Python dependencies..." -pushd $final_path - ynh_secure_remove --file="$final_path/venv" +pushd $install_dir +#REMOVEME? ynh_secure_remove --file="$install_dir/venv" python3 -m venv venv - chown -R "$app:" "$final_path" + chown -R "$app:" "$install_dir" ( - source "$final_path/venv/bin/activate" - ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel - ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + source "$install_dir/venv/bin/activate" + ynh_exec_as $app $install_dir/venv/bin/pip3 install --upgrade pip setuptools wheel + ynh_exec_as $app $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" deactivate ) popd @@ -149,10 +149,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the PostgresSQL database..." --weight=1 +#REMOVEME? ynh_script_progression --message="Restoring the PostgresSQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 979ea87..46cd524 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,22 +13,22 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) -admin=$(ynh_app_setting_get --app=$app --key=admin) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) -paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) -ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) +#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#REMOVEME? db_user=$db_name +#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#REMOVEME? redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +#REMOVEME? paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key) +#REMOVEME? ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language) #================================================= # CHECK VERSION @@ -38,16 +38,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -75,10 +75,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -88,19 +88,19 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - ynh_setup_source --dest_dir="$final_path" --keep="paperless.conf" + ynh_setup_source --dest_dir="$install_dir" --keep="paperless.conf" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1 -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies +#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $ocr_pkg_dependencies #================================================= # NGINX CONFIGURATION @@ -115,23 +115,23 @@ ynh_add_nginx_config #================================================= # INSTALL PYTHON DEPENDENCIES #================================================= -ynh_script_progression --message="Installing Python dependencies..." +#REMOVEME? ynh_script_progression --message="Installing Python dependencies..." -pushd $final_path +pushd $install_dir python3 -m venv venv - chown -R "$app:" "$final_path" + chown -R "$app:" "$install_dir" ( - source "$final_path/venv/bin/activate" - ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel - ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + source "$install_dir/venv/bin/activate" + ynh_exec_as $app $install_dir/venv/bin/pip3 install --upgrade pip setuptools wheel + ynh_exec_as $app $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" # Installing NLTK data - ynh_secure_remove --file="$final_path/nltk_data" - mkdir -p "$final_path/nltk_data" - chown -R "$app:" "$final_path/nltk_data" - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords - ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt +#REMOVEME? ynh_secure_remove --file="$install_dir/nltk_data" + mkdir -p "$install_dir/nltk_data" + chown -R "$app:" "$install_dir/nltk_data" + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" snowball_data + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" stopwords + ynh_exec_warn_less ynh_exec_as $app $install_dir/venv/bin/python3 -m nltk.downloader -d "$install_dir/nltk_data" punkt deactivate ) @@ -142,10 +142,10 @@ popd #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="paperless.conf.example" --destination="$final_path/paperless.conf" +ynh_add_config --template="paperless.conf.example" --destination="$install_dir/paperless.conf" -chmod 400 "$final_path/paperless.conf" -chown $app:$app "$final_path/paperless.conf" +chmod 400 "$install_dir/paperless.conf" +chown $app:$app "$install_dir/paperless.conf" #================================================= # REMOVE TEMP DIRECTORY @@ -158,10 +158,10 @@ ynh_secure_remove --file="/tmp/$app" #================================================= ynh_script_progression --message="Setting up the database..." --weight=1 -pushd "$final_path/src" +pushd "$install_dir/src" ( - source "$final_path/venv/bin/activate" - ynh_exec_as $app $final_path/venv/bin/python manage.py migrate + source "$install_dir/venv/bin/activate" + ynh_exec_as $app $install_dir/venv/bin/python manage.py migrate deactivate ) popd @@ -221,9 +221,9 @@ ynh_systemd_action --service_name="$app-task-queue" --action="start" --log_path= #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT