diff options
| author | magikcypress <cyp@rouquin.me> | 2017-04-30 03:00:02 +0200 |
|---|---|---|
| committer | magikcypress <cyp@rouquin.me> | 2017-04-30 03:00:14 +0200 |
| commit | 6bd9e8e2220aeb0fed654240b72745ebca341d1e (patch) | |
| tree | 00fa86c492c5f6826338e44f287e6667efe34843 | |
| parent | 7a56608ac7a4249814713d1e684b26449ac9e110 (diff) | |
| download | mastodon_ynh-6bd9e8e2220aeb0fed654240b72745ebca341d1e.tar.gz mastodon_ynh-6bd9e8e2220aeb0fed654240b72745ebca341d1e.tar.bz2 mastodon_ynh-6bd9e8e2220aeb0fed654240b72745ebca341d1e.zip | |
[enh] Create user & administrator after install
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | manifest.json | 4 | ||||
| -rw-r--r-- | scripts/install | 18 |
3 files changed, 27 insertions, 2 deletions
@@ -78,3 +78,10 @@ After installation, you can create an account manually on Mastodon from your bro You can't install Mastodon in subdirectory, you must use a domain or subdomain for this application. It seems important to close the inscriptions for your Mastodon, so that it remains a private body. We invite you to block remote malicious instances from the administration interface. You can also add text on your home page. + +## TODO + +- [x] Fix upgrade +- [x] [Create automatic user](https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Administration-guide.md#creating-users-while-registration-is-closed) +- [ ] Fix restore +- [ ] Install from a release
\ No newline at end of file diff --git a/manifest.json b/manifest.json index c8d1a89..8b93539 100644 --- a/manifest.json +++ b/manifest.json @@ -44,8 +44,8 @@ "name": "passwd", "type": "password", "ask": { - "en": "Enter password of this administrator", - "fr": "Ajouter le mot de passe pour cette administrateur" + "en": "Enter password of this administrator ≥ 8 character", + "fr": "Ajouter le mot de passe pour cette administrateur ≥ 8 charactères" }, "example": "adminpassword" }, diff --git a/scripts/install b/scripts/install index 5d1e75e..f5522df 100644 --- a/scripts/install +++ b/scripts/install @@ -33,6 +33,9 @@ ynh_app_setting_set $app admin $admin_mastodon ynh_app_setting_set $app pass $admin_pass ynh_app_setting_set $app language $language +[[ ${#admin_pass} -gt 8 ]] || ynh_die \ +"The password is too weak, it must be longer than 8 characters" + # Create user unix sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login @@ -178,6 +181,21 @@ sudo yunohost service add mastodon-web sudo yunohost service add mastodon-sidekiq sudo yunohost service add mastodon-streaming +# Create user +sudo su - $app <<UCOMMANDS +pushd ~/live +RAILS_ENV=production bundle exec rails c +account = Account.create!(username: '$admin_mastodon') +user = User.create!(email: '$admin_mastodon@$domain', password: '$admin_pass', account: account) +UCOMMANDS + +# Create administrator & confirm user +sudo su - $app <<ACOMMANDS +pushd ~/live +RAILS_ENV=production bin/bundle exec rails mastodon:make_admin USERNAME=$admin_mastodon +RAILS_ENV=production bin/bundle exec rails mastodon:confirm_email USER_EMAIL=$admin_mastodon@$domain +ACOMMANDS + # Copy nginx config sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf |
