1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
This commit is contained in:
ericgaspar 2021-03-17 23:15:47 +01:00
parent 2860874308
commit 2c58f5cce8
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 17 additions and 45 deletions

View file

@ -14,8 +14,6 @@
upgrade=1 from_commit=7960d347424cb1cb931c91f2628dd829288184e1 upgrade=1 from_commit=7960d347424cb1cb931c91f2628dd829288184e1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
incorrect_path=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -14,7 +14,7 @@
"email": "julien.malik@paraiso.me" "email": "julien.malik@paraiso.me"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.1.7"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -27,29 +27,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for Baïkal",
"fr": "Choisissez un domaine pour Baïkal"
},
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Baïkal",
"fr": "Choisissez un chemin pour Baïkal"
},
"example": "/baikal", "example": "/baikal",
"default": "/baikal" "default": "/baikal"
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",
"ask": {
"en": "Set the password for the administration",
"fr": "Définissez le mot de passe pour l'administration"
},
"example": "mysecret" "example": "mysecret"
} }
] ]

View file

@ -11,14 +11,6 @@
- [ ] Upgrade from last version tested. - [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested. - [ ] Can be reviewed and tested.
## Validation
---
*Minor decision*
- **Upgrade previous version** :
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
## Package_check results ## Package_check results
--- ---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* * An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -153,12 +153,12 @@ chmod 640 "$final_path/config/baikal.yaml"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2 ynh_script_progression --message="Configuring permissions..." --weight=2
# Allow public access on / # Allow public access on /
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission="main" --add="visitors"
# But restrain on /admin # But restrain on /admin
ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -45,6 +46,18 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -142,11 +155,9 @@ then
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
fi fi
ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf" ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf" ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf" ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf" ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf" ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf"
deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key) deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key)
@ -183,23 +194,6 @@ chown -R root: "$final_path"
chown $app "$final_path/config/baikal.yaml" chown $app "$final_path/config/baikal.yaml"
chmod 640 "$final_path/config/baikal.yaml" chmod 640 "$final_path/config/baikal.yaml"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2
# Upgrade from the legacy permissions system
protected_uris=$(ynh_app_setting_get --app="$app" --key=protected_uris)
if [ -n "${protected_uris}" ]; then
ynh_app_setting_delete --app="$app" --key=protected_uris
# Allow public access on /
ynh_permission_update --permission "main" --add "visitors"
# But restrain on /admin
ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================