From fef3b0019312b56711165ae0a6d10b123b0e141c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iwan=20Cl=C3=A9ment?= Date: Sun, 6 May 2018 19:35:07 +0200 Subject: [PATCH] =?UTF-8?q?Avancement=20dans=20la=20r=C3=A9daction=20des?= =?UTF-8?q?=20scripts=20d'installation=20de=20Mastodon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sh => Install-Mastodon-CreatePSQL-User.sh} | 0 files/Install-Mastodon-Phase2.sh | 29 +++++++++++++++---- files/Install-Mastodon-Phase3.sh | 5 ++++ 3 files changed, 29 insertions(+), 5 deletions(-) rename files/{Install-Mastodon-CratePSQL-User.sh => Install-Mastodon-CreatePSQL-User.sh} (100%) diff --git a/files/Install-Mastodon-CratePSQL-User.sh b/files/Install-Mastodon-CreatePSQL-User.sh similarity index 100% rename from files/Install-Mastodon-CratePSQL-User.sh rename to files/Install-Mastodon-CreatePSQL-User.sh diff --git a/files/Install-Mastodon-Phase2.sh b/files/Install-Mastodon-Phase2.sh index 148c738..cbf532f 100644 --- a/files/Install-Mastodon-Phase2.sh +++ b/files/Install-Mastodon-Phase2.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -x # Check if it is a Ubuntu host /usr/bin/lsb_release -d|cut -d ":" -f 2|grep -i ubuntu|grep "16.04" 1>/dev/null @@ -9,14 +10,32 @@ else exit 1 fi -apt-get install -y redis-server redis-tools postgresql postgresql-contrib || exit 2 +if true; then + apt-get install -y redis-server redis-tools postgresql postgresql-contrib || exit 2 +fi + +if true; then + adduser --disabled-password --disabled-login --gecos "" mastodon || exit 3 + cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 4 + chown -R mastodon /home/mastodon || exit 5 + chmod +x /home/mastodon/Install*.sh + if [ -e ./Install-Mastodon-CreatePSQL-User.sh ] + then + # Creation de l'utilisateur Postgresql postgres + su - postgres -C ./Install-Mastodon-CreatePSQL-User.sh || exit 6 + else + exit 7 + fi +fi + sed -i '/^local.*postgres.*peer$/a host all all 127.0.0.1/32 ident' /etc/postgresql/9.?/main/pg_hba.conf || exit 3 apt-get -y install pidentd && sudo systemctl enable pidentd && sudo systemctl start pidentd || exit 4 systemctl restart postgresql || exit 5 apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev || exit 6 apt-get install -y libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev || exit 7 apt-get install -y libgdbm3 libgdbm-dev || exit 8 -adduser -m --disabled-password --disabled-login mastodon || exit 9 -cp Install-Mastodon-Phase3.sh /home/mastodon -chown -R mastodon:mastodon /home/mastodon -su - mastodon -C Install-Mastodon-Phase3.sh + +cp Install-Mastodon-Phase3.sh Install-Mastodon-Phase4.sh /home/mastodon || exit 10 +chown -R mastodon:mastodon /home/mastodon || exit 11 +su - mastodon -C Install-Mastodon-Phase3.sh || exit 12 +su - mastodon -C Install-Mastodon-Phase4.sh || exit 13 diff --git a/files/Install-Mastodon-Phase3.sh b/files/Install-Mastodon-Phase3.sh index e69de29..d1a0ce6 100644 --- a/files/Install-Mastodon-Phase3.sh +++ b/files/Install-Mastodon-Phase3.sh @@ -0,0 +1,5 @@ +git clone https://github.com/rbenv/rbenv.git ~/.rbenv +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc +echo 'eval "$(rbenv init -)"' >> ~/.bashrc +source ~/.bashrc +exit