1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00
This commit is contained in:
ericgaspar 2021-07-23 23:44:47 +02:00
parent ed93512478
commit 36362dd4c6
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 18 additions and 57 deletions

View file

@ -49,7 +49,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url 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=admin --value=$admin
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 ynh_app_setting_set --app=$app --key=update --value=$update
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -87,15 +87,11 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Cloning Firefly-iii..." 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
# Download, check integrity, uncompress and patch the source from app.src
git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"

View file

@ -79,14 +79,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -95,56 +87,29 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
then
pushd "$final_path"
if [ $update -eq 1 ]
then
git fetch origin tag $latest_tag --no-tags
git checkout $latest_tag
else
git fetch origin tag $tag --no-tags
git checkout $tag
fi
ynh_secure_remove bootstrap/cache/*
ynh_secure_remove vendor/
popd
else
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory # Create a temporary directory
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir # Backup the config file in the temp dir
mkdir -p "$tmpdir/storage/upload" mkdir -p "$tmpdir/upload"
mkdir -p "$tmpdir/storage/export" mkdir -p "$tmpdir/export"
mkdir -p "$final_path/storage/upload/" cp -aT "$final_path/storage/upload" "$tmpdir/upload"
mkdir -p "$final_path/storage/export/" cp -aT "$final_path/storage/export" "$tmpdir/export"
cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$"
cp -a "$final_path/.env" "$tmpdir/.env" cp -a "$final_path/.env" "$tmpdir/.env"
cp -aT "$final_path/storage/export" "$tmpdir/storage/export/"
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
ynh_setup_source --dest_dir="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
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/* ynh_secure_remove bootstrap/cache/*
# Restore the config file and data # Restore the config file and data
mkdir -p "$final_path/storage/upload/" mkdir -p "$final_path/storage/upload"
mkdir -p "$final_path/storage/export/" mkdir -p "$final_path/storage/export"
cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload" cp -aT "$tmpdir/upload" "$final_path/storage/upload"
cp -aT "$tmpdir/storage/export" "$final_path/storage/export" cp -aT "$tmpdir/export" "$final_path/storage/export"
cp -a "$tmpdir/.env" "$final_path/.env" cp -a "$tmpdir/.env" "$final_path/.env"
# Remove temporary directory # Remove temporary directory
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
fi
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -189,12 +154,12 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." # ynh_script_progression --message="Modifying a config file..."
ynh_add_config --template="../conf/.env" --destination="$final_path/.env" # ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
chmod 400 "$final_path/.env" # chmod 400 "$final_path/.env"
chown $app "$final_path/.env" # chown $app "$final_path/.env"
#================================================= #=================================================
# DEPLOYMENT # DEPLOYMENT