diff --git a/README.md b/README.md index 629da51..a72013f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -62,4 +62,4 @@ or sudo yunohost app upgrade paperless-ngx -u https://github.com/YunoHost-Apps/paperless-ngx_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 1d0e6bf..fbcb36c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ diff --git a/conf/paperless.conf.example b/conf/paperless.conf.example index 81304ec..91dff1e 100644 --- a/conf/paperless.conf.example +++ b/conf/paperless.conf.example @@ -81,7 +81,7 @@ PAPERLESS_CONSUMER_IGNORE_PATTERNS=[".DS_STORE/*", "._*", ".stfolder/*", ".*"] # Binaries #PAPERLESS_CONVERT_BINARY=/usr/bin/convert -#PAPERLESS_GS_BINARY=/usr/bin/gs +PAPERLESS_GS_BINARY=__INSTALL_DIR__/bin/gs #PAPERLESS_OPTIPNG_BINARY=/usr/bin/optipng # YunoHost tweaks diff --git a/conf/policy.xml b/conf/policy.xml new file mode 100644 index 0000000..35ec974 --- /dev/null +++ b/conf/policy.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/systemd-consumer.service b/conf/systemd-consumer.service index 1a1bf8b..9563edc 100644 --- a/conf/systemd-consumer.service +++ b/conf/systemd-consumer.service @@ -6,6 +6,7 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ +Environment=PATH=__LOCAL_PATH__ WorkingDirectory=__INSTALL_DIR__/src/ ExecStart=__INSTALL_DIR__/venv/bin/python3 manage.py document_consumer StandardOutput=append:/var/log/__APP__/__APP__-consumer.log diff --git a/conf/systemd-scheduler.service b/conf/systemd-scheduler.service index 240dbfe..5b6f132 100644 --- a/conf/systemd-scheduler.service +++ b/conf/systemd-scheduler.service @@ -6,6 +6,7 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ +Environment=PATH=__LOCAL_PATH__ WorkingDirectory=__INSTALL_DIR__/src/ ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless beat --loglevel INFO StandardOutput=append:/var/log/__APP__/__APP__-scheduler.log diff --git a/conf/systemd-task-queue.service b/conf/systemd-task-queue.service index 72982cc..3e8a1e1 100644 --- a/conf/systemd-task-queue.service +++ b/conf/systemd-task-queue.service @@ -6,6 +6,7 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ +Environment=PATH=__LOCAL_PATH__ WorkingDirectory=__INSTALL_DIR__/src/ ExecStart=__INSTALL_DIR__/venv/bin/celery --app paperless worker --loglevel INFO StandardOutput=append:/var/log/__APP__/__APP__-task-queue.log diff --git a/conf/systemd.service b/conf/systemd.service index 1f93cdf..7a88f28 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,6 +8,7 @@ Requires=redis.service Type=simple User=__APP__ Group=__APP__ +Environment=PATH=__LOCAL_PATH__ 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 diff --git a/doc/PRE_UPGRADE.d/2.4.3~ynh2.md b/doc/PRE_UPGRADE.d/2.4.3~ynh2.md new file mode 100644 index 0000000..a07324f --- /dev/null +++ b/doc/PRE_UPGRADE.d/2.4.3~ynh2.md @@ -0,0 +1,3 @@ +Starting 2.4.3~ynh2, and while YunoHost 12 is yet to be released, Paperless-NGX will require to build its Ghostscript dependency to be able to process documents. + +Expect a longer upgrade ! diff --git a/manifest.toml b/manifest.toml index 7d73c54..3206098 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,12 +61,16 @@ ram.runtime = "350M" autoupdate.strategy = "latest_github_release" autoupdate.asset = "paperless-ngx-.*.tar.xz" + [resources.sources.gs] + url = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10021/ghostpdl-10.02.1.tar.gz" + sha256 = "25399af0ef5bb94f2a13c91dc785c128d14f16744c4c92fa7c86e011c23151d8" + [resources.system_user] [resources.install_dir] [resources.data_dir] - subdirs = ["consume", "data", "media"] + subdirs = ["consume", "data", "media", "imagemagick"] [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 43462c2..f5f87df 100755 --- a/scripts/install +++ b/scripts/install @@ -17,6 +17,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/ghostscript" --source_id="gs" + chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -55,6 +57,24 @@ pushd $install_dir ) popd +#================================================= +# BUILD GHOSTCRIPT SPECIFIC VERSION +#================================================= +ynh_script_progression --message="Building Ghostscript dependency... (this will take a long time!)" + +pushd $install_dir/ghostscript + ynh_exec_warn_less ./configure + ynh_exec_warn_less make + mv bin/ $install_dir/ +popd + +ynh_secure_remove --file="$install_dir/ghostscript" +chmod -R o-rwx "$install_dir/bin" +chown -R $app:$app "$install_dir/bin" +chmod 550 $install_dir/bin/gs + +local_path=$install_dir/bin/:$PATH + #================================================= # CREATE DATA DIRECTORY #================================================= @@ -83,6 +103,12 @@ ynh_add_config --template="paperless.conf.example" --destination="$install_dir/p chmod 400 "$install_dir/paperless.conf" chown $app:$app "$install_dir/paperless.conf" +# ImageMagick configuration +mkdir -p "$install_dir/.config/ImageMagick" +ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml" +chmod 400 "$install_dir/.config/ImageMagick/policy.xml" +chown -R $app:$app "$install_dir/.config" + #================================================= # SETUP THE DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 78ad9e1..6be9942 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,6 +95,29 @@ pushd $install_dir ) popd +#================================================= +# BUILD GHOSTCRIPT SPECIFIC VERSION +#================================================= +if ! dpkg --compare-versions "$($install_dir/bin/gs --version 2>/dev/null)" ge "10.02.1" +then + ynh_script_progression --message="Building Ghostscript dependency... (this will take a long time!)" + + ynh_setup_source --dest_dir="$install_dir/ghostscript" --source_id="gs" --full_replace + + pushd $install_dir/ghostscript + ynh_exec_warn_less ./configure + ynh_exec_warn_less make + mv bin/ $install_dir/ + popd + + ynh_secure_remove --file="$install_dir/ghostscript" + chmod -R o-rwx "$install_dir/bin" + chown -R $app:$app "$install_dir/bin" + chmod 550 $install_dir/bin/gs +fi + +local_path=$install_dir/bin/:$PATH + #================================================= # UPDATE A CONFIG FILE #================================================= @@ -105,6 +128,12 @@ ynh_add_config --template="paperless.conf.example" --destination="$install_dir/p chmod 400 "$install_dir/paperless.conf" chown $app:$app "$install_dir/paperless.conf" +# ImageMagick configuration +mkdir -p "$install_dir/.config/ImageMagick" +ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml" +chmod 400 "$install_dir/.config/ImageMagick/policy.xml" +chown -R $app:$app "$install_dir/.config" + #================================================= # SETUP THE DATABASE #=================================================