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

[enh] Removing sudos and calling correct _common in restore

This commit is contained in:
tituspijean 2019-09-11 18:42:36 +02:00
parent d1399fed79
commit 13a62335e3
3 changed files with 23 additions and 22 deletions

View file

@ -102,11 +102,11 @@ ynh_install_php --phpversion=7.3 --package="$pkg_dependencies"
#=================================================== #===================================================
ynh_system_user_create $app $final_path 1 ynh_system_user_create $app $final_path 1
sudo usermod -a -G www-data $app usermod -a -G www-data $app
# Create working directory # Create working directory
sudo mkdir -p "$final_path/.composer" mkdir -p "$final_path/.composer"
sudo chown -R $app:www-data $final_path chown -R $app:www-data $final_path
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
#================================================= #=================================================
# COMPOSER INSTALLATION # COMPOSER INSTALLATION
@ -121,9 +121,9 @@ ynh_install_composer $php_version $final_path
# Prepare Flarum temp directory # Prepare Flarum temp directory
tmp=/tmp/$app tmp=/tmp/$app
sudo mkdir -p $tmp mkdir -p $tmp
sudo chown -R $app:www-data $tmp chown -R $app:www-data $tmp
sudo chmod -R 0775 $tmp chmod -R 0775 $tmp
# Install Flarum # Install Flarum
ynh_script_progression --message="Composer is installing Flarum and its dependencies (may take a while)..." --time --weight=3 ynh_script_progression --message="Composer is installing Flarum and its dependencies (may take a while)..." --time --weight=3
@ -134,13 +134,13 @@ ynh_composer_exec $app $php_version $final_path "create-project flarum/flarum=$p
ynh_composer_exec $app $php_version $final_path "require flarum/core:$core_version -n --ansi -d $tmp" ynh_composer_exec $app $php_version $final_path "require flarum/core:$core_version -n --ansi -d $tmp"
# Copy Flarum to working directory and clean temp directory # Copy Flarum to working directory and clean temp directory
sudo cp -Rf $tmp/* $final_path cp -Rf $tmp/* $final_path
ynh_secure_remove $tmp ynh_secure_remove $tmp
# Set right permissions for the post-installation # Set right permissions for the post-installation
chown -R $app: $final_path chown -R $app: $final_path
chown -R $app:www-data $final_path/storage chown -R $app:www-data $final_path/storage
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE

View file

@ -6,7 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -66,7 +67,7 @@ ynh_system_user_create --username=$app
# Set right permissions # Set right permissions
chown -R $app: $final_path chown -R $app: $final_path
chown -R $app:www-data $final_path/storage chown -R $app:www-data $final_path/storage
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION

View file

@ -175,9 +175,9 @@ if [[ $(dpkg --compare-versions $old_project_version lt "0.1.0-beta.8" && echo t
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
# Create working directory # Create working directory
sudo mkdir -p "$final_path/.composer" mkdir -p "$final_path/.composer"
sudo chown -R $app:www-data $final_path chown -R $app:www-data $final_path
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
#================================================= #=================================================
# COMPOSER INSTALLATION # COMPOSER INSTALLATION
@ -192,9 +192,9 @@ if [[ $(dpkg --compare-versions $old_project_version lt "0.1.0-beta.8" && echo t
# Prepare Flarum temp directory # Prepare Flarum temp directory
tmp=/tmp/$app tmp=/tmp/$app
sudo mkdir -p $tmp mkdir -p $tmp
sudo chown -R $app:www-data $tmp chown -R $app:www-data $tmp
sudo chmod -R 0775 $tmp chmod -R 0775 $tmp
# Install Flarum # Install Flarum
ynh_script_progression --message="Composer is installing Flarum and its dependencies (may take a while)..." --time --weight=3 ynh_script_progression --message="Composer is installing Flarum and its dependencies (may take a while)..." --time --weight=3
@ -205,10 +205,10 @@ if [[ $(dpkg --compare-versions $old_project_version lt "0.1.0-beta.8" && echo t
ynh_composer_exec $app $php_version $final_path "require flarum/core:$core_version -n --ansi -d $tmp" ynh_composer_exec $app $php_version $final_path "require flarum/core:$core_version -n --ansi -d $tmp"
# Copy Flarum to working directory # Copy Flarum to working directory
sudo cp -Rf $tmp/* $final_path cp -Rf $tmp/* $final_path
# Copy config.php and assets from old app versions # Copy config.php and assets from old app versions
sudo cp -Rf $tmpbak/config.php $final_path cp -Rf $tmpbak/config.php $final_path
sudo cp -Rf $tmpbak/assets $final_path/public cp -Rf $tmpbak/assets $final_path/public
# Clean temp directory # Clean temp directory
ynh_secure_remove $tmp ynh_secure_remove $tmp
ynh_secure_remove $tmpbak ynh_secure_remove $tmpbak
@ -216,7 +216,7 @@ if [[ $(dpkg --compare-versions $old_project_version lt "0.1.0-beta.8" && echo t
# Set right permissions for the post-installation # Set right permissions for the post-installation
chown -R $app: $final_path chown -R $app: $final_path
chown -R $app:www-data $final_path/storage chown -R $app:www-data $final_path/storage
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
fi fi
pushd $final_path pushd $final_path
@ -270,7 +270,7 @@ ynh_use_logrotate --non-append
# Set permissions on app files # Set permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
chown -R $app:www-data $final_path/storage chown -R $app:www-data $final_path/storage
sudo chmod -R 0775 $final_path chmod -R 0775 $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT