mirror of
https://github.com/YunoHost-Apps/penpot_ynh.git
synced 2024-09-03 19:56:56 +02:00
Upgrade?
This commit is contained in:
parent
f8572a3080
commit
23398539c4
2 changed files with 94 additions and 88 deletions
|
@ -113,7 +113,7 @@ chmod -R 700 $install_dir/backend
|
||||||
ynh_script_progression --message="Building exporter..." --weight=5
|
ynh_script_progression --message="Building exporter..." --weight=5
|
||||||
|
|
||||||
pushd $install_dir/build/exporter
|
pushd $install_dir/build/exporter
|
||||||
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH corepack prepare --activate
|
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH corepack prepare --activate
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --immutable
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --immutable
|
||||||
ynh_secure_remove --file="target"
|
ynh_secure_remove --file="target"
|
||||||
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME NODE_ENV=production clojure -M:dev:shadow-cljs release main
|
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME NODE_ENV=production clojure -M:dev:shadow-cljs release main
|
||||||
|
|
176
scripts/upgrade
176
scripts/upgrade
|
@ -36,116 +36,122 @@ ynh_use_nodejs
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_setup_source --dest_dir="$install_dir/jdk" --source_id="jdk"
|
ynh_setup_source --dest_dir="$install_dir/jdk" --source_id="jdk"
|
||||||
export JAVA_HOME=$install_dir/jdk
|
export JAVA_HOME=$install_dir/jdk
|
||||||
|
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
tmp_dir=$(mktemp -d)
|
tmp_dir=$(mktemp -d)
|
||||||
|
|
||||||
pushd $tmp_dir
|
pushd $tmp_dir
|
||||||
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
|
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
|
||||||
chmod +x linux-install.sh
|
chmod +x linux-install.sh
|
||||||
ynh_exec_warn_less ./linux-install.sh -p $install_dir/clojure
|
ynh_exec_warn_less ./linux-install.sh -p $install_dir/clojure
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_secure_remove --file=$tmp_dir
|
ynh_secure_remove --file=$tmp_dir
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir/babashka" --source_id="babashka"
|
ynh_setup_source --dest_dir="$install_dir/babashka" --source_id="babashka"
|
||||||
|
|
||||||
export PATH=$JAVA_HOME/bin:$install_dir/clojure/bin:$install_dir/babashka:$PATH
|
export PATH=$JAVA_HOME/bin:$install_dir/clojure/bin:$install_dir/babashka:$PATH
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir/build"
|
ynh_setup_source --dest_dir="$install_dir/build"
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
ynh_script_progression --message="Building frontend..." --weight=5
|
ynh_script_progression --message="Building frontend..." --weight=5
|
||||||
|
|
||||||
pushd $install_dir/build/frontend
|
pushd $install_dir/build/frontend
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --pure-lockfile
|
ynh_exec_warn_less env $ynh_node_load_PATH COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack enable
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack enable
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack prepare --activate
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn install --immutable
|
||||||
|
|
||||||
# ynh_exec_warn_less
|
# ynh_exec_warn_less
|
||||||
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME clojure -J-Xms100M -J-Xmx800M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main --config-merge "{:release-version \"${current_hash}\"}"
|
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME NODE_ENV=production clojure -J-Xms100M -J-Xmx800M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main --config-merge "{:release-version \"${current_hash}\"}"
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp build:assets
|
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp build:styles
|
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp clean:dist
|
|
||||||
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm exec gulp build:copy
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/frontend/target/dist/index.html"
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production yarn run compile
|
||||||
ynh_replace_string --match_string="%buildDate%" --replace_string="$build_date" --target_file="$install_dir/build/frontend/target/dist/index.html"
|
|
||||||
echo "$version" > target/version.txt;
|
|
||||||
popd
|
|
||||||
|
|
||||||
ynh_secure_remove --file=$install_dir/frontend
|
ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/frontend/resources/public/index.html"
|
||||||
mkdir -p $install_dir/frontend
|
ynh_replace_string --match_string="%buildDate%" --replace_string="$build_date" --target_file="$install_dir/build/frontend/resources/public/index.html"
|
||||||
mv $install_dir/build/frontend/target/dist/* $install_dir/frontend
|
popd
|
||||||
chown -R $app:www-data $install_dir/frontend
|
|
||||||
chmod -R 755 $install_dir/frontend
|
|
||||||
|
|
||||||
ynh_script_progression --message="Building backend..." --weight=5
|
ynh_secure_remove --file=$install_dir/frontend
|
||||||
|
mkdir -p $install_dir/frontend
|
||||||
|
mv $install_dir/build/frontend/target/dist/* $install_dir/frontend
|
||||||
|
chown -R $app:www-data $install_dir/frontend
|
||||||
|
chmod -R 755 $install_dir/frontend
|
||||||
|
|
||||||
pushd $install_dir/build/backend
|
ynh_script_progression --message="Building backend..." --weight=5
|
||||||
mkdir -p target/classes;
|
|
||||||
mkdir -p target/dist;
|
|
||||||
echo "$version" > target/classes/version.txt;
|
|
||||||
chown -R $app:$app target
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME clojure -T:build jar;
|
pushd $install_dir/build/backend
|
||||||
mv target/penpot.jar target/dist/penpot.jar
|
mkdir -p target/classes;
|
||||||
cp resources/log4j2.xml target/dist/log4j2.xml
|
mkdir -p target/dist;
|
||||||
cp scripts/run.template.sh target/dist/run.sh
|
echo "$version" > target/classes/version.txt;
|
||||||
chmod +x target/dist/run.sh;
|
cp ../CHANGES.md target/classes/changelog.md;
|
||||||
|
chown -R $app:$app target
|
||||||
|
|
||||||
# Prefetch templates
|
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME clojure -T:build jar;
|
||||||
mkdir builtin-templates;
|
mv target/penpot.jar target/dist/penpot.jar
|
||||||
bb ./scripts/prefetch-templates.clj resources/app/onboarding.edn builtin-templates/
|
cp resources/log4j2.xml target/dist/log4j2.xml
|
||||||
cp -r builtin-templates target/dist/
|
cp scripts/run.template.sh target/dist/run.sh
|
||||||
popd
|
chmod +x target/dist/run.sh;
|
||||||
|
|
||||||
ynh_secure_remove --file=$install_dir/backend
|
# Prefetch templates
|
||||||
mkdir -p $install_dir/backend
|
mkdir builtin-templates;
|
||||||
mv $install_dir/build/backend/target/dist/* $install_dir/backend
|
bb ./scripts/prefetch-templates.clj resources/app/onboarding.edn builtin-templates/
|
||||||
chown -R $app:$app $install_dir/backend
|
cp -r builtin-templates target/dist/
|
||||||
chmod -R 700 $install_dir/backend
|
popd
|
||||||
|
|
||||||
ynh_script_progression --message="Building exporter..." --weight=5
|
ynh_secure_remove --file=$install_dir/backend
|
||||||
|
mkdir -p $install_dir/backend
|
||||||
|
mv $install_dir/build/backend/target/dist/* $install_dir/backend
|
||||||
|
chown -R $app:$app $install_dir/backend
|
||||||
|
chmod -R 700 $install_dir/backend
|
||||||
|
|
||||||
pushd $install_dir/build/exporter
|
ynh_script_progression --message="Building exporter..." --weight=5
|
||||||
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME NODE_ENV=production clojure -M:dev:shadow-cljs release main
|
|
||||||
cp yarn.lock target/
|
|
||||||
cp package.json target/
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/exporter/target/app.js"
|
pushd $install_dir/build/exporter
|
||||||
popd
|
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH corepack prepare --activate
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --immutable
|
||||||
|
ynh_secure_remove --file="target"
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env PATH=$PATH JAVA_HOME=$JAVA_HOME NODE_ENV=production clojure -M:dev:shadow-cljs release main
|
||||||
|
cp yarn.lock target/
|
||||||
|
cp package.json target/
|
||||||
|
|
||||||
ynh_secure_remove --file=$install_dir/exporter
|
ynh_replace_string --match_string="%version%" --replace_string="$version" --target_file="$install_dir/build/exporter/target/app.js"
|
||||||
mkdir -p $install_dir/exporter
|
popd
|
||||||
mv $install_dir/build/exporter/target/* $install_dir/exporter
|
|
||||||
chown -R $app:$app $install_dir/exporter
|
|
||||||
chmod -R 700 $install_dir/exporter
|
|
||||||
|
|
||||||
ynh_secure_remove --file=$install_dir/.cache
|
ynh_secure_remove --file=$install_dir/exporter
|
||||||
|
mkdir -p $install_dir/exporter
|
||||||
|
mv $install_dir/build/exporter/target/* $install_dir/exporter
|
||||||
|
cp $install_dir/build/.yarnrc.yml $install_dir/exporter
|
||||||
|
chown -R $app:$app $install_dir/exporter
|
||||||
|
chmod -R 700 $install_dir/exporter
|
||||||
|
|
||||||
pushd $install_dir/exporter
|
ynh_secure_remove --file=$install_dir/.cache
|
||||||
ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production yarn install --pure-lockfile
|
|
||||||
ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production yarn --network-timeout 1000000 run playwright install chromium
|
|
||||||
popd
|
|
||||||
|
|
||||||
ynh_script_progression --message="Cleaning up..." --weight=1
|
pushd $install_dir/exporter
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH corepack prepare --activate
|
||||||
|
ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production yarn install --immutable
|
||||||
|
ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production yarn --network-timeout 1000000 run playwright install chromium
|
||||||
|
popd
|
||||||
|
|
||||||
ynh_secure_remove --file=$install_dir/.npm
|
ynh_script_progression --message="Cleaning up..." --weight=1
|
||||||
ynh_secure_remove --file=$install_dir/.yarn
|
|
||||||
ynh_secure_remove --file=$install_dir/build
|
ynh_secure_remove --file=$install_dir/.npm
|
||||||
ynh_secure_remove --file=$install_dir/.m2
|
ynh_secure_remove --file=$install_dir/.yarn
|
||||||
ynh_secure_remove --file=$install_dir/.clojure
|
ynh_secure_remove --file=$install_dir/build
|
||||||
ynh_secure_remove --file=$install_dir/clojure
|
ynh_secure_remove --file=$install_dir/.m2
|
||||||
ynh_secure_remove --file=$install_dir/babashka
|
ynh_secure_remove --file=$install_dir/.clojure
|
||||||
ynh_secure_remove --file=$install_dir/.cache/ms-playwright/firefox-*
|
ynh_secure_remove --file=$install_dir/clojure
|
||||||
ynh_secure_remove --file=$install_dir/.cache/ms-playwright/webkit-*
|
ynh_secure_remove --file=$install_dir/babashka
|
||||||
ynh_secure_remove --file=$install_dir/.cache/yarn
|
ynh_secure_remove --file=$install_dir/.cache/ms-playwright/firefox-*
|
||||||
ynh_secure_remove --file=$install_dir/.cache/node
|
ynh_secure_remove --file=$install_dir/.cache/ms-playwright/webkit-*
|
||||||
|
ynh_secure_remove --file=$install_dir/.cache/yarn
|
||||||
|
ynh_secure_remove --file=$install_dir/.cache/node
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue