diff --git a/www-apps/pleroma/Manifest b/www-apps/pleroma/Manifest index 02eddaac2..6dc3d1d74 100644 --- a/www-apps/pleroma/Manifest +++ b/www-apps/pleroma/Manifest @@ -3,11 +3,12 @@ Hash: SHA256 DIST pleroma-0.9.99999.tar.bz2 29589177 BLAKE2B 6e4f6d80272a7b4fc9eb8c63d07e56e0774b094b923fbdc9dadb02114effa7d2009e21f571cac83a67ce52dc2ef31cdbeff47c5f6b443df7d8f77c0b1d86ea7b SHA512 cf6ada781556392b02ca4c61fb46a3844d5a230336f841bd48a19ed86bf7d0e5fa6af454742d7b19563e05e1dce270ac58f0c0fc13fed3de27e09001def50f4e EBUILD pleroma-0.9.99999.ebuild 4467 BLAKE2B 8a1907110f1e1361d6226bceb27607b3a2e49cd98651a0137d218ba48a00a636842b13238e70ef0dfb3773bb6057eaf8925fe238c8b8440a74cdbf0274a20562 SHA512 7d0d400225fa2bdf1aac8fb1687ee3179e643ec395bf198fcb6a7c091c8ef905b807fe80f811750097139babc02289cce33a8d999279b2c8c19119ac50fa39b6 +EBUILD pleroma-1.0.0.ebuild 3474 BLAKE2B f4abed08dcee91e57e0761e147c93035fa2f9d2d720a64ba9f641df30e950c766e0d65117dc0d8f2d4c15c1966e7d009fb0f10cde8d0b05580a3ea9ec083efe9 SHA512 028c55df606e2cc6ba90489a511bf4ee5f0cc82ed0fb1a0ce31912005d3cd1cee279fbe9e23a95f2a6bdd5ac54daceee926b61e8b1e1660c712d06937a308c90 MISC metadata.xml 993 BLAKE2B adc5c72fe12b6fdb4eb20c1d79dde227b088b437ffd21d16cc5775fa5bb7fa6363890dd5017fbe7f5a00a794a38fb298ce17e6402f6d3d5441985effd0d7e1db SHA512 6ff23fa60c0f22ef7a433e3d1b4919d074508898504b7168c925da8840f542afcdc891a9f4df69dc8eb6c44b7d9c41e6b94fdecd404ca738169124bcdab0af0d -----BEGIN PGP SIGNATURE----- -iHUEAREIAB0WIQQ1VSZoZMptf/RapufPw5SX8bJuBwUCXPFtQgAKCRDPw5SX8bJu -ByN+AP9ywWUmyTQ11Wl9LzBWBq7/lIoir5l+bhwjjrNxhJW+IwD/eesi9utlYeCL -/lJM1LMc86K2Ka76Gwd7a8DDbytkX+0= -=D90B +iHUEAREIAB0WIQQ1VSZoZMptf/RapufPw5SX8bJuBwUCXRZzvwAKCRDPw5SX8bJu +B1JrAP93ccLZvEfFlbqJyF1sj/M5YAfbGPwwVTVWhn+enNxqGAD/dLjWpcui9Seo ++9WicgdOxB/eUFHE0UjZwtUn+HGItOg= +=bb6B -----END PGP SIGNATURE----- diff --git a/www-apps/pleroma/pleroma-1.0.0.ebuild b/www-apps/pleroma/pleroma-1.0.0.ebuild new file mode 100644 index 000000000..05a14a449 --- /dev/null +++ b/www-apps/pleroma/pleroma-1.0.0.ebuild @@ -0,0 +1,124 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit git-r3 user systemd + +DESCRIPTION="Microblogging server software that can federate with other servers." +HOMEPAGE="https://pleroma.social/ https://git.pleroma.social/pleroma/pleroma/" +EGIT_REPO_URI="https://git.pleroma.social/pleroma/pleroma.git" +EGIT_COMMIT="v${PV}" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64" +IUSE="apache +nginx syslog" + +RDEPEND=" + >=dev-lang/elixir-1.8.1 + >=dev-db/postgresql-9.6.13[uuid] + apache? ( www-servers/apache ) + nginx? ( www-servers/nginx[nginx_modules_http_slice] ) +" +DEPEND="" + +pkg_preinst() { + ewarn "This ebuild will overwrite modified files in /opt/pleroma/priv/static/" +} + +pkg_setup() { + enewgroup pleroma + enewuser pleroma -1 -1 /opt/pleroma pleroma +} + +src_install() { + insinto "/opt/pleroma" + insopts -o pleroma -g pleroma -m 0664 + doins -r * .* + # insopts doesn't affect directories. + chown -R pleroma:pleroma "${ED}/opt/pleroma" + chmod -R ug=rwX "${ED}/opt/pleroma" + + if use nginx; then + dodoc installation/pleroma.nginx + fi + if use apache; then + dodoc installation/pleroma-apache.conf + fi + + dodoc -r docs/* + + doinitd installation/init.d/pleroma + systemd_dounit installation/pleroma.service +} + +pkg_postinst() { + elog "You need to run emerge --config www-apps/pleroma after each upgrade." + if use nginx; then + einfo "An example config for nginx has been installed in the doc directory." + fi + if use apache; then + einfo "An example config for apache has been installed in the doc directory." + fi +} + +pkg_config() { + local configfile="${EROOT}/opt/pleroma/config/prod.secret.exs" + cd "${EROOT}/opt/pleroma" || die + + if [[ ! -f ${configfile} ]]; then # Fresh install. + einfo "Installing the dependencies..." + einfo "Answer with yes if it asks you to install Hex." + su -ls /bin/bash -c "mix deps.get" pleroma || die + + einfo "Generating the configuration..." + einfo "Answer with yes if it asks you to install rebar3." + su -ls /bin/bash -c "mix pleroma.instance gen" pleroma || die + mv -v config/{generated_config.exs,prod.secret.exs} || die + + if use syslog; then + einfo "Activating syslog in ${configfile} ..." + echo -e "config :logger,\n backends: [{ExSyslogger, :ex_syslogger}]\n\n" \ + "config :logger, :ex_syslogger,\n level: :warn'" >> ${configfile} + fi + + einfo "Creating the database..." + su -ls /bin/bash -c "psql -f config/setup_db.psql" postgres || die + + einfo "Running the database migration..." + su -ls /bin/bash -c "MIX_ENV=prod mix ecto.migrate" pleroma || die + + einfo "Your configuration file is in ${configfile}." + else # Update. + einfo "Pleroma will be stopped for the duration of the update." + einfo "Hit enter to proceed." + read + + declare -i started=0 + if "${EROOT}"/etc/init.d/pleroma --nocolor status | grep -q started; then + started=1 + fi + + if [[ ${started} -eq 1 ]]; then + einfo "Stopping pleroma..." + "${EROOT}"/etc/init.d/pleroma stop || die + fi + + einfo "Updating the dependencies..." + su -ls /bin/bash -c "mix deps.get" pleroma || die + + einfo "Running the database migration..." + su -ls /bin/bash -c "MIX_ENV=prod mix ecto.migrate" pleroma || die + + if [[ ${started} -eq 1 ]]; then + einfo "Starting pleroma..." + "${EROOT}"/etc/init.d/pleroma start || die + fi + fi + + if ! grep -q MIX_ENV ~pleroma/.profile 2>/dev/null; then + elog "Setting MIX_ENV=prod in ~pleroma/.profile ..." + echo "export MIX_ENV=prod" >> ~pleroma/.profile || die + fi +}