Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
paperless-baremetal/paperless-ngx.build.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
123 lines (85 sloc)
2.55 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
{ | |
set -x | |
set -e | |
. build.profile | |
. ${PREFIX}/${BUILD_pngquant}/profile | |
. ${PREFIX}/${BUILD_ffmpeg}/profile | |
. ${PREFIX}/${BUILD_unpaper}/profile | |
. ${PREFIX}/${BUILD_sqlite}/profile | |
. ${PREFIX}/${BUILD_imagemagick}/profile | |
. ${PREFIX}/${BUILD_zbar}/profile | |
. ${PREFIX}/${BUILD_nginx}/profile | |
. ${PREFIX}/${BUILD_python}/profile | |
. ${PREFIX}/${BUILD_node}/profile | |
. ${PREFIX}/${BUILD_leptonica}/profile | |
. ${PREFIX}/${BUILD_jbig2enc}/profile | |
. ${PREFIX}/${BUILD_jbig2dec}/profile | |
. ${PREFIX}/${BUILD_tesseract}/profile | |
function B_PAPERLESS { | |
PREFIX=${PROJECT}/paperless-ngx | |
BUILD_PKG=${BUILD_paperless} | |
if [[ -e ${BUILD_PKG}.tar ]]; then | |
tar -xf ${BUILD_PKG}.tar | |
fi | |
if [[ ! -d ${BUILD_PKG} ]]; then | |
git clone https://github.com/paperless-ngx/paperless-ngx.git --branch v${BUILD_PKG##*-} --single-branch ${BUILD_PKG} | |
fi | |
if [[ ! -e ${BUILD_PKG}.tar ]]; then | |
tar cf ${BUILD_PKG}.tar ${BUILD_PKG} | |
fi | |
if [[ ! -d ${PREFIX} ]]; then | |
git clone ${BUILD_PKG} ${PREFIX} | |
else | |
pushd ${PREFIX} | |
git pull origin v${BUILD_PKG##*-} | |
popd | |
fi | |
# we need paperless-ngx to be extracted since it reads paperless.conf.example | |
# what a mess 8-( | |
pushd ${BUILD_SRC} | |
./paperless.conf.build.sh | |
popd | |
pushd $PROJECT | |
mkdir -vp data | |
mkdir -vp consume | |
mkdir -vp media | |
mkdir -vp log | |
popd | |
pushd $PREFIX | |
. ${PROJECT}/profile | |
pipenv requirements > requirements.txt | |
pip install -r requirements.txt | |
pushd src-ui | |
npm update npm -g --no-fund | |
ulimit -n 512 | |
set +e | |
while true; do | |
npm ci --no-fund | |
r=$? | |
[ $r != 232 ] && [ $r != 146 ] && break | |
done | |
set -e | |
./node_modules/.bin/ng build --configuration production | |
popd | |
pushd src | |
./manage.py collectstatic --clear --no-input --link | |
./manage.py compilemessages | |
./manage.py migrate | |
PAPERLESS_ADMIN_USER=${PAPERLESS_ADMIN_USER:-admin} | |
PAPERLESS_ADMIN_PASSWORD=${PAPERLESS_ADMIN_PASSWORD:-$( head -c 64 /dev/urandom | openssl base64 |head -1)} | |
PAPERLESS_ADMIN_MAIL=${PAPERLESS_ADMIN_MAIL:-admin@localhost.lan} | |
./manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('${PAPERLESS_ADMIN_USER}', '${PAPERLESS_ADMIN_MAIL}', '${PAPERLESS_ADMIN_PASSWORD}')" || true | |
popd | |
echo "Installing NLTK data" | |
mkdir -pv ${PROJECT}/nltk | |
python3 -W ignore::RuntimeWarning -m nltk.downloader -d "${PROJECT}/nltk" snowball_data | |
python3 -W ignore::RuntimeWarning -m nltk.downloader -d "${PROJECT}/nltk" stopwords | |
python3 -W ignore::RuntimeWarning -m nltk.downloader -d "${PROJECT}/nltk" punkt | |
python3 -W ignore::RuntimeWarning -m nltk.downloader -d "${PROJECT}/nltk" punkt_tab | |
popd | |
} | |
pushd "${BUILD_DIR}" | |
B_PAPERLESS | |
popd | |
} |