overlay/www-apps/pleroma-installer/files/install_pleroma.sh
tastytea 487cf108a2
www-apps/pleroma-installer: Added git as dependency
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Manifest-Sign-Key: 3555266864CA6D7FF45AA6E7CFC39497F1B26E07
2019-02-13 04:59:13 +01:00

45 lines
1.3 KiB
Bash

#!/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}"
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}"
mix deps.get || die
echo -e "${purple}Generating the configuration..."
echo -e "Answer with yes if it asks you to install rebar3.${nocolor}"
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}"
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"