mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #454 from schnuffle/pre-commit
Corrections to pass pre-commit hooks
This commit is contained in:
		
							
								
								
									
										2
									
								
								.env
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								.env
									
									
									
									
									
								
							| @@ -1,2 +1,2 @@ | ||||
| COMPOSE_PROJECT_NAME=paperless | ||||
| export PROMPT="(pipenv-projectname)$P$G" | ||||
| export PROMPT="(pipenv-projectname)$P$G" | ||||
|   | ||||
							
								
								
									
										10
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -11,7 +11,15 @@ FROM ubuntu:20.04 AS jbig2enc | ||||
|  | ||||
| WORKDIR /usr/src/jbig2enc | ||||
|  | ||||
| RUN apt-get update && apt-get install -y --no-install-recommends build-essential automake libtool libleptonica-dev zlib1g-dev git ca-certificates | ||||
| RUN apt-get update \ | ||||
|   && apt-get install -y --no-install-recommends build-essential \ | ||||
|     automake \ | ||||
|     libtool \ | ||||
|     libleptonica-dev \ | ||||
|     zlib1g-dev \ | ||||
|     git \ | ||||
|     ca-certificates \ | ||||
|   && rm -rf /var/lib/apt/lists/* | ||||
|  | ||||
| RUN git clone https://github.com/agl/jbig2enc . | ||||
| RUN ./autogen.sh | ||||
|   | ||||
| @@ -56,12 +56,12 @@ install_languages() { | ||||
| 		#    continue | ||||
| 		#fi | ||||
|  | ||||
| 		if dpkg -s $pkg &>/dev/null; then | ||||
| 		if dpkg -s "$pkg" &>/dev/null; then | ||||
| 			echo "Package $pkg already installed!" | ||||
| 			continue | ||||
| 		fi | ||||
|  | ||||
| 		if ! apt-cache show $pkg &>/dev/null; then | ||||
| 		if ! apt-cache show "$pkg" &>/dev/null; then | ||||
| 			echo "Package $pkg not found! :(" | ||||
| 			continue | ||||
| 		fi | ||||
| @@ -77,7 +77,7 @@ install_languages() { | ||||
| echo "Paperless-ngx docker container starting..." | ||||
|  | ||||
| # Install additional languages if specified | ||||
| if [[ ! -z "$PAPERLESS_OCR_LANGUAGES" ]]; then | ||||
| if [[ -n "$PAPERLESS_OCR_LANGUAGES" ]]; then | ||||
| 	install_languages "$PAPERLESS_OCR_LANGUAGES" | ||||
| fi | ||||
|  | ||||
|   | ||||
| @@ -6,14 +6,11 @@ wait_for_postgres() { | ||||
|  | ||||
| 	echo "Waiting for PostgreSQL to start..." | ||||
|  | ||||
| 	host="${PAPERLESS_DBHOST}" | ||||
| 	port="${PAPERLESS_DBPORT}" | ||||
| 	host="${PAPERLESS_DBHOST:=localhost}" | ||||
| 	port="${PAPERLESS_DBPORT:=5342}" | ||||
|  | ||||
| 	if [[ -z $port ]]; then | ||||
| 		port="5432" | ||||
| 	fi | ||||
|  | ||||
| 	while ! </dev/tcp/$host/$port; do | ||||
| 	while [ ! "$(pg_isready -h $host -p $port)" ]; do | ||||
|  | ||||
| 		if [ $attempt_num -eq $max_attempts ]; then | ||||
| 			echo "Unable to connect to database." | ||||
| @@ -23,7 +20,7 @@ wait_for_postgres() { | ||||
|  | ||||
| 		fi | ||||
|  | ||||
| 		attempt_num=$(expr "$attempt_num" + 1) | ||||
| 		attempt_num=$(("$attempt_num" + 1)) | ||||
| 		sleep 5 | ||||
| 	done | ||||
| } | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| for command in document_archiver document_exporter document_importer mail_fetcher document_create_classifier document_index document_renamer document_retagger document_thumbnails document_sanity_checker manage_superuser; | ||||
| do | ||||
| 	echo "installing $command..." | ||||
|   | ||||
| @@ -6,10 +6,10 @@ cd /usr/src/paperless/src/ | ||||
|  | ||||
| if [[ $(id -u) == 0 ]] ; | ||||
| then | ||||
|   gosu paperless python3 manage.py management_command "$@" | ||||
| 	gosu paperless python3 manage.py management_command "$@" | ||||
| elif [[ $(id -un) == "paperless" ]] ; | ||||
| then | ||||
|   python3 manage.py management_command "$@" | ||||
| 	python3 manage.py management_command "$@" | ||||
| else | ||||
|   echo "Unknown user." | ||||
| 	echo "Unknown user." | ||||
| fi | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| FROM python:3.5.1 | ||||
| MAINTAINER Pit Kleyersburg <pitkley@googlemail.com> | ||||
|  | ||||
| # Install Sphinx and Pygments | ||||
| RUN pip install Sphinx Pygments | ||||
|   | ||||
| @@ -1688,4 +1688,4 @@ bulk of the work on this big change. | ||||
| .. _a new home on Docker Hub: https://hub.docker.com/r/danielquinn/paperless/ | ||||
| .. _optipng: http://optipng.sourceforge.net/ | ||||
| .. _DjangoQL: https://github.com/ivelum/djangoql | ||||
| .. _ansible repo: https://github.com/paperless-ngx/paperless-ngx-ansible | ||||
| .. _ansible repo: https://github.com/paperless-ngx/paperless-ngx-ansible | ||||
|   | ||||
| @@ -5,11 +5,11 @@ Frequently asked questions | ||||
|  | ||||
| **Q:** *What's the general plan for Paperless-ngx?* | ||||
|  | ||||
| **A:** While Paperless-ngx is already considered largely "feature-complete" it is a community-driven  | ||||
| **A:** While Paperless-ngx is already considered largely "feature-complete" it is a community-driven | ||||
| project and development will be guided in this way. New features can be submitted via | ||||
| GitHub discussions and "up-voted" by the community but this is not a garauntee the feature | ||||
| will be implemented. This project will always be open to collaboration in the form of PRs, | ||||
| ideas etc.  | ||||
| ideas etc. | ||||
|  | ||||
| **Q:** *I'm using docker. Where are my documents?* | ||||
|  | ||||
| @@ -83,7 +83,7 @@ a long time. | ||||
|  | ||||
| **Q:** *How do I run this on Unraid?* | ||||
|  | ||||
| **A:** Paperless-ngx is available as `community app <https://unraid.net/community/apps?q=paperless-ngx>`_  | ||||
| **A:** Paperless-ngx is available as `community app <https://unraid.net/community/apps?q=paperless-ngx>`_ | ||||
| in Unraid. `Uli Fahrer <https://github.com/Tooa>`_ created a container template for that. | ||||
|  | ||||
| **Q:** *How do I run this on my toaster?* | ||||
|   | ||||
| @@ -42,4 +42,3 @@ Mobile support in the future? This kinda works, however some layouts are still | ||||
| too wide. | ||||
|  | ||||
| .. image:: _static/screenshots/mobile.png | ||||
|  | ||||
|   | ||||
| @@ -477,7 +477,7 @@ Migrating from Paperless-ng | ||||
| =========================== | ||||
|  | ||||
| Paperless-ngx is meant to be a drop-in replacement for Paperless-ng and thus upgrading should be | ||||
| trivial for most users, especially when using docker. However, as with any major change, it is  | ||||
| trivial for most users, especially when using docker. However, as with any major change, it is | ||||
| recommended to take a full backup first. Once you are ready, simply change the docker image to | ||||
| point to the new source. E.g. if using Docker Compose, edit ``docker-compose.yml`` and change: | ||||
|  | ||||
| @@ -490,12 +490,12 @@ to | ||||
| .. code:: | ||||
|  | ||||
|   image: ghcr.io/paperless-ngx/paperless-ngx:latest | ||||
|      | ||||
|  | ||||
| and then run ``docker-compose up -d`` which will pull the new image recreate the container. | ||||
| That's it! | ||||
|  | ||||
| Users who installed with the bare-metal route should also update their Git clone to point to  | ||||
| ``https://github.com/paperless-ngx/paperless-ngx``, e.g. using the command  | ||||
| Users who installed with the bare-metal route should also update their Git clone to point to | ||||
| ``https://github.com/paperless-ngx/paperless-ngx``, e.g. using the command | ||||
| ``git remote set-url origin https://github.com/paperless-ngx/paperless-ngx`` and then pull the | ||||
| lastest version. | ||||
|  | ||||
|   | ||||
| @@ -3,16 +3,16 @@ | ||||
| ask() { | ||||
| 	while true ; do | ||||
| 		if [[ -z $3 ]] ; then | ||||
| 			read -p "$1 [$2]: " result | ||||
| 			read -r -p "$1 [$2]: " result | ||||
| 		else | ||||
| 			read -p "$1 ($3) [$2]: " result | ||||
| 			read -r -p "$1 ($3) [$2]: " result | ||||
| 		fi | ||||
| 		if [[ -z $result ]]; then | ||||
| 			ask_result=$2 | ||||
| 			return | ||||
| 		fi | ||||
| 		array=$3 | ||||
| 		if [[ -z $3 || " ${array[@]} " =~ " ${result} " ]]; then | ||||
| 		if [[ -z $3 || " ${array[*]} " =~ ${result} ]]; then | ||||
| 			ask_result=$result | ||||
| 			return | ||||
| 		else | ||||
| @@ -24,7 +24,7 @@ ask() { | ||||
| ask_docker_folder() { | ||||
| 	while true ; do | ||||
|  | ||||
| 		read -p "$1 [$2]: " result | ||||
| 		read -r -p "$1 [$2]: " result | ||||
|  | ||||
| 		if [[ -z $result ]]; then | ||||
| 			ask_result=$2 | ||||
| @@ -64,8 +64,7 @@ fi | ||||
|  | ||||
| # Check if user has permissions to run Docker by trying to get the status of Docker (docker status). | ||||
| # If this fails, the user probably does not have permissions for Docker. | ||||
| docker stats --no-stream 2>/dev/null 1>&2 | ||||
| if [ $? -ne 0 ] ; then | ||||
| if [ ! "$(docker stats --no-stream 2>/dev/null 1>&2)" ] ; then | ||||
| 	echo "" | ||||
| 	echo "WARN: It look like the current user does not have Docker permissions." | ||||
| 	echo "WARN: Use 'sudo usermod -aG docker $USER' to assign Docker permissions to the user." | ||||
| @@ -228,7 +227,7 @@ ask "Paperless username" "$(whoami)" | ||||
| USERNAME=$ask_result | ||||
|  | ||||
| while true; do | ||||
| 	read -sp "Paperless password: " PASSWORD | ||||
| 	read -r -sp "Paperless password: " PASSWORD | ||||
| 	echo "" | ||||
|  | ||||
| 	if [[ -z $PASSWORD ]] ; then | ||||
| @@ -236,7 +235,7 @@ while true; do | ||||
| 		continue | ||||
| 	fi | ||||
|  | ||||
| 	read -sp "Paperless password (again): " PASSWORD_REPEAT | ||||
| 	read -r -sp "Paperless password (again): " PASSWORD_REPEAT | ||||
| 	echo "" | ||||
|  | ||||
| 	if [[ ! "$PASSWORD" == "$PASSWORD_REPEAT" ]] ; then | ||||
| @@ -285,7 +284,7 @@ echo "Paperless username: $USERNAME" | ||||
| echo "Paperless email: $EMAIL" | ||||
|  | ||||
| echo "" | ||||
| read -p "Press any key to install." | ||||
| read -r -p "Press any key to install." | ||||
|  | ||||
| echo "" | ||||
| echo "Installing paperless..." | ||||
| @@ -304,7 +303,7 @@ fi | ||||
| wget "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/docker/compose/docker-compose.$DOCKER_COMPOSE_VERSION.yml" -O docker-compose.yml | ||||
| wget "https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/main/docker/compose/.env" -O .env | ||||
|  | ||||
| SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) | ||||
| SECRET_KEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 64 | head -n 1) | ||||
|  | ||||
| DEFAULT_LANGUAGES="deu eng fra ita spa" | ||||
|  | ||||
| @@ -318,7 +317,7 @@ DEFAULT_LANGUAGES="deu eng fra ita spa" | ||||
| 	echo "PAPERLESS_TIME_ZONE=$TIME_ZONE" | ||||
| 	echo "PAPERLESS_OCR_LANGUAGE=$OCR_LANGUAGE" | ||||
| 	echo "PAPERLESS_SECRET_KEY=$SECRET_KEY" | ||||
| 	if [[ ! " ${DEFAULT_LANGUAGES[@]} " =~ " ${OCR_LANGUAGE} " ]] ; then | ||||
| 	if [[ ! " ${DEFAULT_LANGUAGES[*]} " =~ ${OCR_LANGUAGE} ]] ; then | ||||
| 		echo "PAPERLESS_OCR_LANGUAGES=$OCR_LANGUAGE" | ||||
| 	fi | ||||
| } > docker-compose.env | ||||
| @@ -334,12 +333,12 @@ fi | ||||
|  | ||||
| if [[ -n $DATA_FOLDER ]] ; then | ||||
| 	sed -i "s#- data:/usr/src/paperless/data#- $DATA_FOLDER:/usr/src/paperless/data#g" docker-compose.yml | ||||
|     sed -i "/^\s*data:/d" docker-compose.yml | ||||
| 	sed -i "/^\s*data:/d" docker-compose.yml | ||||
| fi | ||||
|  | ||||
| if [[ -n $POSTGRES_FOLDER ]] ; then | ||||
| 	sed -i "s#- pgdata:/var/lib/postgresql/data#- $POSTGRES_FOLDER:/var/lib/postgresql/data#g" docker-compose.yml | ||||
|     sed -i "/^\s*pgdata:/d" docker-compose.yml | ||||
| 	sed -i "/^\s*pgdata:/d" docker-compose.yml | ||||
| fi | ||||
|  | ||||
| # remove trailing blank lines from end of file | ||||
| @@ -348,7 +347,7 @@ sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' docker-compose.yml | ||||
| l1=$(grep -n '^volumes:' docker-compose.yml | cut -d : -f 1)  # get line number containing volume: at begin of line | ||||
| l2=$(wc -l < docker-compose.yml)  # get total number of lines | ||||
| if [ "$l1" -eq "$l2" ] ; then | ||||
|     sed -i "/^volumes:/d" docker-compose.yml | ||||
| 	sed -i "/^volumes:/d" docker-compose.yml | ||||
| fi | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,3 +1,5 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| docker run -p 5432:5432 -e POSTGRES_PASSWORD=password -v paperless_pgdata:/var/lib/postgresql/data -d postgres:13 | ||||
| docker run -d -p 6379:6379 redis:latest | ||||
| docker run -p 3000:3000 -d gotenberg/gotenberg:7 | ||||
|   | ||||
| @@ -60,4 +60,4 @@ small > svg { | ||||
|  | ||||
| .show .btn-outline-primary { | ||||
|   color: #fff; | ||||
| } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon