diff --git a/scripts/lxc/lxc-install.sh b/scripts/lxc/lxc-install.sh index 0b11db1bc..3485d0b56 100644 --- a/scripts/lxc/lxc-install.sh +++ b/scripts/lxc/lxc-install.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash -# Bash script to instal paperless in lxc containter +# Bash script to install paperless in lxc containter + +# Add paperless user with no password +adduser --disabled-password --gecos "" paperless +# Add ftpupload +adduser --disabled-password --gecos "" ftpupload +echo "Set ftpupload password: " +passwd ftpupload +# Allow paperless group to access +adduser paperless ftpupload # Get apt up to date apt-get update @@ -10,8 +19,17 @@ apt-get -y install unpaper gnupg libpoppler-cpp-dev python3-pyocr tesseract-ocr # Needed for Apache apt-get -y install apache2 libapache2-mod-wsgi-py3 -# paperless user -adduser --disabled-password --gecos "" paperless + +# Instll ftp server and make sure all files are owned by paperless +apt-get install proftpd +cat <> /etc/proftpd/proftpd.conf + + UserOwner paperless + GroupOwner paperless + +EOF +systemctl restart proftpd + #Get Paperless from git (NB: currently fork) su -c "cd /home/paperless ; git clone https://github.com/bmsleight/paperless" paperless @@ -24,8 +42,8 @@ pip3 install -r requirements.txt #Set up consume directory su -c "mkdir /home/paperless/consume" paperless -# Take paperless.conf.example and set consumuption dir -sed -e '/PAPERLESS_CONSUMPTION_DIR=/s/=.*/=\"\/home\/paperless\/consume\/\"/' \ +# Take paperless.conf.example and set consumuption dir (ftp dir) +sed -e '/PAPERLESS_CONSUMPTION_DIR=/s/=.*/=\"\/home\/ftpupload\/\"/' \ /home/paperless/paperless/paperless.conf.example >/etc/paperless.conf # Update /etc/paperless.conf with PAPERLESS_SECRET_KEY @@ -44,3 +62,14 @@ cp /home/paperless/paperless/scripts/lxc/paperless.conf /etc/apache2/sites-avail a2dissite 000-default.conf a2ensite paperless.conf systemctl reload apache2 + +sed -e "s/home\/paperless\/project\/virtualenv\/bin\/python/usr\/bin\/python3/" \ + /home/paperless/paperless/scripts/paperless-consumer.service \ + >/etc/systemd/system/paperless-consumer.service + +sed -i "s/\/home\/paperless\/project\/src\/manage.py/\/home\/paperless\/paperless\/src\/manage.py/" \ + /etc/systemd/system/paperless-consumer.service + + +systemctl enable paperless-consumer +systemctl start paperless-consumer