diff --git a/scripts/install b/scripts/install index 6758746..8fa19e0 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,7 @@ legal='no' . /usr/share/yunohost/helpers # Check if admin exists -sudo yunohost user list --json | grep -q "\"username\": \"$admin\"" \ +ynh_user_exists $admin \ || ynh_die "Wrong admin" ynh_app_setting_set "$app" admin "$admin" @@ -78,12 +78,13 @@ sudo chmod 644 $finalphpini # Reload Nginx and regenerate SSOwat conf 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 # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$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 # Reload Nginx and regenerate SSOwat conf sudo service nginx reload diff --git a/scripts/restore b/scripts/restore index 2f1611f..de1bc88 100644 --- a/scripts/restore +++ b/scripts/restore @@ -43,7 +43,7 @@ if [ -f $phpini ]; then fi # 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 sudo cp -a ./sources $final_path @@ -68,7 +68,7 @@ sudo chown root: $phpini sudo chmod 644 $phpini # Set Administrator -if sudo yunohost user info $admin > /dev/null; then +if ynh_user_exists $admin; then sudo yunohost app addaccess $app -u $admin fi diff --git a/scripts/upgrade b/scripts/upgrade index da6e9bb..295c18c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,7 @@ then else is_public=1 fi + ynh_app_setting_set "$app" is_public "$is_public" fi 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 sed -i "s@PATHTOCHANGE@$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 yunohost app addaccess $app -u $admin +if ynh_user_exists $admin; then + sudo yunohost app addaccess $app -u $admin +fi sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf