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:
parent
3c5cef3ad3
commit
94859076b5
5 changed files with 100 additions and 73 deletions
|
@ -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
|
||||||
|
|
|
@ -18,13 +18,9 @@
|
||||||
"yunohost": ">= 4.1.0"
|
"yunohost": ">= 4.1.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": ["nginx", "php7.0-fpm", "mysql"],
|
||||||
"nginx",
|
|
||||||
"php7.0-fpm",
|
|
||||||
"mysql"
|
|
||||||
],
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
|
@ -61,6 +57,14 @@
|
||||||
"fr": "Est-ce une application publique ?"
|
"fr": "Est-ce une application publique ?"
|
||||||
},
|
},
|
||||||
"default": true
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,6 +51,7 @@ 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
|
||||||
|
|
|
@ -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/"
|
||||||
|
|
Loading…
Reference in a new issue