1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Git for install and update

This commit is contained in:
Amo 2021-06-01 23:34:25 +05:30
parent 3c5cef3ad3
commit 94859076b5
5 changed files with 100 additions and 73 deletions

View file

@ -7,6 +7,7 @@
path="/path" (PATH) path="/path" (PATH)
admin="john" (USER) admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
update=0
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1

View file

@ -1,67 +1,71 @@
{ {
"name": "Firefly III", "name": "Firefly III",
"id": "firefly-iii", "id": "firefly-iii",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Self-hosted financial manager.", "en": "Self-hosted financial manager.",
"fr": "Gestionnaire de finances personnelles." "fr": "Gestionnaire de finances personnelles."
}, },
"version": "5.5.11~ynh2", "version": "5.5.11~ynh2",
"url": "https://firefly-iii.org/", "url": "https://firefly-iii.org/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "Anmol Sharma", "name": "Anmol Sharma",
"email": "anmol@datamol.org", "email": "anmol@datamol.org",
"url": "https://datamol.org" "url": "https://datamol.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.1.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": ["nginx", "php7.0-fpm", "mysql"],
"nginx", "arguments": {
"php7.0-fpm", "install": [
"mysql" {
], "name": "domain",
"arguments": { "type": "domain",
"install" : [ "ask": {
{ "en": "Choose a domain for Firefly III",
"name": "domain", "fr": "Choisissez un nom de domaine pour Firefly III"
"type": "domain", },
"ask": { "example": "example.com"
"en": "Choose a domain for Firefly III", },
"fr": "Choisissez un nom de domaine pour Firefly III" {
}, "name": "path",
"example": "example.com" "type": "path",
}, "ask": {
{ "en": "Choose a path for Firefly III",
"name": "path", "fr": "Choisissez un chemin pour Firefly III"
"type": "path", },
"ask": { "example": "/example",
"en": "Choose a path for Firefly III", "default": "/firefly"
"fr": "Choisissez un chemin pour Firefly III" },
}, {
"example": "/example", "name": "admin",
"default": "/firefly" "type": "user",
}, "ask": {
{ "en": "Choose an admin user (should be a YunoHost registered user)",
"name": "admin", "fr": "Choisissez ladministrateur (should be a YunoHost registered user)"
"type": "user", },
"ask": { "example": "johndoe"
"en": "Choose an admin user (should be a YunoHost registered user)", },
"fr": "Choisissez ladministrateur (should be a YunoHost registered user)" {
}, "name": "is_public",
"example": "johndoe" "type": "boolean",
}, "ask": {
{ "en": "Is it a public application?",
"name": "is_public", "fr": "Est-ce une application publique ?"
"type": "boolean", },
"ask": { "default": true
"en": "Is it a public application?", },
"fr": "Est-ce une application publique ?" {
}, "name": "update",
"default": true "type": "boolean",
} "ask": {
] "en": "Making this option to true will give you an option to force upgrade to new version without the package being updated to that version. WARNING: This can be risky and break your app if specific version have additional steps than noraml upgrade. Keep the option false, if you are not sure."
} },
"default": false
}
]
}
} }

View file

@ -5,6 +5,10 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
latest_tag=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep 'tag_name' | cut -d\" -f4)
tag="5.5.11"
pkg_dependencies="redis-server" pkg_dependencies="redis-server"
YNH_PHP_VERSION="7.4" YNH_PHP_VERSION="7.4"

View file

@ -27,7 +27,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_string_random --length=32) random_key=$(ynh_string_random --length=32)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
update=$YNH_APP_ARG_UPDATE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
@ -46,11 +46,12 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_app_setting_set --app=$app --key=random_key --value=$random_key
ynh_app_setting_set --app=$app --key=update --value=$update
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -76,7 +77,7 @@ ynh_script_progression --message="Cloning Firefly-iii..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
git clone https://github.com/firefly-iii/firefly-iii.git $final_path git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION

View file

@ -26,6 +26,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key) random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
update=$(ynh_app_setting_get --app=$app --key=update)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -92,7 +93,14 @@ then
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
then then
pushd "$final_path" pushd "$final_path"
git pull if [ $update -eq 1 ]
then
git fetch --tags
git checkout $latest_tag
else
git fetch --tags
git checkout $tag
fi
ynh_secure_remove bootstrap/cache/* ynh_secure_remove bootstrap/cache/*
ynh_secure_remove vendor/ ynh_secure_remove vendor/
popd popd
@ -112,7 +120,16 @@ then
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" if [ $update -eq 1 ]
then
git clone -b $latest_tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
else
git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
fi
ynh_secure_remove bootstrap/cache/* ynh_secure_remove bootstrap/cache/*
# Restore the config file and data # Restore the config file and data
mkdir -p "$final_path/storage/upload/" mkdir -p "$final_path/storage/upload/"