Newer
Older
# Get certificate
function_check create_site_certificate
increment_app_install_progress
increment_app_install_progress
increment_app_install_progress
increment_app_install_progress
set_completion_param "pleroma domain" "$PLEROMA_DOMAIN_NAME"
# We need to set up the url option again because it somehow gets
# lost during mix compile
sed -i 's|watchers: \[\]|watchers: \[\],|g' $pleroma_secret
fi
if ! grep -q 'url:' $pleroma_secret; then
if [[ $ONION_ONLY == 'no' ]]; then
sed -i "/watchers: /a url: [host: \"$PLEROMA_DOMAIN_NAME\", scheme: \"https\", port: 443]" $pleroma_secret
sed -i "/watchers: /a url: [host: \"$PLEROMA_ONION_HOSTNAME\", scheme: \"http\", port: 80]" $pleroma_secret
increment_app_install_progress
increment_app_install_progress
{ echo '[Unit]';
echo 'Description=Pleroma social network';
echo 'After=network.target postgresql.service';
echo '';
echo '[Service]';
echo 'User=pleroma';
echo "WorkingDirectory=$PLEROMA_DIR";
echo "Environment=\"HOME=$PLEROMA_DIR\"";
echo "ExecReload=/bin/kill \$MAINPID";
echo 'KillMode=process';
echo 'Restart=on-failure';
echo 'PrivateTmp=true';
echo 'PrivateDevices=false';
echo 'NoNewPrivileges=true';
echo 'CapabilityBoundingSet=~CAP_SYS_ADMIN';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target';
echo 'Alias=pleroma.service'; } > /etc/systemd/system/pleroma.service
sed -i 's|config :pleroma, :media_proxy.*|config :pleroma, :media_proxy, enabled: false|g' $PLEROMA_DIR/config/config.exs
sed -i 's|redirect_on_failure:.*|redirect_on_failure: false|g' $PLEROMA_DIR/config/config.exs
sed -i 's|:chat, enabled:.*|:chat, enabled: false|g' $PLEROMA_DIR/config/config.exs
if ! grep -q '9050' $pleroma_secret; then
sed -i '/url:/a config :pleroma, :http, proxy_url: {:socks5, :localhost, 9050}' $pleroma_secret
fi
sed -i 's|config :pleroma, :http, proxy_url:|# config :pleroma, :http, proxy_url:|g' $PLEROMA_DIR/config/config.exs
# set registrations closed initially
sed -i 's|registrations_open:.*|registrations_open: false,|g' $PLEROMA_DIR/config/config.exs
sed -i 's|registrationOpen:.*|registrationOpen: false,|g' $pleroma_secret
sed -i 's|"registrationOpen":.*|"registrationOpen": false,|g' $PLEROMA_DIR/priv/static/static/config.json
sed -i 's|"chatDisabled":.*|"chatDisabled": true,|g' $PLEROMA_DIR/priv/static/static/config.json
increment_app_install_progress
# Handle inconsistent location of mix command
if [ ! -f /usr/bin/mix ]; then
if [ -f /usr/local/bin/mix ]; then
if grep -q '/usr/bin/mix' /etc/systemd/system/pleroma.service; then
sed -i 's|/usr/bin/mix|/usr/local/bin/mix|g' /etc/systemd/system/pleroma.service
fi
fi
fi
systemctl daemon-reload
systemctl enable pleroma
systemctl start pleroma
increment_app_install_progress
cd $PLEROMA_DIR || exit 19
echo 'y' | sudo -u pleroma mix pleroma.user new "$MY_USERNAME" "$MY_EMAIL_ADDRESS" --bio $"Your bio goes here" --password "$PLEROMA_ADMIN_PASSWORD"
increment_app_install_progress
sudo -u pleroma mix set_moderator "$MY_USERNAME" true
increment_app_install_progress
APP_INSTALLED=1
}
# NOTE: deliberately there is no "exit 0"