www-apps/netbox: Migration handling

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr
This commit is contained in:
Alarig Le Lay 2021-05-27 14:14:55 +02:00
parent 088f916370
commit b0591fd64e
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -92,7 +92,7 @@ src_install() {
dodir /opt
cp -a ../${P} "${ED}"/opt
dosym ${P} /opt/netbox
dosym ../../etc/netbox/gunicorn_config.py /opt/netbox/gunicorn_config.py
dosym ../../etc/netbox/gunicorn_config.py /opt/netbox/gunicorn_config.py
dosym ../../../../etc/netbox/configuration.py \
/opt/netbox/netbox/netbox/configuration.py
dodir /etc/netbox
@ -118,4 +118,24 @@ pkg_postinst() {
ewarn "Please adjust your system."
fi
done
LAST_PREVIOUS_VERSION="${REPLACING_VERSIONS[-1]}"
LAST_BASE_DIRECTORY="/opt/netbox-${LAST_PREVIOUS_VERSION}"
NBCP="su -l ${PN} -c cp"
if [ -f "${LAST_BASE_DIRECTORY}/local_requirements.txt}" ]; then
${NBCP} "${LAST_BASE_DIRECTORY}/local_requirements.txt}" /opt/netbox
fi
if [ -f "${LAST_BASE_DIRECTORY}/netbox/netbox/ldap_config.py" ]; then
${NBCP} "${LAST_BASE_DIRECTORY}/netbox/netbox/ldap_config.py" /opt/netbox/netbox/netbox/
fi
if [ -d "${LAST_BASE_DIRECTORY}/netbox/media" ]; then
${NBCP} -pr "${LAST_BASE_DIRECTORY}/netbox/media" /opt/netbox/netbox/
fi
if [ -d "${LAST_BASE_DIRECTORY}/netbox/scripts" ]; then
${NBCP} -pr "${LAST_BASE_DIRECTORY}/netbox/scripts" /opt/netbox/netbox/
fi
if [ -d "${LAST_BASE_DIRECTORY}/netbox/reports" ]; then
${NBCP} -pr "${LAST_BASE_DIRECTORY}/netbox/reports" /opt/netbox/netbox/
fi
cd /opt/netbox && su -l "${PN}" -c ./upgrade.sh
}