diff --git a/install-paperless-ngx.sh b/install-paperless-ngx.sh index e8a046c40..938598bf1 100755 --- a/install-paperless-ngx.sh +++ b/install-paperless-ngx.sh @@ -329,16 +329,29 @@ sed -i "s#- \./consume:/usr/src/paperless/consume#- $CONSUME_FOLDER:/usr/src/pap if [[ -n $MEDIA_FOLDER ]] ; then sed -i "s#- media:/usr/src/paperless/media#- $MEDIA_FOLDER:/usr/src/paperless/media#g" docker-compose.yml + sed -i "/^\s*media:/d" docker-compose.yml 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 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 fi +# remove trailing blank lines from end of file +sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' docker-compose.yml +# if last line in file contains "volumes:", remove that line since no more named volumes are left +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 +fi + + docker-compose pull docker-compose run --rm -e DJANGO_SUPERUSER_PASSWORD="$PASSWORD" webserver createsuperuser --noinput --username "$USERNAME" --email "$EMAIL"