diff options
| author | nemsia <nemsia@nemsia.org> | 2017-04-30 13:59:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-30 13:59:58 +0200 |
| commit | 4aa9a1d170740b46e8b60b89dc75afd69f0ce414 (patch) | |
| tree | 44a443643dde37d4283cda167e8b29c0ec29f322 | |
| parent | 40873edbd078c2750d35ee19e5e30e89fbfbfc88 (diff) | |
| parent | e1bf40f646d5ac7ba0e540f5110c29a79a07119d (diff) | |
| download | mastodon_ynh-4aa9a1d170740b46e8b60b89dc75afd69f0ce414.tar.gz mastodon_ynh-4aa9a1d170740b46e8b60b89dc75afd69f0ce414.tar.bz2 mastodon_ynh-4aa9a1d170740b46e8b60b89dc75afd69f0ce414.zip | |
Merge pull request #8 from YunoHost-Apps/master
[enh] Create admin on install
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | manifest.json | 4 | ||||
| -rw-r--r-- | scripts/install | 18 | ||||
| -rw-r--r-- | sources/source_dir | 1 | ||||
| -rw-r--r-- | sources/source_md5 | 1 | ||||
| -rw-r--r-- | sources/source_url | 1 |
6 files changed, 27 insertions, 5 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 ba8d7c0..806fec2 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 @@ -182,6 +185,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 diff --git a/sources/source_dir b/sources/source_dir deleted file mode 100644 index e582ada..0000000 --- a/sources/source_dir +++ /dev/null @@ -1 +0,0 @@ -mastodon-1.1.2
\ No newline at end of file diff --git a/sources/source_md5 b/sources/source_md5 deleted file mode 100644 index bd6d5ab..0000000 --- a/sources/source_md5 +++ /dev/null @@ -1 +0,0 @@ -c10055d4250e51eaaf16c78a50390839 mastodon-1.1.2.zip
\ No newline at end of file diff --git a/sources/source_url b/sources/source_url deleted file mode 100644 index 7638312..0000000 --- a/sources/source_url +++ /dev/null @@ -1 +0,0 @@ -https://github.com/tootsuite/mastodon/archive/v1.1.2.zip
\ No newline at end of file |
