1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flarum_ynh.git synced 2024-09-03 18:36:24 +02:00

Merge pull request #84 from ABLD/master

I tried something to integrate bazaar extension.
This commit is contained in:
Titus PiJean 2018-08-17 12:49:51 +02:00 committed by GitHub
commit deb373cb11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 97 deletions

View file

@ -24,6 +24,7 @@ You can also install it with `yunohost app install https://github.com/YunoHost-A
- Optional parameters are : - Optional parameters are :
- `title` :warning: if you leave it empty, you will have to perform manual post-installation. - `title` :warning: if you leave it empty, you will have to perform manual post-installation.
- `language` can be English (by default), French, and German. Other languages installable after installation as any other extensions - `language` can be English (by default), French, and German. Other languages installable after installation as any other extensions
- `bazaar_extension` to install the extension marketplace (*false* by default), to avoid using the command line to add new extensions.
### Manual post-installation ### Manual post-installation
@ -36,4 +37,3 @@ You can also install it with `yunohost app install https://github.com/YunoHost-A
3. Fill in the blanks about `MySQL` as follow, put the retrieved database password. The remaining blanks are up to you. 3. Fill in the blanks about `MySQL` as follow, put the retrieved database password. The remaining blanks are up to you.
<p align="center"><img src="http://i.imgur.com/p7XmTDw.png" width="300" ></p> <p align="center"><img src="http://i.imgur.com/p7XmTDw.png" width="300" ></p>

View file

@ -1,92 +1,102 @@
{ {
"name": "Flarum", "name": "Flarum",
"id": "flarum", "id": "flarum",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Flarum (open-source forum software) package for YunoHost.", "en": "Flarum (open-source forum software) package for YunoHost.",
"fr": "Package Flarum (système de forum libre) pour YunoHost.", "fr": "Package Flarum (système de forum libre) pour YunoHost.",
"de": "Flarum (Open Source) ist ein Programmpaket für Yunohost." "de": "Flarum (Open Source) ist ein Programmpaket für Yunohost."
}, },
"url": "http://flarum.org/", "url": "http://flarum.org/",
"license": "MIT", "license": "MIT",
"version": "0.1.0-beta.7", "version": "0.1.0-beta.7",
"maintainer": { "maintainer": {
"name": "Titus PiJean", "name": "Titus PiJean",
"email": "tituspijean@outlook.com" "email": "tituspijean@outlook.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 2.4.0" "yunohost": ">= 2.4.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php5-fpm", "php5-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install": [{ "install": [{
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": { "ask": {
"en": "Choose a domain name for Flarum", "en": "Choose a domain name for Flarum",
"fr": "Choisissez un nom de domaine pour Flarum", "fr": "Choisissez un nom de domaine pour Flarum",
"de": "Wählen einen Domain-Namen für Flarum" "de": "Wählen einen Domain-Namen für Flarum"
}, },
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": { "ask": {
"en": "Choose a path for Flarum", "en": "Choose a path for Flarum",
"fr": "Choisissez un chemin pour Flarum", "fr": "Choisissez un chemin pour Flarum",
"de": "Wählen einen Pfad für Flarum" "de": "Wählen einen Pfad für Flarum"
}, },
"example": "/flarum", "example": "/flarum",
"default": "/flarum" "default": "/flarum"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
"ask": { "ask": {
"en": "Choose the admin user (required for automatic post-installation)", "en": "Choose the admin user (required for automatic post-installation)",
"fr": "Choisissez ladministrateur (nécessaire pour la post-installation automatique)", "fr": "Choisissez ladministrateur (nécessaire pour la post-installation automatique)",
"de": "Wählen einen Administrator (erforderlich für die automatische Nachinstallation)" "de": "Wählen einen Administrator (erforderlich für die automatische Nachinstallation)"
}, },
"example": "johndoe", "example": "johndoe",
"optional": true "optional": true
}, },
{ {
"name": "title", "name": "title",
"ask": { "ask": {
"en": "Choose a title for your forum (required for automatic post-installation)", "en": "Choose a title for your forum (required for automatic post-installation)",
"fr": "Choisissez un titre pour votre forum (nécessaire pour la post-installation automatique)", "fr": "Choisissez un titre pour votre forum (nécessaire pour la post-installation automatique)",
"de": "Wählen einen Titel für eure Internetforum (erforderlich für die automatische Nachinstallation)" "de": "Wählen einen Titel für eure Internetforum (erforderlich für die automatische Nachinstallation)"
}, },
"example": "My forum", "example": "My forum",
"default": "", "default": "",
"optional": true "optional": true
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Is it a public application?", "en": "Is it a public application?",
"fr": "Est-ce une application publique ?", "fr": "Est-ce une application publique ?",
"de": "Ist es eine öffentliche Applikation ?" "de": "Ist es eine öffentliche Applikation ?"
}, },
"default": true "default": true
}, },
{ {
"name": "language", "name": "bazaar_extension",
"ask": { "type": "boolean",
"en": "Choose the application language", "ask": {
"fr": "Choisissez la langue de l'application", "en": "Do you want to install Bazaar extension, extensions provider for Flarum?",
"de": "Wählen Sie eine Sprache" "fr": "Voulez-vous installer l'extension Bazaar, fournisseur d'extensions pour Flarum ?",
}, "de": "Wollen Sie die Bazaar Erweiterung installieren ?"
"choices": ["fr", "en", "de"], },
"default": "en" "default": false
} },
] {
} "name": "language",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application",
"de": "Wählen Sie eine Sprache"
},
"choices": ["fr", "en", "de"],
"default": "en"
}
]
}
} }

View file

@ -42,6 +42,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE language=$YNH_APP_ARG_LANGUAGE
flarum_version="v0.1.0-beta.7" flarum_version="v0.1.0-beta.7"
ssowat_ext_ver="*@dev" ssowat_ext_ver="*@dev"
bazaar_extension=$YNH_APP_ARG_BAZAAR_EXTENSION
#=================================================== #===================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -71,6 +72,7 @@ ynh_app_setting_set $app is_public $is_public
ynh_app_setting_set $app language $language ynh_app_setting_set $app language $language
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
ynh_app_setting_set $app flarum_version $flarum_version ynh_app_setting_set $app flarum_version $flarum_version
ynh_app_setting_set $app bazaar_extension $bazaar_extension
#=================================================== #===================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -226,6 +228,10 @@ if [[ -n $admin && -n $title ]]; then
;; ;;
esac esac
if [[ $bazaar_extension ]]; then
exec_composer $app $final_path "require flagrow/bazaar --ansi"
fi
# Send login credentials to admin # Send login credentials to admin
app_message="User : $admin, password : $admin_pwd app_message="User : $admin, password : $admin_pwd
Change your password! Change your password!

View file

@ -44,6 +44,7 @@ db_pwd=$(ynh_app_setting_get $app db_pwd)
old_flarum_version=$(ynh_app_setting_get "$app" flarum_version) old_flarum_version=$(ynh_app_setting_get "$app" flarum_version)
flarum_version="v0.1.0-beta.7" flarum_version="v0.1.0-beta.7"
ssowat_ext_ver="*@dev" ssowat_ext_ver="*@dev"
bazaar_extension=$(ynh_app_setting_get "$app" bazaar_extension)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -111,11 +112,15 @@ fi
# FLARUM UPGRADE # FLARUM UPGRADE
#================================================= #=================================================
# Upgrade Flarum if [[ $old_flarum_version -ne $flarum_version ]]; then
exec_composer $app $final_path "update --ansi" # Upgrade Flarum
pushd $final_path exec_composer $app $final_path "update --ansi"
exec_as $app php flarum cache:clear pushd $final_path
popd exec_as $app php flarum cache:clear
popd
else
echo "Flarum doesn't need any update, let's check the extension."
fi
# Update SSOwat extension # Update SSOwat extension
install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat" install_and_activate_extension $app $final_path $db_name "tituspijean/flarum-ext-auth-ssowat:$ssowat_ext_ver" "tituspijean-auth-ssowat"
@ -124,6 +129,10 @@ ssowatdomain=$(</etc/yunohost/current_host)
sql_command="INSERT IGNORE INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');" sql_command="INSERT IGNORE INTO \`settings\` (\`key\`, \`value\`) VALUES ('tituspijean-auth-ssowat.domain', '$ssowatdomain'), ('tituspijean-auth-ssowat.onlyUse', '0');"
ynh_mysql_execute_as_root "$sql_command" $db_name ynh_mysql_execute_as_root "$sql_command" $db_name
if [[ $bazaar_extension ]]; then
install_and_activate_extension $app $final_path $db_name "flagrow/bazaar" "flagrow-bazaar"
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================