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

git checkout without ynh_exec_as

This commit is contained in:
dragondaddy 2023-11-14 03:22:02 +01:00
parent 65f81e2276
commit 07c4ed1a8c

View file

@ -24,8 +24,7 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
get__git_branch_mode() { get__git_branch_mode() {
# Maintenance mode status # Maintenance mode status
git_branch_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \ git_branch_mode_status="$(cd "$install_dir" && git branch --show-current)" 2> /dev/null
git branch --show-current)" 2> /dev/null
if echo $git_branch_mode_status | grep -q "release" if echo $git_branch_mode_status | grep -q "release"
then then
echo "0" echo "0"
@ -69,13 +68,11 @@ get__free_footprint() {
set__git_branch_mode() { set__git_branch_mode() {
if [ "$git_branch_mode" -eq "0" ]; then if [ "$git_branch_mode" -eq "0" ]; then
# If git_branch was set to 0, switch to "release" branch # If git_branch was set to 0, switch to "release" branch
(cd "$install_dir" && ynh_exec_as "$app" \ (cd "$install_dir" && git checkout release)
git checkout release)
ynh_print_info "Switching to \"release\" branch" ynh_print_info "Switching to \"release\" branch"
elif [ "$git_branch_mode" -eq "1" ]; then elif [ "$git_branch_mode" -eq "1" ]; then
# If git_branch was set to 1, switch to "dev" branch # If git_branch was set to 1, switch to "dev" branch
(cd "$install_dir" && ynh_exec_as "$app" \ (cd "$install_dir" && git checkout dev)
git checkout dev)
ynh_print_info "Switching to \"dev\" branch" ynh_print_info "Switching to \"dev\" branch"
fi fi
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode" ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"