mirror of
https://github.com/YunoHost-Apps/abantecart_ynh.git
synced 2024-09-03 18:06:16 +02:00
Upgrade script and some improvements
This commit is contained in:
parent
297cc6e800
commit
512f22346b
7 changed files with 88 additions and 19 deletions
|
@ -51,7 +51,7 @@
|
||||||
"default": "Yes"
|
"default": "Yes"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "user",
|
"name": "admin_name",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose the Abantecart administrator (must be an existing YunoHost user)",
|
"en": "Choose the Abantecart administrator (must be an existing YunoHost user)",
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
"example": "homer"
|
"example": "homer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "passwd",
|
"name": "admin_pass",
|
||||||
"type": "password",
|
"type": "password",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Set the password for the Admin user ≥ 5 character",
|
"en": "Set the password for the Admin user ≥ 5 character",
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
"example": "myreallystrengthpassword"
|
"example": "myreallystrengthpassword"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "email",
|
"name": "admin_email",
|
||||||
"type": "email",
|
"type": "email",
|
||||||
"ask": {
|
"ask": {
|
||||||
"fr": "Votre adresse mail."
|
"fr": "Votre adresse mail."
|
||||||
|
|
|
@ -12,9 +12,9 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=$YNH_APP_ARG_PATH
|
path=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
user=$YNH_APP_ARG_USER
|
admin_name=$YNH_APP_ARG_ADMIN_NAME
|
||||||
passwd=$YNH_APP_ARG_PASSWD
|
admin_pass=$YNH_APP_ARG_ADMIN_PASS
|
||||||
email=$YNH_APP_ARG_EMAIL
|
admin_email=$YNH_APP_ARG_ADMIN_EMAIL
|
||||||
|
|
||||||
# Vérifie que les variables ne sont pas vides.
|
# Vérifie que les variables ne sont pas vides.
|
||||||
CHECK_VAR "$app" "app name not set"
|
CHECK_VAR "$app" "app name not set"
|
||||||
|
@ -39,17 +39,18 @@ ynh_package_install_from_equivs ../conf/abantecart-deps.control \
|
||||||
# Save app settings
|
# Save app settings
|
||||||
user="$app"
|
user="$app"
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
ynh_app_setting_set "$app" password "$passwd"
|
ynh_app_setting_set "$app" admin_pass "$admin_pass"
|
||||||
ynh_app_setting_set "$app" user "$user"
|
ynh_app_setting_set "$app" admin_name "$admin_name"
|
||||||
|
ynh_app_setting_set "$app" admin_email "$admin_email"
|
||||||
|
|
||||||
# Initialize database as needed
|
# Initialize database as needed
|
||||||
|
|
||||||
dbname=$app
|
db_name=$app
|
||||||
dbuser=$app
|
db_user=$app
|
||||||
dbpass=$(ynh_string_random)
|
db_pass=$(ynh_string_random)
|
||||||
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
ynh_mysql_create_db "$db_name" "$db_user" "$db_pass"
|
||||||
ynh_app_setting_set "$app" dbname "$dbname"
|
ynh_app_setting_set "$app" db_name "$db_name"
|
||||||
ynh_app_setting_set "$app" dbpass "$dbpass"
|
ynh_app_setting_set "$app" db_pass "$db_pass"
|
||||||
|
|
||||||
# Store the database access
|
# Store the database access
|
||||||
echo -e "# MySQL Database"
|
echo -e "# MySQL Database"
|
||||||
|
|
|
@ -7,9 +7,9 @@ source /usr/share/yunohost/helpers
|
||||||
source .fonctions
|
source .fonctions
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
dbname=$(ynh_app_setting_get $app dbname)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
|
||||||
REMOVE_BDD "$dname"
|
REMOVE_BDD "$db_name"
|
||||||
|
|
||||||
# Remove installed files
|
# Remove installed files
|
||||||
SECURE_REMOVE '/var/www/${app}'
|
SECURE_REMOVE '/var/www/${app}'
|
||||||
|
@ -24,3 +24,4 @@ fi
|
||||||
|
|
||||||
|
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
sudo service php5-fpm reload
|
||||||
|
|
70
scripts/upgrade
Normal file
70
scripts/upgrade
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||||
|
|
||||||
|
# Récupère les infos de l'application.
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
path=$(ynh_app_setting_get $app path)
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
admin_name=$(ynh_app_setting_get $app admin_name)
|
||||||
|
admin_pass=$(ynh_app_setting_get $app admin_pass)
|
||||||
|
admin_email=$(ynh_app_setting_get $app admin_email)
|
||||||
|
db_pass=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
|
db_user=$(ynh_app_setting_get $app db_user)
|
||||||
|
|
||||||
|
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||||
|
|
||||||
|
# Remove trailing "/" for next commands
|
||||||
|
if [[ ! "$path" == "/" ]]; then
|
||||||
|
path=${path%/}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy files to the right place
|
||||||
|
final_path=/var/www/$app
|
||||||
|
|
||||||
|
# We download the sources and check the md5sum
|
||||||
|
SFILE=`sudo cat ../sources/source_file`;
|
||||||
|
sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz
|
||||||
|
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
||||||
|
sudo tar xvf ${SFILE}.tar.gz -C ../sources/
|
||||||
|
sudo cp -a ../sources/abantecart-src-master/. $final_path
|
||||||
|
|
||||||
|
sudo rm -rf $final_path/tests
|
||||||
|
sudo rm -rf $final_path/install.txt
|
||||||
|
sudo mv $final_path/public_html/* $final_path/
|
||||||
|
sudo rm -rf $final_path/public_html
|
||||||
|
|
||||||
|
# file owned by www-data before checking permissions
|
||||||
|
sudo chown www-data:www-data $final_path -R
|
||||||
|
|
||||||
|
# set database configuration
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||||
|
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||||
|
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
||||||
|
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo cp ../conf/nginx.conf $nginxconf
|
||||||
|
sudo chown root: $nginxconf
|
||||||
|
sudo chmod 644 $nginxconf
|
||||||
|
|
||||||
|
sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||||
|
sudo sed -i "s@FOLDERTOCHANGE@$final_path@g" ../conf/php-fpm.conf
|
||||||
|
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||||
|
|
||||||
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
|
if [ "$is_public" = "Yes" ];
|
||||||
|
then
|
||||||
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo service php5-fpm reload
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
https://github.com/abantecart/abantecart-src/releases/download/1.2.9/abantecart_1.2.9_upgrade_only.tar.gz
|
|
|
@ -1 +0,0 @@
|
||||||
73cec9b57291e022599d83a403510c22 AbanteCart_1.2.9.tar.gz
|
|
|
@ -1 +0,0 @@
|
||||||
https://github.com/abantecart/abantecart-src/releases/download/1.2.9/AbanteCart_1.2.9.tar.gz
|
|
Loading…
Add table
Reference in a new issue