From eca3623baf30bf7a9192bc0ef84836c5b9961fd9 Mon Sep 17 00:00:00 2001 From: Limezy Date: Sun, 12 Jun 2022 14:20:25 +0700 Subject: [PATCH] Fix assets is existing --- scripts/install | 5 ++--- scripts/restore | 9 ++------- scripts/upgrade | 9 ++++----- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/scripts/install b/scripts/install index cdaf76e..8d39702 100755 --- a/scripts/install +++ b/scripts/install @@ -163,9 +163,8 @@ ynh_script_progression --message="Creating a data directory..." --time --weight= datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir -mkdir -p $datadir -mkdir "$datadir/assets/" -mv "$final_path/build/assets/"* "$datadir/assets/" +mkdir -p "$datadir/assets/" +mv -f "$final_path/build/assets/"* "$datadir/assets/" chmod 750 "$datadir" chmod -R o-rwx "$datadir" diff --git a/scripts/restore b/scripts/restore index c34fa67..ce0ee28 100755 --- a/scripts/restore +++ b/scripts/restore @@ -84,14 +84,9 @@ ynh_script_progression --message="Restoring the data directory..." --time --weig ynh_restore_file --origin_path="$datadir" --not_mandatory -mkdir -p $datadir +mkdir -p "$datadir/assets/" +mv -f "$final_path/build/assets/"* "$datadir/assets/" -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" diff --git a/scripts/upgrade b/scripts/upgrade index 639a28d..543153c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,8 +121,9 @@ pushd "$final_path" # Setup node environment export NODE_OPTIONS=--max_old_space_size=1024 # Build server from source - ynh_secure_remove --file="$final_path/build" - make all install DESTDIR=$final_path/build 2>&1 + ynh_use_nodejs + env "$ynh_node_load_PATH" npm install -g npm + env "$ynh_node_load_PATH" make dep-tensorflow dep-js dep-go build-js install DESTDIR=$final_path/build 2>&1 ynh_secure_remove --file="$final_path/go" popd @@ -131,9 +132,7 @@ popd #================================================= ynh_script_progression --message="Updating data directory..." --time --weight=1 -ynh_secure_remove --file="$datadir/assets" -mkdir "$datadir/assets/" -mv "$final_path/build/assets/"* "$datadir/assets/" +mv -f "$final_path/build/assets/"* "$datadir/assets/" chmod 750 "$datadir" chmod -R o-rwx "$datadir"