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)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
update=0
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -1,67 +1,71 @@
{
"name": "Firefly III",
"id": "firefly-iii",
"packaging_format": 1,
"description": {
"en": "Self-hosted financial manager.",
"fr": "Gestionnaire de finances personnelles."
},
"version": "5.5.11~ynh2",
"url": "https://firefly-iii.org/",
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Anmol Sharma",
"email": "anmol@datamol.org",
"url": "https://datamol.org"
},
"requirements": {
"yunohost": ">= 4.1.0"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Firefly III",
"fr": "Choisissez un nom de domaine pour Firefly III"
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Firefly III",
"fr": "Choisissez un chemin pour Firefly III"
},
"example": "/example",
"default": "/firefly"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user (should be a YunoHost registered user)",
"fr": "Choisissez ladministrateur (should be a YunoHost registered user)"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
}
]
}
"name": "Firefly III",
"id": "firefly-iii",
"packaging_format": 1,
"description": {
"en": "Self-hosted financial manager.",
"fr": "Gestionnaire de finances personnelles."
},
"version": "5.5.11~ynh2",
"url": "https://firefly-iii.org/",
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Anmol Sharma",
"email": "anmol@datamol.org",
"url": "https://datamol.org"
},
"requirements": {
"yunohost": ">= 4.1.0"
},
"multi_instance": true,
"services": ["nginx", "php7.0-fpm", "mysql"],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Firefly III",
"fr": "Choisissez un nom de domaine pour Firefly III"
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Firefly III",
"fr": "Choisissez un chemin pour Firefly III"
},
"example": "/example",
"default": "/firefly"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user (should be a YunoHost registered user)",
"fr": "Choisissez ladministrateur (should be a YunoHost registered user)"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
},
{
"name": "update",
"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
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"
YNH_PHP_VERSION="7.4"

View file

@ -27,7 +27,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_string_random --length=32)
email=$(ynh_user_get_info --username=$admin --key=mail)
update=$YNH_APP_ARG_UPDATE
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_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=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
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=admin --value=$admin
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=update --value=$update
#=================================================
# 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
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

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)
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail)
update=$(ynh_app_setting_get --app=$app --key=update)
#=================================================
# CHECK VERSION
@ -92,7 +93,14 @@ then
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
then
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 vendor/
popd
@ -112,7 +120,16 @@ then
ynh_secure_remove --file="$final_path"
# 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/*
# Restore the config file and data
mkdir -p "$final_path/storage/upload/"