From 14baf1f98438e4683f38f6239843ebdd0e6e5d99 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 23 Feb 2019 07:33:15 +0100 Subject: [PATCH] www-apps/pleroma-installer: Version bump: 5 Package-Manager: Portage-2.3.51, Repoman-2.3.11 Manifest-Sign-Key: 3555266864CA6D7FF45AA6E7CFC39497F1B26E07 --- www-apps/pleroma-installer/Manifest | 11 ++- .../files/install_pleroma-r1.sh | 44 +++++++++ .../files/upgrade_pleroma-r1.sh | 34 +++++++ .../pleroma-installer-5.ebuild | 92 +++++++++++++++++++ 4 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 www-apps/pleroma-installer/files/install_pleroma-r1.sh create mode 100644 www-apps/pleroma-installer/files/upgrade_pleroma-r1.sh create mode 100644 www-apps/pleroma-installer/pleroma-installer-5.ebuild diff --git a/www-apps/pleroma-installer/Manifest b/www-apps/pleroma-installer/Manifest index 2d2782e..ef4813f 100644 --- a/www-apps/pleroma-installer/Manifest +++ b/www-apps/pleroma-installer/Manifest @@ -1,14 +1,17 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 +AUX install_pleroma-r1.sh 1361 BLAKE2B d6bf84e9c84a7953fdd9d5b5ebcb0834aeecfbee6c7338d5ed013ca9e1f07571a083d55756933cb8fde990cd421cf8e22605bfc21ff33113502ffe1019fbc0b2 SHA512 7596a017c60b8a4da54c698806927660cb71df15e50650597df6ef78ad5d0c70b6ec303920ac49999178f049083a5d219a486a7279ef31d525d53f808d8c072a AUX install_pleroma.sh 1297 BLAKE2B efa93ff38d80202fcfe716a6fd4d3fc85882747acedd582fcafa03eafd6bf4d870f521525430c6c688fc13ae39da89ad8f3bc12c50a96b0e5e91e4cd5c5cb193 SHA512 a33fd3da78bd5c0db8e2dd92a8d7640b5bfab90b485d4d47f678b4ce1c86b92995c741a5aa9ab82dec4538469dc30d7cf6755691103a27057b3afabb2f42e1f2 +AUX upgrade_pleroma-r1.sh 839 BLAKE2B e366956c1ed4d1ac1b7d1a8b8b51b43adbc19f9c010916314cb81c6ee616d3568c1553e9fb31b1f90e2ddd76904dfb9cc866fd9714a2ac5bf227e45edbab4c45 SHA512 748a6f24d000247f586af020cbb692d5d6eed371e2b2960f11a6f122f1cff67d487612b7ad5be00dfb31f88fab23015945b159ac718d4775ef274f76a7fdbc20 AUX upgrade_pleroma.sh 791 BLAKE2B 3123e3bcc06bab422a554eeb9c5da6b100107125d16e9a661c90b1c09d1f4b8fd5cbdc743ed521db0ba7593a4967bd384695834d1951fa84ca2dd802773e31c1 SHA512 d08ffce3cfeba971022c0e1f9a08daffc10e60fa8d7920d99a840bbe7744d487d064e9d641f57ff89db77ba9c5fe0fd51999cce112ef7e8a2c1a5bf5a8c021ad EBUILD pleroma-installer-4.ebuild 2614 BLAKE2B 429cc8e36e763aed3349b9d2496387cb503a6aba0d108fcf72a8eb50ebb5272fa5c5bf4bb0ef3144c85fc5e1792397f53a8fe427444ee99b65286a897c0a2a47 SHA512 251a8a4851cff0e565ab14b5c6999fe0208115e3337f04b550acc4dc61d9113e9182002c4fcb3103a91bb183818ea97a9601988c190b4b64d303ca75344b4609 +EBUILD pleroma-installer-5.ebuild 2567 BLAKE2B f3768a19e70602a8945440685ffeb0fb20f6c9d2f60db2bea5e0a141c28d9d56432d07b15c25402b12385bd1e20b4329647c936b4659afa3182b94f82121c634 SHA512 935e548e224e9480f48e378a37c8a6b6e42ec234720c0846d8f89e09c0d19db80a1ebbe2991237f8fe4ba696c5941e8b9ea802fef4fdc831d156b7ec3ab2ca1f MISC metadata.xml 993 BLAKE2B adc5c72fe12b6fdb4eb20c1d79dde227b088b437ffd21d16cc5775fa5bb7fa6363890dd5017fbe7f5a00a794a38fb298ce17e6402f6d3d5441985effd0d7e1db SHA512 6ff23fa60c0f22ef7a433e3d1b4919d074508898504b7168c925da8840f542afcdc891a9f4df69dc8eb6c44b7d9c41e6b94fdecd404ca738169124bcdab0af0d -----BEGIN PGP SIGNATURE----- -iHUEAREIAB0WIQQ1VSZoZMptf/RapufPw5SX8bJuBwUCXHCMQAAKCRDPw5SX8bJu -B2G8AP0VieOVvfcF3Hzq7skQxsdtgrdB+pn0yZuBvFjq6EotMQEAi73fOjspbeoH -B+x73A8BrNRG2AUFfuvL5dk/ihPZrWA= -=Et+k +iHUEAREIAB0WIQQ1VSZoZMptf/RapufPw5SX8bJuBwUCXHDpKwAKCRDPw5SX8bJu +B5JCAP9pyrJiIi5ouTLlO5829LJG3M11ixzjxMAQR4X1uwJsiAD+PJqznGYtG0eB +yH/WmsSpOxXKPX9HPwvDYCux8kZqSg4= +=GNXn -----END PGP SIGNATURE----- diff --git a/www-apps/pleroma-installer/files/install_pleroma-r1.sh b/www-apps/pleroma-installer/files/install_pleroma-r1.sh new file mode 100644 index 0000000..6099d79 --- /dev/null +++ b/www-apps/pleroma-installer/files/install_pleroma-r1.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +echo "This script is only suitable for the initial installation, not for upgrades." +echo "Make sure postgresql is configured and running." +echo "Hit enter to proceed." +read sure +if [ -n "${sure}" ]; then + exit +fi + +purple='\033[1;35m' +nocolor='\033[0m' + +function die() +{ + if [ -n "${1}" ]; then + echo "${1}" >&2 + fi + exit 1 +} + +echo -e "${purple}Cloning pleroma into current dir...${nocolor}" +sudo -u pleroma git clone https://git.pleroma.social/pleroma/pleroma.git || die +mv pleroma/{*,.[a-zA-Z0-9]*} . || die +rmdir pleroma || die + +echo -e "${purple}Installing the dependencies for pleroma..." +echo -e "Answer with yes if it asks you to install Hex.${nocolor}" +sudo -u pleroma mix deps.get || die + +echo -e "${purple}Generating the configuration..." +echo -e "Answer with yes if it asks you to install rebar3.${nocolor}" +sudo -u pleroma mix pleroma.instance gen || die +mv -v config/{generated_config.exs,prod.secret.exs} || die + +echo -e "${purple}Creating the database...${nocolor}" +sudo -u postgres psql -f config/setup_db.psql || die + +echo -e "${purple}Running the database migration...${nocolor}" +sudo -u pleroma MIX_ENV=prod mix ecto.migrate || die + +echo -en "\n${purple}Done! You can now start pleroma with${nocolor} " +echo "/etc/init.d/pleroma start" +echo "{purple}The configuration file is in${nocolor} config/prod.secret.exs" diff --git a/www-apps/pleroma-installer/files/upgrade_pleroma-r1.sh b/www-apps/pleroma-installer/files/upgrade_pleroma-r1.sh new file mode 100644 index 0000000..fb2abcb --- /dev/null +++ b/www-apps/pleroma-installer/files/upgrade_pleroma-r1.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +echo "This script will upgrade your pleroma installation." +echo "Pleroma will be stopped for the duration of the update." +echo "Hit enter to proceed." +read sure +if [ -n "${sure}" ]; then + exit +fi + +purple='\033[1;35m' +nocolor='\033[0m' + +function die() +{ + if [ -n "${1}" ]; then + echo "${1}" >&2 + fi + exit 1 +} + +echo -e "${purple}Stopping pleroma...${nocolor}" +sudo /etc/init.d/pleroma stop || die + +echo -e "${purple}Pulling the latest changes from upstream...${nocolor}" +sudo -u pleroma git pull || die +echo -e "${purple}Upgrading dependencies...${nocolor}" +sudo -u pleroma mix deps.get || die + +echo -e "${purple}Performing database migrations...${nocolor}" +sudo -u pleroma MIX_ENV=prod mix ecto.migrate || die + +echo -e "\n${purple}Done! Restarting pleroma...${nocolor}" +sudo /etc/init.d/pleroma restart || die diff --git a/www-apps/pleroma-installer/pleroma-installer-5.ebuild b/www-apps/pleroma-installer/pleroma-installer-5.ebuild new file mode 100644 index 0000000..f29c0ae --- /dev/null +++ b/www-apps/pleroma-installer/pleroma-installer-5.ebuild @@ -0,0 +1,92 @@ +# 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" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="" +IUSE="apache +nginx syslog systemd" + +RDEPEND=" + >=dev-lang/elixir-1.6.6 + dev-vcs/git + >=dev-db/postgresql-9.6.11[uuid] + app-admin/sudo + apache? ( www-servers/apache ) + nginx? ( www-servers/nginx ) +" +DEPEND="" + +pkg_preinst() { + ewarn "This ebuild installs an installation script for the development-branch of Pleroma." + ewarn "If you want a stabler version, install www-apps/pleroma." + ewarn "Beginning with 2019-02-10, the Pleroma init scripts expect the installation in ${EPREFIX}/opt/pleroma." + ewarn "If it is in ${EPREFIX}/var/lib/pleroma, this ebuild will fail. Move it now and remerge." +} + +pkg_setup() { + enewgroup pleroma + enewuser pleroma -1 -1 /opt/pleroma pleroma +} + +src_prepare() { + default + + sed -i 's|directory=~pleroma/pleroma|directory=~pleroma|' \ + "${S}/installation/init.d/pleroma" || die + + if use syslog; then + # Log to syslog + sed -i 's/command_background=1/command_background=1\nerror_logger="logger"\noutput_logger="logger"/' \ + installation/init.d/pleroma || die + fi + + if use systemd; then + sed -i 's|/etc/init.d/pleroma stop|systemctl stop pleroma|' "${FILESDIR}/upgrade_pleroma.sh" || die + sed -i 's|/etc/init.d/pleroma restart|systemctl restart pleroma|' "${FILESDIR}/upgrade_pleroma.sh" || die + fi +} + +src_install() { + local pleromadir="${EPREFIX}/opt/pleroma" + diropts -o pleroma -g pleroma + exeopts -o pleroma -g pleroma + + dodir "${pleromadir}" + exeinto "${pleromadir}" + newexe "${FILESDIR}/install_pleroma-r1.sh" install_pleroma.sh + newexe "${FILESDIR}/upgrade_pleroma-r1.sh" upgrade_pleroma.sh + + if use nginx; then + dodoc installation/pleroma.nginx + fi + if use apache; then + dodoc installation/pleroma-apache.conf + fi + + dodoc docs/* + + if use systemd; then + systemd_dounit installation/pleroma.service + else + doinitd installation/init.d/pleroma + fi +} + +pkg_postinst() { + elog "For the initial installation, cd to ${EPREFIX}/opt/pleroma and run ./install_pleroma.sh." + elog "To upgrade, run ./upgrade_pleroma.sh." + 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 +}