Add superuser management script

This commit is contained in:
Chris Nagy
2021-03-14 19:43:22 +01:00
parent e4909c3133
commit e3ba968fef
3 changed files with 45 additions and 1 deletions

View File

@@ -49,6 +49,19 @@ wait_for_postgres() {
}
superuser() {
if [[ -n "${PAPERLESS_DBHOST}" ]]
then
wait_for_postgres
fi
if [[ ! -z "${PAPERLESS_ADMIN_PASSWORD}" ]]
then
sudo -HEu paperless python3 manage.py manage_superuser
fi
}
migrations() {
@@ -86,6 +99,7 @@ initialize() {
chown -R paperless:paperless /tmp/paperless
migrations
superuser
}

View File

@@ -1,4 +1,4 @@
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;
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..."
sed "s/management_command/$command/g" management_script.sh > /usr/local/bin/$command