mirror of
https://github.com/YunoHost-Apps/kimai2_ynh.git
synced 2024-09-03 19:26:26 +02:00
Use git with tags and an option to force upgrade for user
This commit is contained in:
parent
f71603be6a
commit
c2bedff12c
5 changed files with 35 additions and 6 deletions
|
@ -9,7 +9,8 @@
|
||||||
admin="john" (USER)
|
admin="john" (USER)
|
||||||
registration=1
|
registration=1
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
; Checks
|
update=0
|
||||||
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
setup_root=1
|
setup_root=1
|
||||||
|
|
|
@ -68,6 +68,15 @@
|
||||||
"cs": "Mohou se noví uživatelé registrovat?"
|
"cs": "Mohou se noví uživatelé registrovat?"
|
||||||
},
|
},
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
|
||||||
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Latest tag
|
||||||
|
latest_tag=$(curl -s https://api.github.com/repos/kevinpapst/kimai2/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
||||||
|
tag="1.14.3"
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies=""
|
pkg_dependencies=""
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
registration=$YNH_APP_ARG_REGISTRATION
|
registration=$YNH_APP_ARG_REGISTRATION
|
||||||
random_key=$(ynh_string_random 32)
|
random_key=$(ynh_string_random 32)
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
update=$YNH_APP_ARG_UPDATE
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
@ -54,6 +55,7 @@ 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=registration --value=$registration
|
ynh_app_setting_set --app=$app --key=registration --value=$registration
|
||||||
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -72,9 +74,8 @@ ynh_script_progression --message="Setting up source files..."
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
|
||||||
# Clone the latest version
|
# Clone the latest version
|
||||||
latest_tag=$(curl -s https://api.github.com/repos/kevinpapst/kimai2/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
|
||||||
|
|
||||||
git clone -b $latest_tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path
|
git clone -b $tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
|
|
@ -24,6 +24,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
registration=$(ynh_app_setting_get --app=$app --key=registration)
|
registration=$(ynh_app_setting_get --app=$app --key=registration)
|
||||||
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
|
||||||
|
update=$(ynh_app_setting_get --app=$app --key=update)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -76,8 +77,14 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
|
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then
|
||||||
pushd "$final_path"
|
pushd "$final_path"
|
||||||
git fetch --tags
|
if [ $update -eq 1 ]
|
||||||
git checkout $latest_tag
|
then
|
||||||
|
git fetch --tags
|
||||||
|
git checkout $latest_tag
|
||||||
|
else
|
||||||
|
git fetch --tags
|
||||||
|
git checkout $tag
|
||||||
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
@ -97,7 +104,15 @@ 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/kevinpapst/kimai2.git $final_path
|
||||||
|
else
|
||||||
|
git clone -b $tag --depth 1 https://github.com/kevinpapst/kimai2.git $final_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Restore config
|
# Restore config
|
||||||
if [ -f $tmpdir/local.yaml ]; then
|
if [ -f $tmpdir/local.yaml ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue