1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streams_ynh.git synced 2024-09-03 20:26:20 +02:00

Add option to switch to dev branch

This commit is contained in:
dragondaddy 2023-11-13 15:39:55 +01:00
parent 76fbda57d9
commit 5d0b015461
2 changed files with 44 additions and 0 deletions

View file

@ -4,6 +4,18 @@ version = "1.0"
name.en = "Streams configuration"
name.fr = "Configuration de Streams"
[main.git_branch_mode]
name.en = "'dev' branch"
name.fr = "Branche 'dev'"
[main.git_branch_mode.git_branch_mode]
ask.en = "Switch to git 'dev' branch"
ask.fr = "Basculer sur la branche git 'dev'"
type = "boolean"
default = "0"
help.en = "Use at your own risk, if you know ewactly what you're doing."
help.fr = "À utiliser à vos risques et périls, si vous savez exactement ce que vous faîtes."
[main.php_fpm_config]
name.en = "PHP-FPM configuration"
name.fr = "Configuration de PHP-FPM"

View file

@ -22,6 +22,22 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__git_branch_mode() {
# Maintenance mode status
git_branch_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \
git branch --show-current)" 2> /dev/null
if echo $git_branch_mode_status | grep -q "release"
then
echo "0"
elif echo $git_branch_mode_status | grep -q "dev"
then
echo "1"
else
ynh_print_err --message="Not using \"release\" or \"dev\" branch, please handle this in command line"
exit 0
fi
}
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
@ -49,6 +65,22 @@ get__free_footprint() {
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__git_branch_mode() {
if [ "$git_branch_mode" -eq "0" ]; then
# If git_branch was set to 0, switch to "release" branch
(cd "$install_dir" && ynh_exec_as "$app" \
git checkout release)
ynh_print_info "Switching to \"release\" branch"
elif [ "$git_branch_mode" -eq "1" ]; then
# If git_branch was set to 1, switch to "dev" branch
(cd "$install_dir" && ynh_exec_as "$app" \
git checkout dev)
ynh_print_info "Switching to \"dev\" branch"
fi
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
}
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then