1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/netdata_ynh.git synced 2024-09-03 19:46:33 +02:00

rework install/restore/upgrade scripts, add deps, add go as resources

This commit is contained in:
Kayou 2024-07-03 14:25:00 +02:00 committed by GitHub
parent d2c83589f3
commit 4875926f23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 49 additions and 28 deletions

View file

@ -53,6 +53,15 @@ ram.runtime = "50M"
sha256 = "e909a109e1d60bf9416a70f2bb0bbf668d75c75d7ca9ce0b59d88fc634266114"
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "^netdata-v([0-9.]*)tar.gz$"
[resources.sources.go]
amd64.url = "https://go.dev/dl/go1.22.4.linux-amd64.tar.gz"
amd64.sha256 = "ba79d4526102575196273416239cca418a651e049c2b099f3159db85e7bade7d"
i386.url = "https://go.dev/dl/go1.22.4.linux-386.tar.gz"
i386.sha256 = "47a2a8d249a91eb8605c33bceec63aedda0441a43eac47b4721e3975ff916cec"
arm64.url = "https://go.dev/dl/go1.22.4.linux-arm64.tar.gz"
arm64.sha256 = "a8e177c354d2e4a1b61020aca3562e27ea3e8f8247eca3170e3fa1e0c2f9e771"
armhf.url = "https://go.dev/dl/go1.21.5.linux-armv6l.tar.gz"
armhf.sha256 = "837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe"
[resources.system_user]
@ -62,4 +71,4 @@ ram.runtime = "50M"
main.url = "/"
[resources.apt]
packages = "zlib1g-dev, uuid-dev, libmnl-dev, gcc, g++, bison, flex, make, git, autoconf, autoconf-archive, autogen, automake, pkg-config, curl, jq, nodejs, python3-mysqldb, libipmimonitoring-dev, acl, python3-pymongo, libuv1-dev, liblz4-dev, libjudy-dev, libssl-dev, libelf-dev, cmake, golang-go"
packages = "cmake, ninja-build, pkg-config, bison, flex, gcc, g++, git, libelf-dev, libssl-dev, liblz4-dev, zlib1g-dev, uuid-dev, libyaml-dev, libjson-c-dev, libuv1-dev"

View file

@ -15,25 +15,29 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Setting up source files..." --weight=11
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
NETDATA_TMPDIR="$install_dir/netdata_install"
mkdir -p $NETDATA_TMPDIR
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
GO_TMPDIR="$install_dir/go_install"
mkdir -p $GO_TMPDIR
ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR"
#=================================================
# BUILD
#=================================================
ynh_script_progression --message="Executing Netdata installer..." --weight=10
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
export PATH="$GO_TMPDIR/bin:$PATH"
export GOPATH="$GO_TMPDIR/go/"
export HOME=${HOME:-"/root/"}
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
if ! ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel > "$tmplog" 2>&1; then
cat $tmplog
ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
fi
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
popd
ynh_secure_remove --file=$NETDATA_TMPDIR
ynh_secure_remove --file=$GO_TMPDIR
# Specific configuration
configure_netdata
@ -59,4 +63,4 @@ ynh_systemd_action --service_name="$app" --action="restart" --log_path="$install
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -25,20 +25,24 @@ ynh_restore_file --origin_path="$install_dir/etc/netdata"
ynh_script_progression --message="Reinstalling Netdata..." --weight=18
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
NETDATA_TMPDIR="$install_dir/netdata_install"
mkdir -p $NETDATA_TMPDIR
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
GO_TMPDIR="$install_dir/go_install"
mkdir -p $GO_TMPDIR
ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR"
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
export PATH="$GO_TMPDIR/bin:$PATH"
export GOPATH="$GO_TMPDIR/go/"
export HOME=${HOME:-"/root/"}
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
if ! ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel > "$tmplog" 2>&1; then
cat $tmplog
ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
fi
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
popd
ynh_secure_remove --file=$NETDATA_TMPDIR
ynh_secure_remove --file=$GO_TMPDIR
# Specific configuration
configure_netdata

View file

@ -19,8 +19,12 @@ ynh_script_progression --message="Upgrading source files..." --weight=18
#=================================================
# Download, check integrity, uncompress and patch the source from app.src
NETDATA_TMPDIR=$(mktemp -d)
ynh_setup_source "$NETDATA_TMPDIR"
NETDATA_TMPDIR="$install_dir/netdata_install"
mkdir -p $NETDATA_TMPDIR
ynh_setup_source --dest_dir="$NETDATA_TMPDIR"
GO_TMPDIR="$install_dir/go_install"
mkdir -p $GO_TMPDIR
ynh_setup_source --source_id="go" --dest_dir="$GO_TMPDIR"
#=================================================
# SPECIFIC UPGRADE
@ -33,17 +37,17 @@ if [ -n "${pids}" ]; then
kill -USR1 ${pids}
fi
# create a temporary file for the log
tmplog=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
export PATH="$GO_TMPDIR/bin:$PATH"
export GOPATH="$GO_TMPDIR/go/"
export HOME=${HOME:-"/root/"}
pushd "$NETDATA_TMPDIR"
# the installer.sh script will append "netdata" after the --install-prefix arg
if ! ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel > "$tmplog" 2>&1; then
cat $tmplog
ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
fi
# the installer.sh script will append "netdata" after the --install-prefix arg
ynh_exec_warn_less ./netdata-installer.sh --install-prefix /var/www/ --dont-wait --disable-cloud --disable-telemetry --stable-channel
popd
ynh_secure_remove --file=$NETDATA_TMPDIR
ynh_secure_remove --file=$GO_TMPDIR
# Specific configuration
configure_netdata