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)
|
||||
admin="john" (USER)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
update=0
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
"yunohost": ">= 4.1.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"services": ["nginx", "php7.0-fpm", "mysql"],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
|
@ -61,6 +57,14 @@
|
|||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
#=================================================
|
||||
|
@ -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=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
|
||||
|
|
|
@ -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/"
|
||||
|
|
Loading…
Reference in a new issue