diff --git a/conf/yarn.list b/conf/yarn.list new file mode 100644 index 0000000..842ebb9 --- /dev/null +++ b/conf/yarn.list @@ -0,0 +1 @@ +deb https://dl.yarnpkg.com/debian/ stable main \ No newline at end of file diff --git a/scripts/.fonctions b/scripts/.fonctions index 902d62c..8abb720 100644 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -89,6 +89,27 @@ FIND_PORT () { # Search free port CHECK_VAR "$port" "port empty" } +SETUP_SOURCE () { # Download source, decompress and copu into $final_path + src=$(cat ../sources/source_md5 | awk -F' ' {'print $2'}) + sudo wget -nv -i ../sources/source_url -O $src + # Checks the checksum of the downloaded source. + # md5sum -c ../sources/source_md5 --status || ynh_die "Corrupt source" + # Decompress source + if [ "$(echo ${src##*.})" == "tgz" ]; then + tar -x -f $src + elif [ "$(echo ${src##*.})" == "zip" ]; then + unzip -q $src + else + false # Unsupported archive format. + fi + # Copy file source + sudo cp -a $(cat ../sources/source_dir)/. "$final_path/live" + # Copy additional file and modified + if test -e "../sources/ajouts"; then + sudo cp -a ../sources/ajouts/. "$final_path" + fi +} + ### REMOVE SCRIPT @@ -182,6 +203,15 @@ ynh_psql_create_db() { } +# Drop a role +# +# usage: ynh_mysql_drop_role db +# | arg: db - the database name to drop +ynh_psql_drop_role() { + sudo su -c "psql" postgres <<< \ + "DROP ROLE ${1};" +} + # Drop a database # # usage: ynh_mysql_drop_db db diff --git a/scripts/install b/scripts/install index 0a5d1bb..dba714e 100644 --- a/scripts/install +++ b/scripts/install @@ -65,6 +65,7 @@ curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - sudo apt-get -y install nodejs sudo npm install -g yarn +<<<<<<< HEAD # Set UTF8 encoding by default sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='false' where datname='template1';"\ @@ -73,19 +74,34 @@ sudo su -c "psql" postgres <<< \ "update pg_database set datistemplate='true' where datname='template1';" # Create DB user mastodon +======= +# Create DB without password +sudo systemctl restart postgresql +>>>>>>> refs/remotes/magikcypress/master ynh_psql_create_db_without_password "$app" # Download all Ruby source sudo git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv sudo git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build +<<<<<<< HEAD sudo git clone https://github.com/tootsuite/mastodon.git $final_path/live +======= + +# Be king rewind (/var/cache/yunohost/from_file/scripts) +popd + +# Get Mastodon last version +sudo mkdir "${final_path}/live" +SETUP_SOURCE +>>>>>>> refs/remotes/magikcypress/master sudo chown -R $app: "${final_path}" # Install de rbenv sudo su - $app <> ~/.profile echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc echo 'eval "\$(rbenv init -)"' >> ~/.bashrc COMMANDS @@ -99,7 +115,7 @@ RCOMMANDS # Create symlink for ruby sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true -# # Install Mastodon +# Install Mastodon sudo su - $app <>>>>>> refs/remotes/magikcypress/master diff --git a/scripts/remove b/scripts/remove index 75e56ba..f4390af 100644 --- a/scripts/remove +++ b/scripts/remove @@ -60,6 +60,7 @@ fi # delete postgresql database & user ynh_psql_drop_db "${app}_production" +ynh_psql_drop_role "${app}" # Remove Debian package #sudo apt-get remove --purge -y imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file curl git diff --git a/sources/source_dir b/sources/source_dir new file mode 100644 index 0000000..bc6770c --- /dev/null +++ b/sources/source_dir @@ -0,0 +1 @@ +mastodon-1.1.1 \ No newline at end of file diff --git a/sources/source_md5 b/sources/source_md5 new file mode 100644 index 0000000..feef915 --- /dev/null +++ b/sources/source_md5 @@ -0,0 +1 @@ +4bfc3fc2ccc27cc88505cfc0dfb74cac v1.1.1.zip \ No newline at end of file diff --git a/sources/source_url b/sources/source_url new file mode 100644 index 0000000..198fec9 --- /dev/null +++ b/sources/source_url @@ -0,0 +1 @@ +https://github.com/tootsuite/mastodon/archive/v1.1.1.zip \ No newline at end of file