www-apps/misskey: Fix pkg_{preinst,postinst,config}

Signed-off-by: tastytea <tastytea@tastytea.de>
This commit is contained in:
tastytea 2022-05-21 18:37:32 +02:00
parent 731b23d81c
commit eca5e011d4
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -96,18 +96,27 @@ src_install() {
} }
pkg_preinst() { pkg_preinst() {
pushd "${EROOT}"/opt/misskey/misskey || die # Clean up changes that were made after installation
ebegin "Cleaning ${EROOT}/opt/misskey/misskey" if [[ -d "${EROOT}"/opt/misskey/misskey ]]; then
yarn cleanall || die cd "${EROOT}"/opt/misskey/misskey || die
eend
ebegin "Running 'yarn cleanall' in ${EROOT}/opt/misskey/misskey"
su -s /bin/bash -c "yarn cleanall" misskey
eend ${?}
ebegin "Removing ${EROOT}/opt/misskey/misskey/{built,node_modules,packages}" ebegin "Removing ${EROOT}/opt/misskey/misskey/{built,node_modules,packages}"
rm -rf {built,node_modules,packages} || die rm -rf {built,node_modules,packages} || die
eend eend ${?}
fi
} }
pkg_postinst() { pkg_postinst() {
elog "Run emerge --config ${CATEGORY}/${PN} to initialise the PostgreSQL database" elog "Run emerge --config ${CATEGORY}/${PN} to initialise the PostgreSQL database"
elog "Run 'su -c \"yarn migrate\" misskey' in ${EROOT}/opt/misskey/misskey and restart the service to apply changes"
ebegin "Running 'yarn migrate'"
cd "${EROOT}"/opt/misskey/misskey || die
su -s /bin/bash -c "yarn migrate" misskey
eend ${?}
if use nginx; then if use nginx; then
einfo "An nginx example config can be found at <https://misskey-hub.net/en/docs/admin/nginx.html>" einfo "An nginx example config can be found at <https://misskey-hub.net/en/docs/admin/nginx.html>"
@ -123,8 +132,8 @@ pkg_config() {
echo "create database misskey; create user misskey with encrypted password '${MY_PASSWORD}'; grant all privileges on database misskey to misskey; \q" \ echo "create database misskey; create user misskey with encrypted password '${MY_PASSWORD}'; grant all privileges on database misskey to misskey; \q" \
| su -lc psql postgres || die "database creation failed" | su -lc psql postgres || die "database creation failed"
cd "${EROOT}/opt/misskey/misskey" cd "${EROOT}"/opt/misskey/misskey || die
yarn run init || die "database initialisation failed" su -s /bin/bash -c "yarn run init" misskey || die "database initialisation failed"
ewarn "When you first start Misskey you will be asked to add an admin account via the web interface, and registrations are enabled." ewarn "When you first start Misskey you will be asked to add an admin account via the web interface, and registrations are enabled."
ewarn "Do not expose the web interface to the public until after you configured your instance\!" ewarn "Do not expose the web interface to the public until after you configured your instance\!"