summarylogtreecommitdiffstats
path: root/netbox.install
blob: 9745fd71152c6219cba5add464984ac39e682b7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
_NAME=netbox

_create_user() {
	getent passwd ${_NAME} > /dev/null || useradd -d /opt/${_NAME} -s /bin/false -r ${_NAME} > /dev/null
}

post_install() {
    _create_user

	# Create a directory in /run if it does not exist
	if [ ! -d /run/${_NAME} ]; then
		mkdir /run/${_NAME}
		chown ${_NAME}. /run/${_NAME}
		chmod 775 /run/${_NAME}
	fi

    echo ""
    echo -e "Follow the instructions on http://netbox.readthedocs.io/en/latest/installation/netbox/"
    echo -e "to finish the configuration, and enable and start the systemd "
    echo -e "service: "
    echo "    systemctl enable --now netbox.service"
    echo ""
    echo -e "Tweak the netbox and gunicorn configuration in "
    echo "/etc/netbox/configuration.py and /etc/netbox/gunicorn_config.py"
    echo ""
}

post_upgrade() {
    _create_user

    echo ""
    echo "To end the migration, use the following commands:"
    echo "    /opt/netbox/manage.py migrate"
    echo "    /opt/netbox/manage.py collectstatic --noinput"
    echo ""
}

post_remove() {
	userdel -f ${_NAME}
}