__netbox: set --data-root default value

The default value is set to preserve all data saved by netbox. As
explained in the manpage, it sets the directory for all data directories
to `~netbox/data/` (would resolve to `/opt/netbox/data/`), so upgrades
will not remove this data.
This commit is contained in:
matze 2020-10-04 17:40:01 +02:00
parent 050812305b
commit 14f7cf8839
3 changed files with 16 additions and 13 deletions

View File

@ -131,7 +131,7 @@ data-root
This parameter set's the media, reports and scripts root to subdirectories
of the given directory. Values can be overwritten by special parameters like
`--media-root` for example. Use this option if you want to store persistant
data of netbox on an other partition. A trailing shlash is not needed.
data of netbox on an other partition. A trailing slash is not needed.
The data directories have following predefined sub-directory names:
@ -142,23 +142,26 @@ data-root
scripts root:
``$data_root/scripts``
To preserve all data from installation upgrades - which just replace the
installation directory - the data will be kept in the netbox home directory
rather than the installation directory by default (``/opt/netbox/data/``).
This way, no data will be deleted after the installation directory
replacement because it remains outside of the installation directory.
media-root
The file path to where media files (like image attachments) are stored.
Change this path if you require to store data on an other partiotion.
A trailing slash is not needed. By default, it will be stored into the
installation directory (``/opt/netbox/netbox/netbox/media``).
A trailing slash is not needed. Defaults to ``$data_root/media``.
reports-root
The file path of where custom reports are kept. Change this path if you
require to store data on an other partition. A trailing slash is not
needed. By default, it will be stored into the installation directory
(``/opt/netbox/netbox/netbox/reports``).
needed. Defaults to ``$data_root/reports``.
scripts-root
The file path of where custom scripts are kept. Change this path if you
require to store data on an other partition. A trailing slash is not
needed. By default, it will be stored into the installation directory
(``/opt/netbox/netbox/netbox/scripts``).
needed. Defaults to ``$data_root/scripts``.
BOOLEAN PARAMETERS

View File

@ -161,12 +161,11 @@ else
fi
export LOGIN_REQUIRED
if [ -f "$__object/parameter/data-root" ]; then
data_root="$(cat "$__object/parameter/data-root")"
MEDIA_ROOT="$data_root/media"
REPORTS_ROOT="$data_root/reports"
SCRIPTS_ROOT="$data_root/scripts"
fi
data_root="$(cat "$__object/parameter/data-root")"
MEDIA_ROOT="$data_root/media"
REPORTS_ROOT="$data_root/reports"
SCRIPTS_ROOT="$data_root/scripts"
if [ -f "$__object/parameter/media-root" ]; then
MEDIA_ROOT="$(cat "$__object/parameter/media-root")"
fi

View File

@ -0,0 +1 @@
/opt/netbox/data