mirror of
https://github.com/YunoHost-Apps/flarum_ynh.git
synced 2024-09-03 18:36:24 +02:00
parent
5714ad440e
commit
274a9a70c8
2 changed files with 12 additions and 9 deletions
|
@ -21,10 +21,12 @@ exec_composer() {
|
|||
|
||||
# Do not run composer as root
|
||||
if [ $AS_USER = "root" ] ; then ynh_die "Do not run composer as root" ; fi
|
||||
|
||||
pushd "${WORKDIR}"
|
||||
exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
php "${WORKDIR}/composer.phar" $@ \
|
||||
-d "${WORKDIR}" -d memory_limit=-1 --quiet --no-interaction
|
||||
php -d memory_limit=-1 \
|
||||
"${WORKDIR}/composer.phar" $@ \
|
||||
--quiet --no-interaction
|
||||
popd
|
||||
}
|
||||
|
||||
# Install and initialize Composer in the given directory
|
||||
|
@ -41,7 +43,7 @@ init_composer() {
|
|||
| COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
php -- --quiet --install-dir="$WORKDIR" \
|
||||
|| ynh_die "Unable to install Composer"
|
||||
|
||||
chmod +x "${WORKDIR}/composer.phar"
|
||||
# update dependencies to create composer.lock
|
||||
#exec_composer "$AS_USER" "$WORKDIR" install --no-dev \
|
||||
# || ynh_die "Unable to update core dependencies with Composer"
|
||||
|
@ -63,7 +65,7 @@ install_and_activate_extension() {
|
|||
local new_extensions_enabled
|
||||
|
||||
# Install extension
|
||||
exec_composer $AS_USER $WORKDIR "require $EXTENSION --ansi"
|
||||
exec_composer $AS_USER $WORKDIR "require $EXTENSION --ansi -d $WORKDIR"
|
||||
|
||||
# Retrieve current extensions
|
||||
sql_command="SELECT \`value\` FROM settings WHERE \`key\` = 'extensions_enabled'"
|
||||
|
@ -138,4 +140,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
|||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ sudo chown -R $app:www-data $tmp
|
|||
sudo chmod -R 0775 $tmp
|
||||
|
||||
# Install Flarum
|
||||
exec_composer $app $final_path "create-project flarum/flarum $tmp $flarum_version --stability=beta --ansi"
|
||||
exec_composer $app $final_path "create-project flarum/flarum $tmp $flarum_version --stability=beta --ansi -d $tmp"
|
||||
|
||||
# Copy Flarum to working directory and clean temp directory
|
||||
sudo cp -Rf $tmp/* $final_path
|
||||
|
@ -176,6 +176,7 @@ if [[ -n $admin && -n $title ]]; then
|
|||
# Copy the configuration.yml to working directory
|
||||
finalflarumconf="$final_path/configuration.yml"
|
||||
cp ../conf/configuration.yml $finalflarumconf
|
||||
chown $app:www-data $finalflarumconf
|
||||
# Generate admin password and retrieve their email address
|
||||
admin_pwd=$(ynh_string_random 8)
|
||||
admin_mail=$(ynh_user_get_info $admin mail)
|
||||
|
@ -189,10 +190,11 @@ if [[ -n $admin && -n $title ]]; then
|
|||
sed -i "s%__ADMIN_EML__%$admin_mail%g" $finalflarumconf
|
||||
sed -i "s@__FORUM_TITLE__@$title@g" $finalflarumconf
|
||||
# Execute post-installation
|
||||
cd $final_path
|
||||
exec_as $app "php -d memory_limit=-1 flarum install -f configuration.yml"
|
||||
pushd $final_path
|
||||
exec_as $app "php -d $final_path -d memory_limit=-1 flarum install -f configuration.yml"
|
||||
# Delete configuration.yml as it sensitive data
|
||||
ynh_secure_remove $finalflarumconf
|
||||
popd
|
||||
|
||||
# Email setup
|
||||
sql_command="REPLACE INTO \`settings\` (\`key\`, \`value\`) VALUES
|
||||
|
|
Loading…
Add table
Reference in a new issue