1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cheky_ynh.git synced 2024-09-03 18:16:00 +02:00

Merge pull request #4 from YunoHost-Apps/version_4.1

Version 4.1
This commit is contained in:
Gofannon 2018-08-08 15:17:51 +02:00 committed by GitHub
commit ea310b935e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 7 deletions

View file

@ -6,7 +6,7 @@
> *This package allow you to install cheky 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.*
**Shipped version:** 3.8.1
**Shipped version:** 4.1
## Features
@ -28,7 +28,6 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Additionnal informations
* Anciennement nommé LBCAlerte. Renommé depuis la [version 3.4](https://www.cheky.net/changelog#v3_4)
* Logiciel pour être alerté de nouvelles annonces par mail, flux RSS et SMS sur Leboncoin et d'autres sites d'annonces.
## Links

View file

@ -1,5 +1,5 @@
{
"name": "cheky",
"name": "Cheky",
"id": "cheky",
"packaging_format": 1,
"description": {

View file

@ -10,4 +10,38 @@
ynh_delete_file_checksum () {
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_delete $app $checksum_setting_name
}
}
### Experimental helpers
# Taken from https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_read_manifest/ynh_read_manifest_2#L14-L28
# Idea from https://forum.yunohost.org/t/upgrade-script-how-to-modify-parameter-inside-configuration-file/5352/2
# Read the value of a key in a ynh manifest file
#
# usage: ynh_read_manifest manifest key
# | arg: manifest - Path of the manifest to read
# | arg: key - Name of the key to find
ynh_read_manifest () {
manifest="$1"
key="$2"
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$key'])"
}
# Read the upstream version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number before ~ynh
# In the last example it return 4.3-2
#
# usage: ynh_app_upstream_version
ynh_app_upstream_version () {
manifest_path="../manifest.json"
if [ ! -e "$manifest_path" ]; then
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest "$manifest_path" "version")
echo "${version_key/~ynh*/}"
}

View file

@ -111,14 +111,14 @@ ynh_add_fpm_config
cron_path="/etc/cron.d/$app"
# Copy crontab from package to Yunohost
sudo cp -a ../conf/cheky.cron "$cron_path"
cp -a ../conf/cheky.cron "$cron_path"
# Secure crontab
chown root: "$cron_path"
sudo chmod 644 "$cron_path"
chmod 644 "$cron_path"
# Configure crontab
ynh_replace_string "__USER__" "$app" "$cron_path"
ynh_replace_string "__USER__" "$app" "$cron_path"
ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path"

View file

@ -22,6 +22,9 @@ is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
# Exerimental helper, see "_common.sh"
upstream_version=$(ynh_app_upstream_version)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -108,6 +111,13 @@ ynh_add_fpm_config
# Recalculate and store the config file checksum into the app settings
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
# Needed so no manual operation has to be done by user while upgrading
# and no need to make "$final_path/version.php" writable
if [ -f "$final_path/var/config.ini" ]; then
# Change the existing version by the new one taken from the app manifest
ynh_replace_string "^version =.*" "version = \"$upstream_version\"" "$final_path/var/config.ini"
fi
#=================================================
# GENERIC FINALIZATION
#=================================================