mirror of
https://github.com/YunoHost-Apps/zwave-js-ui_ynh.git
synced 2024-09-03 18:06:00 +02:00
Merge pull request #60 from YunoHost-Apps/testing
Use precompiled binaries
This commit is contained in:
commit
9c9ba23d73
15 changed files with 36 additions and 447 deletions
132
.github/workflows/updater.sh
vendored
132
.github/workflows/updater.sh
vendored
|
@ -1,132 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
#Installing tomlq
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip3 install tomlq
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.toml | tomlq -j '.version|split("~")[0]')
|
||||
repo=$(cat manifest.toml | tomlq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").zipball_url ] | join(" ") | @sh' | tr -d "'"))
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||
version=${version:1}
|
||||
fi
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
rm -rf ./venv
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
rm -rf ./venv
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# Leave $src empty to ignore the asset
|
||||
#case $asset_url in
|
||||
# *"Source"*)
|
||||
# src="app"
|
||||
# ;;
|
||||
# *)
|
||||
# src=""
|
||||
# ;;
|
||||
#esac
|
||||
#There should be only one asset in the zipball directory and it is a zip file
|
||||
src="app"
|
||||
extension="zip"
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
# Download sources and calculate checksum
|
||||
filename=${asset_url##*/}
|
||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||
|
||||
# Delete temporary directory
|
||||
rm -rf $tempdir
|
||||
|
||||
# Get extension
|
||||
#if [[ $filename == *.tar.gz ]]; then
|
||||
# extension=tar.gz
|
||||
#else
|
||||
# extension=${filename##*.}
|
||||
#fi
|
||||
|
||||
# Rewrite source file
|
||||
cat <<EOT > conf/$src.src
|
||||
SOURCE_URL=$asset_url
|
||||
SOURCE_SUM=$checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_EXTRACT=true
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
sed -i "s/^version\s*=.*/version = \"$version~ynh1\"/" manifest.toml
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
#remove the venv folder
|
||||
rm -rf ./venv
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
50
.github/workflows/updater.yml
vendored
50
.github/workflows/updater.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
[See upstream release page](https://github.com/${{ env.REPO }}/releases/tag/v${{ env.VERSION }})
|
||||
draft: false
|
|
@ -31,10 +31,8 @@ To work correctly, this app require to install either
|
|||
For now, although the package is fully functional (install, remove, backup, restore...), it is not integrated with domoticz and mosquitto package, this means that all settings needs to be done manually from inside the app.
|
||||
|
||||
|
||||
During install, the whole app need to be recompile using yarn, this lead to long installation time. Also, a temporary swap file will be created if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk.
|
||||
|
||||
|
||||
**Shipped version:** 8.15.0~ynh1
|
||||
**Shipped version:** 8.15.0~ynh2
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://zwave-js.github.io/zwave-js-ui/#/>
|
||||
|
|
|
@ -30,9 +30,8 @@ Pour fonctionner correctement, cette application nécessite d'avoir installé so
|
|||
|
||||
Pour l'instant, bien que le package fonctionne (installation, désinstallation, sauvegarde, restauration...), il n'est pas intégré avec domoticz et mosquitto, les paramétrages doivent être fait manuellement depuis l'application.
|
||||
|
||||
Pendant l'installation, la totalité de l'application doit être recompilé en utilisant yarn : cela amène à des temps d'installation très long. Un fichier de swap temporaire sera créé si moins de 2Go de mémoire sont disponibles (RAM + swap): Assurez vous d'avoir suffisament d'espace disque.
|
||||
|
||||
**Version incluse :** 8.15.0~ynh1
|
||||
**Version incluse :** 8.15.0~ynh2
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://zwave-js.github.io/zwave-js-ui/#/>
|
||||
|
|
|
@ -6,10 +6,8 @@ After=network.target
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
#Environment not working, don't know why, have to add env command to ExecStart, if you know a better way, don't hesitate to make a PR
|
||||
#Environment="__YNH_NODE_LOAD_PATH__"
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=env __YNH_NODE_LOAD_PATH__ yarn start
|
||||
ExecStart=__INSTALL_DIR__/__FILE_EXEC__
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
|
||||
|
|
|
@ -12,5 +12,3 @@ To work correctly, this app require to install either
|
|||
|
||||
For now, although the package is fully functional (install, remove, backup, restore...), it is not integrated with domoticz and mosquitto package, this means that all settings needs to be done manually from inside the app.
|
||||
|
||||
|
||||
During install, the whole app need to be recompile using yarn, this lead to long installation time. Also, a temporary swap file will be created if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk.
|
||||
|
|
|
@ -11,5 +11,3 @@ Pour fonctionner correctement, cette application nécessite d'avoir installé so
|
|||
|
||||
|
||||
Pour l'instant, bien que le package fonctionne (installation, désinstallation, sauvegarde, restauration...), il n'est pas intégré avec domoticz et mosquitto, les paramétrages doivent être fait manuellement depuis l'application.
|
||||
|
||||
Pendant l'installation, la totalité de l'application doit être recompilé en utilisant yarn : cela amène à des temps d'installation très long. Un fichier de swap temporaire sera créé si moins de 2Go de mémoire sont disponibles (RAM + swap): Assurez vous d'avoir suffisament d'espace disque.
|
|
@ -1,6 +1,3 @@
|
|||
Beware!
|
||||
A temporary swap file will be created during install if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk!
|
||||
|
||||
To work correctly, this app require to install either
|
||||
- [domoticz package](https://github.com/YunoHost-Apps/domoticz_ynh) with **mqtt broker Mosquitto**
|
||||
- [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
|
|
@ -1,6 +1,3 @@
|
|||
Attention!
|
||||
Un fichier de swap temporaire sera créé durant l'installation si moins de 2Go de mémoire (RAM+Swap) sont disponibles : Assurez vous d'avoir assez d'espace disque!
|
||||
|
||||
Pour fonctionner correctement, cette application nécessite d'avoir installé soit:
|
||||
- le package [domoticz](https://github.com/YunoHost-Apps/domoticz_ynh) avec le **broker MQTT mosquitto**
|
||||
- le package [Home-Assistant](https://github.com/YunoHost-Apps/homeassistant_ynh)
|
|
@ -5,7 +5,7 @@ name = "Zwave-JS-UI"
|
|||
description.en = "Full featured Z-Wave Control Panel and MQTT Gateway integrated with domoticz"
|
||||
description.fr = "Panneau de controle Z-Wave et MQTT intégré avec Domoticz"
|
||||
|
||||
version = "8.15.0~ynh1"
|
||||
version = "8.15.0~ynh2"
|
||||
|
||||
maintainers = ["Krakinou"]
|
||||
|
||||
|
@ -18,14 +18,14 @@ code = "https://github.com/zwave-js/zwave-js-ui"
|
|||
fund = "https://liberapay.com/robertsLando/donate"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.11"
|
||||
architectures = "all"
|
||||
yunohost = ">= 11.1.18"
|
||||
architectures = [ "amd64", "armhf", "arm64" ]
|
||||
multi_instance = false
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "650M"
|
||||
ram.build = "2G"
|
||||
ram.runtime = "100M"
|
||||
disk = "350M"
|
||||
ram.build = "200M"
|
||||
ram.runtime = "150M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
|
@ -42,6 +42,22 @@ ram.runtime = "100M"
|
|||
default = "all_users"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
arm64.url = "https://github.com/zwave-js/zwave-js-ui/releases/download/v8.15.0/zwave-js-ui-v8.15.0-linux-arm64.zip"
|
||||
arm64.sha256 = "092c538cb865d1591fc2c46cc08ad7aff57847ac14f396067e9e1339f4d5b344"
|
||||
armhf.url = "https://github.com/zwave-js/zwave-js-ui/releases/download/v8.15.0/zwave-js-ui-v8.15.0-linux-armv7.zip"
|
||||
armhf.sha256 = "6fddd163a8158e8d8ff42a604cc563b77d6893ad698c3a70ed4c43dc8444b6ae"
|
||||
amd64.url = "https://github.com/zwave-js/zwave-js-ui/releases/download/v8.15.0/zwave-js-ui-v8.15.0-linux.zip"
|
||||
amd64.sha256 = "a479b01abcd1d597806918e0b2d31466306cca7c8a87af1dc9e3fcc08750dc1c"
|
||||
format="zip"
|
||||
in_subdir=false
|
||||
extract=true
|
||||
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
|
||||
autoupdate.asset.arm64 = "*-arm64.zip"
|
||||
autoupdate.asset.amd64 = "*-linux.zip"
|
||||
autoupdate.asset.armhf = "*-armv7.zip"
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
MEMORY_NEEDED="2048"
|
||||
NODEJS_VERSION=18
|
||||
|
||||
if [[ "$YNH_ARCH" == "armhf" ]] || [[ "$YNH_ARCH" == "arm64" ]]
|
||||
then
|
||||
file_exec="zwave-js-ui"
|
||||
else
|
||||
file_exec="zwave-js-ui-linux"
|
||||
fi
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
@ -14,99 +17,6 @@ NODEJS_VERSION=18
|
|||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Add swap
|
||||
#
|
||||
# usage: ynh_add_swap --size=SWAP in Mb
|
||||
# | arg: -s, --size= - Amount of SWAP to add in Mb.
|
||||
ynh_add_swap () {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [s]=size= )
|
||||
local size
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
local swap_max_size=$(( $size * 1024 ))
|
||||
|
||||
local free_space=$(df --output=avail / | sed 1d)
|
||||
# Because we don't want to fill the disk with a swap file, divide by 2 the available space.
|
||||
local usable_space=$(( $free_space / 2 ))
|
||||
|
||||
SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0}
|
||||
|
||||
# Swap on SD card only if it's is specified
|
||||
if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ]
|
||||
then
|
||||
ynh_print_warn --message="The main mountpoint of your system '/' is on an SD card, swap will not be added to prevent some damage of this one, but that can cause troubles for the app $app. If you still want activate the swap, you can relaunch the command preceded by 'SD_CARD_CAN_SWAP=1'"
|
||||
return
|
||||
fi
|
||||
|
||||
# Compare the available space with the size of the swap.
|
||||
# And set a acceptable size from the request
|
||||
if [ $usable_space -ge $swap_max_size ]
|
||||
then
|
||||
local swap_size=$swap_max_size
|
||||
elif [ $usable_space -ge $(( $swap_max_size / 2 )) ]
|
||||
then
|
||||
local swap_size=$(( $swap_max_size / 2 ))
|
||||
elif [ $usable_space -ge $(( $swap_max_size / 3 )) ]
|
||||
then
|
||||
local swap_size=$(( $swap_max_size / 3 ))
|
||||
elif [ $usable_space -ge $(( $swap_max_size / 4 )) ]
|
||||
then
|
||||
local swap_size=$(( $swap_max_size / 4 ))
|
||||
else
|
||||
echo "Not enough space left for a swap file" >&2
|
||||
local swap_size=0
|
||||
fi
|
||||
|
||||
# If there's enough space for a swap, and no existing swap here
|
||||
if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ]
|
||||
then
|
||||
# Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case
|
||||
if ! fallocate -l ${swap_size}K /swap_$app
|
||||
then
|
||||
dd if=/dev/zero of=/swap_$app bs=1024 count=${swap_size}
|
||||
fi
|
||||
chmod 0600 /swap_$app
|
||||
# Create the swap
|
||||
mkswap /swap_$app
|
||||
# And activate it
|
||||
swapon /swap_$app
|
||||
# Then add an entry in fstab to load this swap at each boot.
|
||||
echo -e "/swap_$app swap swap defaults 0 0 #Swap added by $app" >> /etc/fstab
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_del_swap () {
|
||||
# If there a swap at this place
|
||||
if [ -e /swap_$app ]
|
||||
then
|
||||
# Clean the fstab
|
||||
sed -i "/#Swap added by $app/d" /etc/fstab
|
||||
# Desactive the swap file
|
||||
swapoff /swap_$app
|
||||
# And remove it
|
||||
rm /swap_$app
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if the device of the main mountpoint "/" is an SD card
|
||||
#
|
||||
# [internal]
|
||||
#
|
||||
# return 0 if it's an SD card, else 1
|
||||
ynh_is_main_device_a_sd_card () {
|
||||
local main_device=$(lsblk --output PKNAME --noheadings $(findmnt / --nofsroot --uniq --output source --noheadings --first-only))
|
||||
|
||||
if echo $main_device | grep --quiet "mmc" && [ $(tail -n1 /sys/block/$main_device/queue/rotational) == "0" ]
|
||||
then
|
||||
return 0
|
||||
e
|
||||
lse
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
|
@ -9,24 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
#https://github.com/zwave-js/zwave-js-ui/issues/2699
|
||||
ynh_script_progression --message="Checking for RAM..."
|
||||
|
||||
total_memory=$(ynh_get_ram --total)
|
||||
swap_needed=0
|
||||
|
||||
if [ $total_memory -lt $MEMORY_NEEDED ]; then
|
||||
# Need a minimum of 2Go of memory
|
||||
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
||||
SD_CARD_CAN_SWAP=1
|
||||
ynh_add_swap --size=$swap_needed
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -44,64 +26,18 @@ if grep gpio -q < /etc/group; then
|
|||
usermod -a -G gpio "$app"
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL EXTRA DEPENDENCIES
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=15
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_npm install ---global yarn
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=8
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
# Download, check integrity, uncompress and patch the source
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BUILD FROM SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building from sources..." --weight=1
|
||||
|
||||
pushd "$install_dir"
|
||||
ynh_script_progression --message="Fetching Yarn dependencies... This can be very long, be patient !" --weight=40
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn plugin import workspace-tools
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn workspaces focus --production
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
|
||||
#On slow/low memory system, yarn silently fails with a 0 return code and nothing seems to be doable about that so far.
|
||||
#relaunching yarn install seems to do the trick for raspberry at least as it resumes from where it fails
|
||||
#https://github.com/yarnpkg/berry/issues/3996
|
||||
#https://github.com/yarnpkg/berry/issues/5065
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
|
||||
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
|
||||
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=30
|
||||
#https://geeklearning.io/angular-aot-webpack-memory-trick/
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_OPTIONS=--max-old-space-size=2048 yarn run build
|
||||
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
|
||||
popd
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE ADDITIONNAL SWAP
|
||||
#=================================================
|
||||
if [ $swap_needed > 0 ]; then
|
||||
ynh_script_progression --message="Remove additionnal swap..." --weight=2
|
||||
ynh_del_swap
|
||||
fi
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
|
|
@ -28,14 +28,6 @@ ynh_remove_systemd_config
|
|||
|
||||
ynh_remove_logrotate
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
||||
#In case install or upgrade went wrong, remove script is launched, so we need to ensure additional swap is deleted
|
||||
if [ -e /swap_$app ]; then
|
||||
ynh_script_progression --message="Remove additionnal swap..." --weight=2
|
||||
ynh_del_swap
|
||||
fi
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
# Remove the log files
|
||||
|
|
|
@ -31,9 +31,9 @@ fi
|
|||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=15
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_npm install ---global yarn
|
||||
#ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
#ynh_use_nodejs
|
||||
#ynh_exec_warn_less $ynh_npm install ---global yarn
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
|
|
|
@ -24,30 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
#=================================================
|
||||
# ADD SWAP IF NEEDED
|
||||
#=================================================
|
||||
#https://github.com/zwave-js/zwave-js-ui/issues/2699
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||
ynh_script_progression --message="Checking for RAM..."
|
||||
|
||||
total_memory=$(ynh_get_ram --total)
|
||||
swap_needed=0
|
||||
|
||||
if [ $total_memory -lt $MEMORY_NEEDED ]; then
|
||||
# Need a minimum of 2Go of memory
|
||||
swap_needed=$(($MEMORY_NEEDED - $total_memory))
|
||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
||||
SD_CARD_CAN_SWAP=1
|
||||
ynh_add_swap --size=$swap_needed
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -63,15 +39,6 @@ if grep gpio -q < /etc/group; then
|
|||
usermod -a -G gpio "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_npm install ---global yarn
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -86,41 +53,6 @@ then
|
|||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
ynh_script_progression --message="Building from sources..." --weight=15
|
||||
pushd "$install_dir"
|
||||
ynh_script_progression --message="Fetching Yarn dependencies... This can be very long, be patient !" --weight=18
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn plugin import workspace-tools
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn workspaces focus --production
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
|
||||
#On slow/low memory system, yarn silently fails with a 0 return code and nothing seems to be doable about that so far.
|
||||
#relaunching yarn install seems to do the trick for raspberry at least as it resumes from where it fails
|
||||
#https://github.com/yarnpkg/berry/issues/3996
|
||||
#https://github.com/yarnpkg/berry/issues/5065
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
|
||||
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
|
||||
ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=18
|
||||
#https://geeklearning.io/angular-aot-webpack-memory-trick/
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_OPTIONS=--max-old-space-size=2048 yarn run build
|
||||
ynh_script_progression --message="Cleaning cache... " --weight=3
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
|
||||
popd
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE ADDITIONNAL SWAP
|
||||
#=================================================
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
|
||||
if [ $swap_needed > 0 ]; then
|
||||
ynh_script_progression --message="Remove additionnal swap..." --weight=2
|
||||
ynh_del_swap
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue