Commit 613412a7 authored by ljf's avatar ljf

Merge branch 'testing' into 'master'

Testing

See merge request !1
parents 5461c0f4 515df544
;; Test complet sans multisite
auto_remove=1
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
is_public=1 (PUBLIC|public=1|private=0)
; Checks
pkg_linter=0
setup_sub_dir=1
setup_root=0
setup_nourl=0
setup_private=0
setup_public=0
upgrade=0
backup_restore=1
multi_instance=0
wrong_user=0
wrong_path=0
incorrect_path=0
corrupt_source=0
fail_download_source=0
port_already_use=0
final_path_already_use=0
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
Level 4=0
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=ljf+covoiturage_ynh@reflexlibre.net
Notification=down
{
"name": "Covoiturage",
"id": "covoiturage",
"packaging_format": 1,
"version": "0.0.1-2",
"description": {
"en": "Covoiturage is a carsharing application (in French)",
"fr": "Covoiturage est une application de covoiturage."
},
"license": "CC-BY-NC-SA-3.0",
"url": "https://github.com/SebGit/covoiturage-libre",
"developer": {
"maintainer": {
"name": "ljf",
"email": "valentin@grimaud.me"
"email": "ljf+covoiturage_ynh@reflexlibre.net",
"url": "https://reflexlibre.net"
},
"multi_instance": "true",
"requirements": {
"yunohost": ">= 2.7.2"
},
"multi_instance": true,
"services": [
"nginx",
"php5-fpm",
"mysql"
],
"arguments": {
"install" : [
{
......@@ -33,13 +45,13 @@
"default": "/covoiturage"
},
{
"name": "public_site",
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Could non member do carsharing ?",
"fr": "Une personne non membre peut elle utiliser cette plateforme de covoiturage ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
"default": 1
}
......
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path=/var/www/$app #$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE MAIN DIR OF THE APP
#=================================================
ynh_backup "$final_path"
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP OF THE SQL BDD
#=================================================
ynh_mysql_dump_db "$db_name" > db.sql
#!/bin/bash
APP='covoiturage'
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$1
path=$2
public_site=$3
path_url=$2
is_public=$3
sudo yunohost app setting $APP public_site -v $public_site
sudo yunohost app setting $app is_public -v $is_public
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $APP
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Generate random password
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_user=$APP
#=================================================
# CHECK IF THE app CAN BE INSTALLED WITH THIS ARGS
#=================================================
export final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
#=================================================
# CREATE A SQL BDD
#=================================================
db_name=$(ynh_sanitize_dbid $app)
db_user=$db_name
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_user $db_name
# Initialize database and store mysql password for upgrade
sudo yunohost app initdb $db_user -p $db_pwd
sudo yunohost app setting $APP mysqlpwd -v $db_pwd
# Copy files to the right place
final_path=/var/www/$APP
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
......@@ -36,14 +67,13 @@ mysql -u $db_user -p$db_pwd $db_user < ../conf/mysql.sql
sudo sed -i "s/yunouser/$db_user/g" $final_path/Connections/bddcovoiturette.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/Connections/bddcovoiturette.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/Connections/bddcovoiturette.php
sudo sed -i "s/yunoadmin/$admin/g" $final_path/Connections/bddcovoiturette.php
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@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
sudo service nginx reload
if [ "$public_site" = "Yes" ];
if [ "$is_public" = "1" ];
then
sudo yunohost app setting $APP skipped_uris -v "/"
sudo yunohost app setting $app skipped_uris -v "/"
fi
sudo yunohost app ssowatconf
#!/bin/bash
app=$YNH_APP_INSTANCE_NAME
domain=$(sudo yunohost app setting covoiturage domain)
db_user=covoiturage
db_name=covoiturage
db_user=$app
db_name=$app
root_pwd=$(sudo cat /etc/yunohost/mysql)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
......
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
export app=$YNH_APP_INSTANCE_NAME
export domain=$(ynh_app_setting_get $app domain)
export path_url=$(ynh_app_setting_get $app path)
export final_path=/var/www/$app
export is_public=$(ynh_app_setting_get $app is_public)
export db_name=$(ynh_app_setting_get $app db_name)
export db_user=$(ynh_app_setting_get $app db_user)
export db_pwd=$(ynh_app_setting_get $app mysqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
#=================================================
# RESTORE OF THE SQL BDD
#=================================================
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RESTORE FILES
#=================================================
# Restore files
ynh_restore
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Set permissions to roundcube directory
sudo chown -R www-data: $final_path
if [ "$is_public" = "1" ];
then
sudo yunohost app setting $app skipped_uris -v "/"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_system_reload php5-fpm
ynh_system_reload nginx
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
ynh_send_readme_to_admin "$message" "$admin"
#!/bin/bash
APP='covoiturage'
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $APP domain)
path=$(sudo yunohost app setting $APP path)
public_site=$(sudo yunohost app setting $APP public_site)
domain=$(sudo yunohost app setting $app domain)
path_url=$(sudo yunohost app setting $app path)
is_public=$(sudo yunohost app setting $app is_public)
#=================================================
# CHECK VERSION
#=================================================
ynh_abort_if_up_to_date
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
### Execute potential SQL statements here
# Copy files to the right place
final_path=/var/www/$APP
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
......@@ -18,16 +47,16 @@ sudo cp -a ../sources/* $final_path
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@PATHTOCHANGE@$path_url@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_path/@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
sudo service nginx reload
if [ "$public_site" = "Yes" ];
if [ "$is_public" = "1" ];
then
sudo yunohost app setting $APP skipped_uris -v "/"
sudo yunohost app setting $app skipped_uris -v "/"
fi
sudo yunohost app ssowatconf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment