mirror of
https://github.com/YunoHost-Apps/streams_ynh.git
synced 2024-09-03 20:26:20 +02:00
commit
0ad1d729c5
4 changed files with 29 additions and 5 deletions
|
@ -5,7 +5,7 @@ name = "Streams"
|
|||
description.en = "Open source fediverse server"
|
||||
description.fr = "Serveur fediverse open source"
|
||||
|
||||
version = "24.02.18~ynh1"
|
||||
version = "24.02.18~ynh2"
|
||||
|
||||
maintainers = ["Papa Dragon"]
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
|||
|
||||
get__git_branch_mode() {
|
||||
# Git branch mode status
|
||||
git_branch_mode_status="$(cd "$install_dir" && git branch --show-current)" 2> /dev/null
|
||||
git_branch_mode_status="$(cd "$install_dir" && sudo -u $app git branch --show-current)" 2> /dev/null
|
||||
if echo $git_branch_mode_status | grep -q "release"
|
||||
then
|
||||
echo "0"
|
||||
|
|
|
@ -19,6 +19,7 @@ random_string="$(ynh_string_random --length=48)"
|
|||
fpm_footprint="medium"
|
||||
fpm_free_footprint=0
|
||||
fpm_usage="medium"
|
||||
git_branch_mode="0"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
|
@ -31,6 +32,7 @@ ynh_app_setting_set --app=$app --key=random_string --value=$random_string
|
|||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
|
||||
|
||||
#=================================================
|
||||
# CREATE A DATABASE
|
||||
|
@ -51,7 +53,7 @@ chown -R $app:www-data "$install_dir"
|
|||
git config --system --add safe.directory $install_dir
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from GitHub
|
||||
git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
|
||||
ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
|
||||
|
||||
touch "$install_dir/php.log"
|
||||
mkdir -p "$install_dir/store"
|
||||
|
|
|
@ -47,13 +47,28 @@ if [ -z "$fpm_usage" ]; then
|
|||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||
fi
|
||||
|
||||
# Make sure that git_branch_mode exists with relevant value
|
||||
git_branch_mode_status="$(cd "$install_dir" && sudo -u $app git branch --show-current)" 2> /dev/null
|
||||
if echo $git_branch_mode_status | grep -q "release"
|
||||
then
|
||||
git_branch_mode="0"
|
||||
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
|
||||
elif echo $git_branch_mode_status | grep -q "dev"
|
||||
then
|
||||
git_branch_mode="1"
|
||||
ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode"
|
||||
else
|
||||
ynh_print_err --message="You need to use \"release\" or \"dev\" branch, please handle this in command line"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# First we save what we need to keep
|
||||
mv $install_dir/store $data_dir/
|
||||
|
@ -69,7 +84,14 @@ then
|
|||
|
||||
git config --system --add safe.directory $install_dir
|
||||
|
||||
git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
|
||||
ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
|
||||
|
||||
ynh_app_setting_get --app=$app --key=git_branch_mode
|
||||
if [[ -n $git_branch_mode ]] && [ "$git_branch_mode" -eq "1" ]
|
||||
then
|
||||
ynh_print_info "Switching to \"dev\" branch"
|
||||
(cd "$install_dir" && ynh_exec_as $app git checkout dev)
|
||||
fi
|
||||
|
||||
# We restore what we previously saved
|
||||
mv $data_dir/store $install_dir/
|
||||
|
|
Loading…
Add table
Reference in a new issue