mirror of
https://github.com/YunoHost-Apps/baikal_ynh.git
synced 2024-09-03 18:16:11 +02:00
Normalization from example_ynh
This commit is contained in:
parent
91e2a791d0
commit
208550be45
10 changed files with 120 additions and 87 deletions
52
README.md
52
README.md
|
@ -1,23 +1,65 @@
|
|||
Baïkal for YunoHost
|
||||
-------------------
|
||||
# Baïkal for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/baikal)
|
||||
[](https://install-app.yunohost.org/?app=baikal)
|
||||
|
||||
> *This package allow you to install Baïkal quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
|
||||
## Overview
|
||||
[Baïkal](http://baikal-server.com/) is a CalDAV and CardDAV server, based on
|
||||
sabre/dav, that includes an administration interface for easy management.
|
||||
|
||||
**Shipped version:** 0.4.6
|
||||
|
||||
## Features
|
||||
## Screenshots
|
||||
|
||||
## Demo
|
||||
|
||||
* [YunoHost demo](https://demo.yunohost.org/baikal/admin/)
|
||||
|
||||
## Configuration
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: http://sabre.io/baikal/
|
||||
* YunoHost documentation: https://yunohost.org/#/app_baikal
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
In addition to Baïkal core features, the following are made available with
|
||||
this package:
|
||||
|
||||
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain
|
||||
|
||||
## TODO
|
||||
#### Multi-users support
|
||||
|
||||
* Update `config.php` and `config.system.php` at upgrade
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/baikal/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/baikal/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/baikal/)
|
||||
|
||||
## Limitations
|
||||
|
||||
## Additional information
|
||||
|
||||
## Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/baikal_ynh/issues
|
||||
* Baïkal website: http://baikal-server.com/
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
Developers infos
|
||||
----------------
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/baikal_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/baikal_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade baikal -u https://github.com/YunoHost-Apps/baikal_ynh/tree/testing --debug
|
||||
```
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#
|
||||
|
||||
# Timezone of your users, if unsure, check http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
define("PROJECT_TIMEZONE", '#TIMEZONE#');
|
||||
define("PROJECT_TIMEZONE", '__TIMEZONE__');
|
||||
|
||||
# CardDAV ON/OFF switch; default TRUE
|
||||
define("BAIKAL_CARD_ENABLED", TRUE);
|
||||
|
@ -59,4 +59,4 @@ define("BAIKAL_DAV_LDAP_DISPLAYNAME_ATTR", 'cn');
|
|||
define("BAIKAL_DAV_LDAP_EMAIL_ATTR", 'mail');
|
||||
|
||||
# Baïkal Web admin password hash; Set via Baïkal Web Admin
|
||||
define("BAIKAL_ADMIN_PASSWORDHASH", '#PASSWORDHASH#');
|
||||
define("BAIKAL_ADMIN_PASSWORDHASH", '__PASSWORDHASH__');
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
define("BAIKAL_AUTH_REALM", 'BaikalDAV');
|
||||
|
||||
# Should begin and end with a "/"
|
||||
define("BAIKAL_CARD_BASEURI", "#PATH#/card.php/");
|
||||
define("BAIKAL_CARD_BASEURI", "__PATH__/card.php/");
|
||||
|
||||
# Should begin and end with a "/"
|
||||
define("BAIKAL_CAL_BASEURI", "#PATH#/cal.php/");
|
||||
define("BAIKAL_CAL_BASEURI", "__PATH__/cal.php/");
|
||||
|
||||
# Should begin and end with a "/"
|
||||
define("BAIKAL_DAV_BASEURI", "#PATH#/dav.php/");
|
||||
define("BAIKAL_DAV_BASEURI", "__PATH__/dav.php/");
|
||||
|
||||
# Define path to Baïkal Database SQLite file
|
||||
define("PROJECT_SQLITE_FILE", PROJECT_PATH_SPECIFIC . "db/db.sqlite");
|
||||
|
@ -57,16 +57,16 @@ define("PROJECT_DB_MYSQL", TRUE);
|
|||
define("PROJECT_DB_MYSQL_HOST", 'localhost');
|
||||
|
||||
# MySQL > Database name
|
||||
define("PROJECT_DB_MYSQL_DBNAME", '#DBNAME#');
|
||||
define("PROJECT_DB_MYSQL_DBNAME", '__DBNAME__');
|
||||
|
||||
# MySQL > Username
|
||||
define("PROJECT_DB_MYSQL_USERNAME", '#DBUSER#');
|
||||
define("PROJECT_DB_MYSQL_USERNAME", '__DBUSER__');
|
||||
|
||||
# MySQL > Password
|
||||
define("PROJECT_DB_MYSQL_PASSWORD", '#DBPASS#');
|
||||
define("PROJECT_DB_MYSQL_PASSWORD", '__DBPASS__');
|
||||
|
||||
# A random 32 bytes key that will be used to encrypt data
|
||||
define("BAIKAL_ENCRYPTION_KEY", '#DESKEY#');
|
||||
define("BAIKAL_ENCRYPTION_KEY", '__DESKEY__');
|
||||
|
||||
# The currently configured Baïkal version
|
||||
define("BAIKAL_CONFIGURED_VERSION", '0.4.6');
|
||||
|
|
|
@ -5,12 +5,15 @@ location = /.well-known/caldav {
|
|||
return 301 https://$server_name__PATH__/cal.php;
|
||||
}
|
||||
|
||||
location __PATH__ {
|
||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/html/;
|
||||
|
||||
# Force usage of https
|
||||
if ($scheme = http) {
|
||||
return 301 https://$server_name$request_uri;
|
||||
# rewrite ^ https://$server_name$request_uri? permanent;
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
index index.php;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
"en": "Lightweight CalDAV+CardDAV server",
|
||||
"fr": "Serveur CalDAV+CardDAV léger"
|
||||
},
|
||||
"version": "0.4.6",
|
||||
"url": "http://baikal-server.com/",
|
||||
"license": "GPL-3.0",
|
||||
"version": "0.4.6",
|
||||
"maintainer": {
|
||||
"name": "julien",
|
||||
"email": "julien.malik@paraiso.me"
|
||||
|
@ -19,9 +19,6 @@
|
|||
"php5-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.2"
|
||||
},
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
|
|
|
@ -2,25 +2,20 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat access to unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#if [ ! -e _common.sh ]; then
|
||||
# # Get the _common.sh file if it's not in the current directory
|
||||
# cp ../settings/scripts/_common.sh ./_common.sh
|
||||
# chmod a+rx _common.sh
|
||||
#fi
|
||||
#source _common.sh
|
||||
# source ../settings/scripts/_common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
@ -30,7 +25,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
|
|
|
@ -30,14 +30,12 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
|
||||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
# Check web path availability
|
||||
ynh_webpath_available $domain $path_url
|
||||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
|
@ -103,10 +101,10 @@ ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \
|
|||
bk_conf="${final_path}/Specific/config.php"
|
||||
cp ../conf/config.php "$bk_conf"
|
||||
|
||||
ynh_replace_string "#TIMEZONE#" "$(cat /etc/timezone)" "$bk_conf"
|
||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$bk_conf"
|
||||
# Create admin password hash
|
||||
password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1)
|
||||
ynh_replace_string "#PASSWORDHASH#" "${password_hash}" "$bk_conf"
|
||||
ynh_replace_string "__PASSWORDHASH__" "${password_hash}" "$bk_conf"
|
||||
ynh_app_setting_set $app password_hash $password_hash
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
|
@ -114,14 +112,15 @@ ynh_store_file_checksum "$bk_conf"
|
|||
|
||||
bk_conf="${final_path}/Specific/config.system.php"
|
||||
cp ../conf/config.system.php "$bk_conf"
|
||||
ynh_replace_string "#PATH#" "$path_url" "$bk_conf"
|
||||
ynh_replace_string "#DBNAME#" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "#DBUSER#" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "#DBPASS#" "$db_pwd" "$bk_conf"
|
||||
|
||||
ynh_replace_string "__PATH__" "$path_url" "$bk_conf"
|
||||
ynh_replace_string "__DBNAME__" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "__DBUSER__" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "__DBPASS__" "$db_pwd" "$bk_conf"
|
||||
|
||||
deskey=$(ynh_string_random 24)
|
||||
ynh_app_setting_set "$app" encrypt_key "$deskey"
|
||||
ynh_replace_string "#DESKEY#" "$deskey" "$bk_conf"
|
||||
ynh_app_setting_set $app encrypt_key "$deskey"
|
||||
ynh_replace_string "__DESKEY__" "$deskey" "$bk_conf"
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$bk_conf"
|
||||
|
@ -145,9 +144,9 @@ chmod 640 "$final_path/Specific/"{config.php,config.system.php}
|
|||
#=================================================
|
||||
|
||||
# Allow public access on /
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
# But restrain on /admin
|
||||
ynh_app_setting_set "$app" protected_uris "/admin/"
|
||||
ynh_app_setting_set $app protected_uris "/admin/"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#if [ ! -e _common.sh ]; then
|
||||
# # Get file fonction if not been to the current directory
|
||||
# sudo cp ../settings/scripts/_common.sh ./_common.sh
|
||||
# sudo chmod a+rx _common.sh
|
||||
#fi
|
||||
# Source app helpers
|
||||
# source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
|
|
@ -2,25 +2,20 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat access to unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#if [ ! -e _common.sh ]; then
|
||||
# # Get the _common.sh file if it's not in the current directory
|
||||
# cp ../settings/scripts/_common.sh ./_common.sh
|
||||
# chmod a+rx _common.sh
|
||||
#fi
|
||||
#source _common.sh
|
||||
# source ../settings/scripts/_common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
|
|
@ -24,12 +24,14 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
||||
if [ -z $final_path ]; then # If final_path doesn't exist, create it
|
||||
final_path="/var/www/$app"
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z $final_path ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
fi
|
||||
|
||||
if [ -z $db_name ]; then # If db_name doesn't exist, create it
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z $db_name ]; then
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
ynh_app_setting_set $app db_name $db_name
|
||||
fi
|
||||
|
@ -38,11 +40,14 @@ fi
|
|||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
||||
ynh_backup_before_upgrade # Backup the current version of the app
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_restore_upgradebackup # restore it if the upgrade fails
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
|
@ -71,7 +76,7 @@ ynh_add_nginx_config
|
|||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
# Create a system user
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
|
@ -92,18 +97,20 @@ php "${final_path}/bin/upgrade.sh"
|
|||
|
||||
# Cleanup old baikal-admin sessions
|
||||
# since we may have changed owner of the session file
|
||||
grep -lr "CSRF_TOKEN|s:" /var/lib/php5/sessions | xargs rm -f
|
||||
grep --files-with-matches --recursive "CSRF_TOKEN|s:" /var/lib/php5/sessions | xargs rm -f
|
||||
|
||||
#=================================================
|
||||
# UPGRADE BAIKAL CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
bk_conf="${final_path}/Specific/config.php"
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$bk_conf"
|
||||
|
||||
cp ../conf/config.php "$bk_conf"
|
||||
|
||||
ynh_replace_string "#TIMEZONE#" "$(cat /etc/timezone)" "$bk_conf"
|
||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$bk_conf"
|
||||
|
||||
password_hash=$(ynh_app_setting_get $app password_hash)
|
||||
# If the password_hash is not in the app's config, recreate it from the password.
|
||||
|
@ -112,24 +119,26 @@ if [ -z "$password_hash" ]; then
|
|||
password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1)
|
||||
ynh_app_setting_set $app password_hash $password_hash
|
||||
fi
|
||||
ynh_replace_string "#PASSWORDHASH#" "${password_hash}" "$bk_conf"
|
||||
ynh_replace_string "__PASSWORDHASH__" "${password_hash}" "$bk_conf"
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$bk_conf"
|
||||
|
||||
bk_conf="${final_path}/Specific/config.system.php"
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$bk_conf"
|
||||
|
||||
cp ../conf/config.system.php "$bk_conf"
|
||||
|
||||
ynh_replace_string "#PATH#" "$path_url" "$bk_conf"
|
||||
ynh_replace_string "#DBNAME#" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "#DBUSER#" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "__PATH__" "$path_url" "$bk_conf"
|
||||
ynh_replace_string "__DBNAME__" "$db_name" "$bk_conf"
|
||||
ynh_replace_string "__DBUSER__" "$db_name" "$bk_conf"
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
ynh_replace_string "#DBPASS#" "$db_pwd" "$bk_conf"
|
||||
ynh_replace_string "__DBPASS__" "$db_pwd" "$bk_conf"
|
||||
|
||||
deskey=$(ynh_app_setting_get $app deskey)
|
||||
ynh_replace_string "#DESKEY#" "$deskey" "$bk_conf"
|
||||
ynh_replace_string "__DESKEY__" "$deskey" "$bk_conf"
|
||||
|
||||
# Store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$bk_conf"
|
||||
|
@ -150,9 +159,9 @@ chmod 640 "$final_path/Specific/"{config.php,config.system.php}
|
|||
#=================================================
|
||||
|
||||
# Allow public access on /
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
# But restrain on /admin
|
||||
ynh_app_setting_set "$app" protected_uris "/admin/"
|
||||
ynh_app_setting_set $app protected_uris "/admin/"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Add table
Reference in a new issue