mirror of
https://github.com/YunoHost-Apps/firefly-iii_ynh.git
synced 2024-09-03 18:36:13 +02:00
Merge pull request #19 from dr41nU/master
Bump to version 5.2.0 & restore/backup/upgrade fixes
This commit is contained in:
commit
ec6716e3f3
8 changed files with 94 additions and 102 deletions
|
@ -1,6 +1,6 @@
|
|||
<p align="center"><img src="https://firefly-iii.org/static/img/logo-small-new.png"></p>
|
||||
|
||||
# Firefly III v5.1.0 for YunoHost
|
||||
# Firefly III v5.2.0 for YunoHost
|
||||
|
||||
[](https://ci-apps.yunohost.org/jenkins/job/firefly-iii%20%28Community%29/lastBuild/consoleFull)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/5.1.0.tar.gz
|
||||
SOURCE_SUM=3e20da603780f218fbd0b1354ad975fb2f7af37b216a015b1c3a4a1783a06233
|
||||
SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/5.2.0.tar.gz
|
||||
SOURCE_SUM=136ddb92167a63e0eeafc91c18d12285e28533f18441b80a683d69cb1ea05115
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=firefly-iii-5.1.0.tar.gz
|
||||
SOURCE_FILENAME=firefly-iii-5.2.0.tar.gz
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Firefly III is a self-hosted financial manager.",
|
||||
"fr": "Firefly III est un gestionnaire de finances personnelles."
|
||||
},
|
||||
"version": "5.1.0",
|
||||
"version": "5.2.0",
|
||||
"url": "https://firefly-iii.org/",
|
||||
"license": "GPL v3",
|
||||
"maintainer": {
|
||||
|
|
|
@ -38,34 +38,6 @@ exec_as() {
|
|||
# Composer helpers
|
||||
#
|
||||
|
||||
# Execute a composer command from a given directory
|
||||
# usage: composer_exec AS_USER WORKDIR COMMAND [ARG ...]
|
||||
exec_composer() {
|
||||
local WORKDIR=$1
|
||||
shift 1
|
||||
|
||||
COMPOSER_HOME="${WORKDIR}/.composer" \
|
||||
# sudo /usr/bin/php7.2 "${WORKDIR}/composer.phar" $@ \
|
||||
/usr/bin/php7.2 "${WORKDIR}/composer.phar" $@ \
|
||||
-d "${WORKDIR}" --no-interaction
|
||||
}
|
||||
|
||||
# Install and initialize Composer in the given directory
|
||||
# usage: init_composer DESTDIR [AS_USER]
|
||||
init_composer() {
|
||||
local DESTDIR=$1
|
||||
local AS_USER=${2:-admin}
|
||||
|
||||
# install composer
|
||||
curl -sS https://getcomposer.org/installer \
|
||||
| COMPOSER_HOME="${DESTDIR}/.composer" \
|
||||
sudo /usr/bin/php7.2 -- --quiet --install-dir="$DESTDIR" \
|
||||
|| ynh_die "Unable to install Composer"
|
||||
|
||||
# update dependencies to create composer.lock
|
||||
exec_composer "$DESTDIR" install --no-dev --prefer-dist --no-scripts \
|
||||
|| ynh_die "Unable to update firefly-iii core dependencies"
|
||||
}
|
||||
|
||||
sudo_path () {
|
||||
sudo env "PATH=$PATH" $@
|
||||
|
|
|
@ -11,9 +11,14 @@ if [ ! -e _common.sh ]; then
|
|||
cp ../settings/scripts/_common.sh ./_common.sh
|
||||
chmod a+rx _common.sh
|
||||
fi
|
||||
|
||||
source _common.sh
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source ynh_install_php__3
|
||||
source ynh_composer
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
|
|
@ -48,7 +48,6 @@ ynh_script_progression --message="Validating installation parameters..." --time
|
|||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
#mkdir $final_path
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -143,9 +142,9 @@ ynh_replace_string "yunoappurl" "$domain$path_url" "$final_path/.env"
|
|||
|
||||
#init_composer $final_path $app
|
||||
|
||||
cd $final_path && php$phpversion artisan migrate:refresh --seed
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database
|
||||
cd $final_path && php$phpversion artisan passport:install
|
||||
cd $final_path && php$phpversion artisan migrate:refresh --seed && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan passport:install && cd $YNH_CWD
|
||||
|
||||
|
||||
#=================================================
|
||||
|
@ -215,7 +214,7 @@ ynh_use_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php7.3-fpm --action=reload
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,12 @@ if [ ! -e _common.sh ]; then
|
|||
fi
|
||||
|
||||
source _common.sh
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source ynh_install_php__3
|
||||
source ynh_composer
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
@ -116,12 +120,27 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
init_composer $final_path
|
||||
cd $final_path && sudo /usr/bin/php$phpversion artisan migrate --env=production --force
|
||||
cd $final_path && sudo /usr/bin/php$phpversion artisan cache:clear
|
||||
cd $final_path && sudo /usr/bin/php$phpversion artisan firefly:upgrade-database
|
||||
cd $final_path && sudo /usr/bin/php$phpversion artisan firefly:verify
|
||||
cd $final_path && sudo /usr/bin/php$phpversion artisan passport:install
|
||||
|
||||
# Install via composer
|
||||
ynh_install_composer --phpversion="$phpversion"
|
||||
|
||||
#cd $final_path && sudo /usr/bin/php$phpversion artisan migrate --env=production --force
|
||||
#cd $final_path && sudo /usr/bin/php$phpversion artisan cache:clear
|
||||
#cd $final_path && sudo /usr/bin/php$phpversion artisan firefly:upgrade-database
|
||||
#cd $final_path && sudo /usr/bin/php$phpversion artisan firefly:verify
|
||||
#cd $final_path && sudo /usr/bin/php$phpversion artisan passport:install
|
||||
|
||||
cd $final_path && php$phpversion artisan migrate:refresh --seed && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan passport:install && cd $YNH_CWD
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
# Set right permissions
|
||||
chown -R $app:$app $final_path
|
||||
chmod -R 775 ${final_path}/storage
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
113
scripts/upgrade
113
scripts/upgrade
|
@ -81,6 +81,13 @@ ynh_abort_if_errors
|
|||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||
ynh_install_php --phpversion="$phpversion" --package="$pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -99,25 +106,61 @@ rm -Rf "$final_path"
|
|||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
||||
# Install via composer
|
||||
ynh_install_composer --phpversion="$phpversion"
|
||||
cd $final_path && php$phpversion artisan migrate:refresh --seed
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database
|
||||
cd $final_path && php$phpversion artisan passport:install
|
||||
|
||||
# create a user
|
||||
email=$(ynh_user_get_info $admin 'mail')
|
||||
|
||||
rm -rf "$final_path/bootstrap/cache/*"
|
||||
# setup application config
|
||||
sudo cp ../conf/.env $final_path/.env
|
||||
|
||||
cd $final_path && php$phpversion artisan cache:clear
|
||||
cd $final_path && php$phpversion artisan migrate --seed
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database
|
||||
cd $final_path && php$phpversion artisan passport:install
|
||||
cd $final_path && php$phpversion artisan cache:clear
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
||||
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||
ynh_replace_string "yunoappurl" "$domain$path_url" "$final_path/.env"
|
||||
|
||||
#Run artisan stuff
|
||||
|
||||
cd $final_path && php$phpversion artisan migrate:refresh --seed && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan firefly-iii:upgrade-database && cd $YNH_CWD
|
||||
cd $final_path && php$phpversion artisan passport:install && cd $YNH_CWD
|
||||
|
||||
#rm -rf "$final_path/bootstrap/cache/*"
|
||||
|
||||
#cd $final_path && php$phpversion artisan cache:clear
|
||||
#cd $final_path && php$phpversion artisan migrate --seed
|
||||
#cd $final_path && php$phpversion artisan firefly-iii:upgrade-database
|
||||
#cd $final_path && php$phpversion artisan passport:install
|
||||
#cd $final_path && php$phpversion artisan cache:clear
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/.env"
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/.env"
|
||||
|
||||
cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/"
|
||||
cp -a "$tmpdir/storage/export/" "$final_path/storage/export/"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set right permissions
|
||||
chown -R $app:$app $final_path
|
||||
chown -R $app: $final_path
|
||||
chmod -R 775 ${final_path}/storage
|
||||
|
||||
#remove tmp dir
|
||||
|
@ -131,13 +174,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." -
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -152,7 +188,7 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion=7.2
|
||||
ynh_add_fpm_config --phpversion="$phpversion"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
|
@ -172,45 +208,6 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --time -
|
|||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# Get the admin email
|
||||
email=$(ynh_user_get_info --username=$admin --key='mail')
|
||||
|
||||
# setup application config
|
||||
sudo cp ../conf/.env $final_path/.env
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_replace_string --match_string"random_key" --replace_string="$random_key" --file="$final_path/.env"
|
||||
ynh_replace_string --match_string"yunouser" --replace_string="$db_name" --file="$final_path/.env"
|
||||
ynh_replace_string --match_string"yunopass" --replace_string="$db_pwd" --file="$final_path/.env"
|
||||
ynh_replace_string --match_string"yunobase" --replace_string="$db_name" --file="$final_path/.env"
|
||||
ynh_replace_string --match_string"yunomail" --replace_string="$email" --file="$final_path/.env"
|
||||
ynh_replace_string --match_string"yunodomain" --replace_string="$domain" --file="$final_path/.env"
|
||||
|
||||
init_composer $final_path
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan migrate --env=production --force
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan cache:clear
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan firefly:upgrade-database
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan firefly:verify
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan passport:install
|
||||
|
||||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/.env"
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set right permissions
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -228,8 +225,8 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=php7.2-fpm --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue