Update paperless-ngx-install.sh
This commit is contained in:
parent
7d18b44a05
commit
92c5a572d1
1 changed files with 13 additions and 13 deletions
|
@ -18,7 +18,6 @@ set -o pipefail
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||||
trap die ERR
|
trap die ERR
|
||||||
Paperlessngx=$(wget -q https://github.com/paperless-ngx/paperless-ngx/releases/latest -O - | grep "title>Release" | cut -d " " -f 5)
|
|
||||||
|
|
||||||
function error_exit() {
|
function error_exit() {
|
||||||
trap - ERR
|
trap - ERR
|
||||||
|
@ -69,7 +68,7 @@ apt-get update &>/dev/null
|
||||||
apt-get -y upgrade &>/dev/null
|
apt-get -y upgrade &>/dev/null
|
||||||
msg_ok "Updated Container OS"
|
msg_ok "Updated Container OS"
|
||||||
|
|
||||||
msg_info "Installing Paperless Dependencies"
|
msg_info "Installing Paperless-ngx Dependencies"
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
python3 \
|
python3 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
@ -84,7 +83,7 @@ apt-get install -y --no-install-recommends \
|
||||||
libzbar0 \
|
libzbar0 \
|
||||||
poppler-utils \
|
poppler-utils \
|
||||||
sudo &>/dev/null
|
sudo &>/dev/null
|
||||||
msg_ok "Installed Paperless Dependencies"
|
msg_ok "Installed Paperless-ngx Dependencies"
|
||||||
|
|
||||||
msg_info "Installing OCR Dependencies"
|
msg_info "Installing OCR Dependencies"
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -129,7 +128,8 @@ cd /opt/jbig2enc
|
||||||
rm -rf /opt/jbig2enc
|
rm -rf /opt/jbig2enc
|
||||||
msg_ok "Installed JBIG2"
|
msg_ok "Installed JBIG2"
|
||||||
|
|
||||||
msg_info "Downloading Paperless-NGx"
|
msg_info "Downloading Paperless-ngx"
|
||||||
|
Paperlessngx=$(wget -q https://github.com/paperless-ngx/paperless-ngx/releases/latest -O - | grep "title>Release" | cut -d " " -f 5)
|
||||||
cd /opt && \
|
cd /opt && \
|
||||||
wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz &>/dev/null && \
|
wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$Paperlessngx/paperless-ngx-$Paperlessngx.tar.xz &>/dev/null && \
|
||||||
tar -xf paperless-ngx-$Paperlessngx.tar.xz -C /opt/ &>/dev/null && \
|
tar -xf paperless-ngx-$Paperlessngx.tar.xz -C /opt/ &>/dev/null && \
|
||||||
|
@ -142,7 +142,7 @@ sed -i -e 's|-e git+https://github.com/paperless-ngx/django-q.git|git+https://gi
|
||||||
|
|
||||||
/usr/bin/python3 -m pip install --upgrade pip &>/dev/null
|
/usr/bin/python3 -m pip install --upgrade pip &>/dev/null
|
||||||
/usr/bin/python3 -m pip install -r requirements.txt &>/dev/null
|
/usr/bin/python3 -m pip install -r requirements.txt &>/dev/null
|
||||||
msg_ok "Downloaded Paperless-NGx"
|
msg_ok "Downloaded Paperless-ngx"
|
||||||
|
|
||||||
msg_info "Setting up database"
|
msg_info "Setting up database"
|
||||||
DB_USER=paperless
|
DB_USER=paperless
|
||||||
|
@ -152,11 +152,11 @@ DB_NAME=paperlessdb
|
||||||
sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" &>/dev/null
|
sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" &>/dev/null
|
||||||
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" &>/dev/null
|
sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" &>/dev/null
|
||||||
|
|
||||||
echo "Paperless-NGx Database User" >> ~/paperless.creds
|
echo "Paperless-ngx Database User" >> ~/paperless.creds
|
||||||
echo $DB_USER >> ~/paperless.creds
|
echo $DB_USER >> ~/paperless.creds
|
||||||
echo "Paperless-NGx Database Password" >> ~/paperless.creds
|
echo "Paperless-ngx Database Password" >> ~/paperless.creds
|
||||||
echo $DB_PASS >> ~/paperless.creds
|
echo $DB_PASS >> ~/paperless.creds
|
||||||
echo "Paperless-NGx Database Name" >> ~/paperless.creds
|
echo "Paperless-ngx Database Name" >> ~/paperless.creds
|
||||||
echo $DB_NAME >> ~/paperless.creds
|
echo $DB_NAME >> ~/paperless.creds
|
||||||
|
|
||||||
/bin/bash -c "mkdir -p {consume,media}"
|
/bin/bash -c "mkdir -p {consume,media}"
|
||||||
|
@ -170,7 +170,7 @@ cd /opt/paperless/src
|
||||||
/usr/bin/python3 manage.py migrate &>/dev/null
|
/usr/bin/python3 manage.py migrate &>/dev/null
|
||||||
msg_ok "Set up database"
|
msg_ok "Set up database"
|
||||||
|
|
||||||
msg_info "Setting up admin Paperless-NGx User & Password"
|
msg_info "Setting up admin Paperless-ngx User & Password"
|
||||||
## From https://github.com/linuxserver/docker-paperless-ngx/blob/main/root/etc/cont-init.d/99-migrations
|
## From https://github.com/linuxserver/docker-paperless-ngx/blob/main/root/etc/cont-init.d/99-migrations
|
||||||
cat << EOF | python3 /opt/paperless/src/manage.py shell
|
cat << EOF | python3 /opt/paperless/src/manage.py shell
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
@ -182,11 +182,11 @@ if len(UserModel.objects.all()) == 1:
|
||||||
user.save()
|
user.save()
|
||||||
EOF
|
EOF
|
||||||
echo "" >> ~/paperless.creds
|
echo "" >> ~/paperless.creds
|
||||||
echo "Paperless-NGx WebUI User" >> ~/paperless.creds
|
echo "Paperless-ngx WebUI User" >> ~/paperless.creds
|
||||||
echo admin >> ~/paperless.creds
|
echo admin >> ~/paperless.creds
|
||||||
echo "Paperless-NGx WebUI Password" >> ~/paperless.creds
|
echo "Paperless-ngx WebUI Password" >> ~/paperless.creds
|
||||||
echo $DB_PASS >> ~/paperless.creds
|
echo $DB_PASS >> ~/paperless.creds
|
||||||
msg_ok "Set up admin Paperless-NGx User & Password"
|
msg_ok "Set up admin Paperless-ngx User & Password"
|
||||||
|
|
||||||
cat << EOF > /etc/systemd/system/paperless-scheduler.service
|
cat << EOF > /etc/systemd/system/paperless-scheduler.service
|
||||||
[Unit]
|
[Unit]
|
||||||
|
@ -234,7 +234,7 @@ sed -i -e 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/' /et
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable --now paperless-consumer paperless-webserver paperless-scheduler &>/dev/null
|
systemctl enable --now paperless-consumer paperless-webserver paperless-scheduler &>/dev/null
|
||||||
|
|
||||||
msg_ok "Finished installing Paperless-NGx"
|
msg_ok "Finished installing Paperless-ngx"
|
||||||
|
|
||||||
PASS=$(grep -w "root" /etc/shadow | cut -b6);
|
PASS=$(grep -w "root" /etc/shadow | cut -b6);
|
||||||
if [[ $PASS != $ ]]; then
|
if [[ $PASS != $ ]]; then
|
||||||
|
|
Loading…
Reference in a new issue