mirror of
https://github.com/YunoHost/example_ynh.git
synced 2024-09-03 20:06:13 +02:00
[enh] Update install
- Correction du path - Utilisation d'une source en tarball (C'est une proposition par défaut, pour remplacer l'inclusion des sources) - Vérification de la somme de contrôle de la source. - Usage de php-fpm par défaut.
This commit is contained in:
parent
13341c538f
commit
51ab91a7de
1 changed files with 32 additions and 17 deletions
|
@ -30,14 +30,33 @@ ynh_app_setting_set "$app" admin "$admin"
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
ynh_app_setting_set "$app" language "$language"
|
ynh_app_setting_set "$app" language "$language"
|
||||||
|
|
||||||
|
# Normalize the url path syntax
|
||||||
|
if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a /
|
||||||
|
path_url="/$path_url" # Add / at begin of path variable
|
||||||
|
fi
|
||||||
|
if [ "${path_url:${#path_url}-1}" == "/" ] && [ ${#path_url} -gt 1 ]; then # If the last character is a / and that not the only character.
|
||||||
|
path_url="${path_url:0:${#path_url}-1}" # Delete the last character
|
||||||
|
fi
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
|
||||||
# Copy source files
|
# Obtain and extract source files
|
||||||
|
src_url=$(cat ../sources/app.src | grep SOURCE_URL | cut -d= -f2)
|
||||||
|
src_checksum=$(cat ../sources/app.src | grep SOURCE_SUM | cut -d= -f2)
|
||||||
src_path=/var/www/$app
|
src_path=/var/www/$app
|
||||||
sudo mkdir -p $src_path
|
|
||||||
sudo cp -a ../sources/. $src_path
|
# Download sources from the upstream
|
||||||
|
wget -nv -O source.tar.gz $src_url
|
||||||
|
|
||||||
|
# Replace md5sum by sha1sum, sha256sum or whatever you use
|
||||||
|
echo "$src_checksum source.tar.gz" | md5sum -c --status \
|
||||||
|
|| ynh_die "Corrupt source"
|
||||||
|
|
||||||
|
# Extract source into the app dir
|
||||||
|
sudo mkdir $src_path || ynh_die "This path already contains a folder"
|
||||||
|
tar -x -f source.tar.gz -C $src_path --strip-components 1
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
# you may need to make some file and/or directory writeable by www-data (nginx user)
|
||||||
|
@ -63,23 +82,19 @@ sudo chown -R root: $src_path
|
||||||
nginx_conf=../conf/nginx.conf
|
nginx_conf=../conf/nginx.conf
|
||||||
sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
|
sed -i "s@YNH_WWW_PATH@$path_url@g" $nginx_conf
|
||||||
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
|
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
|
||||||
# If a dedicated php-fpm process is used:
|
sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
|
||||||
# Don't forget to modify ../conf/nginx.conf accordingly or your app will not work!
|
|
||||||
# sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
|
|
||||||
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
### PHP (can be removed if not used) ###
|
### PHP (can be removed if not used) ###
|
||||||
# If a dedicated php-fpm process is used:
|
# Modify PHP-FPM pool configuration and copy it to the pool directory
|
||||||
# Don't forget to modify ../conf/php-fpm.conf accordingly or your app will not work!
|
sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
|
||||||
#
|
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf
|
||||||
# # Modify PHP-FPM pool configuration and copy it to the pool directory
|
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||||
# sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
|
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||||
# sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf
|
sudo chown root: $finalphpconf
|
||||||
# finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
sudo chmod 644 $finalphpconf
|
||||||
# sudo cp ../conf/php-fpm.conf $finalphpconf
|
sudo service php5-fpm reload
|
||||||
# sudo chown root: $finalphpconf
|
|
||||||
# sudo chmod 644 $finalphpconf
|
|
||||||
# sudo service php5-fpm reload
|
|
||||||
### PHP end ###
|
### PHP end ###
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
|
Loading…
Add table
Reference in a new issue