1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

[enh] Use more helpers

This commit is contained in:
zamentur 2016-06-01 23:53:33 +02:00
parent 933735e61a
commit 30bc875a2b
3 changed files with 10 additions and 5 deletions

View file

@ -16,7 +16,7 @@ legal='no'
. /usr/share/yunohost/helpers . /usr/share/yunohost/helpers
# Check if admin exists # Check if admin exists
sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" \ ynh_user_exists $admin \
|| ynh_die "Wrong admin" || ynh_die "Wrong admin"
ynh_app_setting_set "$app" admin "$admin" ynh_app_setting_set "$app" admin "$admin"
@ -78,12 +78,13 @@ sudo chmod 644 $finalphpini
# Reload Nginx and regenerate SSOwat conf # Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart sudo service php5-fpm restart
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf ynh_package_install php-fpdf
sudo yunohost app addaccess $app -u $admin sudo yunohost app addaccess $app -u $admin
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@YNH_APP_INSTANCE_NAME@$app/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Reload Nginx and regenerate SSOwat conf # Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload

View file

@ -43,7 +43,7 @@ if [ -f $phpini ]; then
fi fi
# Dependences # Dependences
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -y --force-yes -qq install php-fpdf ynh_package_install php-fpdf
# Restore sources & data # Restore sources & data
sudo cp -a ./sources $final_path sudo cp -a ./sources $final_path
@ -68,7 +68,7 @@ sudo chown root: $phpini
sudo chmod 644 $phpini sudo chmod 644 $phpini
# Set Administrator # Set Administrator
if sudo yunohost user info $admin > /dev/null; then if ynh_user_exists $admin; then
sudo yunohost app addaccess $app -u $admin sudo yunohost app addaccess $app -u $admin
fi fi

View file

@ -21,6 +21,7 @@ then
else else
is_public=1 is_public=1
fi fi
ynh_app_setting_set "$app" is_public "$is_public"
fi fi
language=$(ynh_app_setting_get "$app" language) language=$(ynh_app_setting_get "$app" language)
@ -71,8 +72,11 @@ sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@YNH_APP_INSTANCE_NAME@$app/@g" ../conf/nginx.conf
if ynh_user_exists $admin; then
sudo yunohost app addaccess $app -u $admin sudo yunohost app addaccess $app -u $admin
fi
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf