diff --git a/scripts/install b/scripts/install index 8078c47..17502c4 100755 --- a/scripts/install +++ b/scripts/install @@ -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=admin --value=$admin 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 @@ -87,15 +87,11 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # 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 - -git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path - -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index fad730b..9720bb7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,14 +79,6 @@ 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" -#================================================= -# 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 #================================================= @@ -95,56 +87,29 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] 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..." # Create a temporary directory tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - mkdir -p "$tmpdir/storage/upload" - mkdir -p "$tmpdir/storage/export" - mkdir -p "$final_path/storage/upload/" - mkdir -p "$final_path/storage/export/" - cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$" + mkdir -p "$tmpdir/upload" + mkdir -p "$tmpdir/export" + cp -aT "$final_path/storage/upload" "$tmpdir/upload" + cp -aT "$final_path/storage/export" "$tmpdir/export" cp -a "$final_path/.env" "$tmpdir/.env" - cp -aT "$final_path/storage/export" "$tmpdir/storage/export/" + ynh_secure_remove --file="$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_setup_source --dest_dir="$final_path" ynh_secure_remove bootstrap/cache/* # Restore the config file and data - mkdir -p "$final_path/storage/upload/" - mkdir -p "$final_path/storage/export/" - cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload" - cp -aT "$tmpdir/storage/export" "$final_path/storage/export" + mkdir -p "$final_path/storage/upload" + mkdir -p "$final_path/storage/export" + cp -aT "$tmpdir/upload" "$final_path/storage/upload" + cp -aT "$tmpdir/export" "$final_path/storage/export" cp -a "$tmpdir/.env" "$final_path/.env" # Remove temporary directory ynh_secure_remove --file="$tmpdir" - fi fi chmod 750 "$final_path" @@ -189,12 +154,12 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f #================================================= # 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" -chown $app "$final_path/.env" +# chmod 400 "$final_path/.env" +# chown $app "$final_path/.env" #================================================= # DEPLOYMENT