mirror of
https://github.com/YunoHost-Apps/netdata_ynh.git
synced 2024-09-03 19:46:33 +02:00
Don't re-install netdata itself if upstream version unchanged
This commit is contained in:
parent
a2155e224b
commit
ae0b7048e9
3 changed files with 38 additions and 28 deletions
|
@ -34,9 +34,6 @@ configure_netdata() {
|
|||
|
||||
# Restart NetData
|
||||
systemctl restart netdata
|
||||
|
||||
# Store the uninstaller for the removal script
|
||||
[ -f ./netdata-uninstaller.sh ] && mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
||||
}
|
||||
|
||||
# Add a web_log entry for every YunoHost domain
|
||||
|
|
|
@ -93,6 +93,9 @@ ynh_add_nginx_config
|
|||
pushd $NETDATA_TMPDIR
|
||||
./netdata-installer.sh --install /opt --dont-wait
|
||||
|
||||
# Store the uninstaller for the removal script
|
||||
mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
||||
|
||||
configure_netdata
|
||||
|
||||
# Store the app.src file
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
|
@ -65,39 +65,49 @@ ynh_add_nginx_config
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
installed_version=$(cat /opt/netdata/etc/netdata/app.src | grep SOURCE_URL | sed "s|.*/v\(.*\)/.*|\1|g")
|
||||
version_to_install=$(cat ../conf/app.src | grep SOURCE_URL | sed "s|.*/v\(.*\)/.*|\1|g")
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
NETDATA_TMPDIR=$(mktemp -d)
|
||||
ynh_setup_source "$NETDATA_TMPDIR"
|
||||
if [ "$installed_version" != "$version_to_install" ] ; then
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
NETDATA_TMPDIR=$(mktemp -d)
|
||||
ynh_setup_source "$NETDATA_TMPDIR"
|
||||
|
||||
# signal netdata to start saving its database
|
||||
# this is handy if your database is big
|
||||
pids=$(pidof netdata)
|
||||
[ ! -z "${pids}" ] && kill -USR1 ${pids}
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
||||
# create a temporary file for the log
|
||||
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
||||
# open fd 3 and send it to tmp
|
||||
exec 3>${tmp}
|
||||
|
||||
# Launch netdata installation in /opt directory
|
||||
pushd $NETDATA_TMPDIR
|
||||
# Remove previous service definition (specific 1.8.0 upgrade)
|
||||
rm -f /etc/systemd/system/netdata.service
|
||||
# signal netdata to start saving its database
|
||||
# this is handy if your database is big
|
||||
pids=$(pidof netdata)
|
||||
[ ! -z "${pids}" ] && kill -USR1 ${pids}
|
||||
|
||||
./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
|
||||
# create a temporary file for the log
|
||||
tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log)
|
||||
# open fd 3 and send it to tmp
|
||||
exec 3>${tmp}
|
||||
|
||||
# Launch netdata installation in /opt directory
|
||||
pushd $NETDATA_TMPDIR
|
||||
# Remove previous service definition (specific 1.8.0 upgrade)
|
||||
rm -f /etc/systemd/system/netdata.service
|
||||
|
||||
./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA"
|
||||
|
||||
# Store the uninstaller for the removal script
|
||||
mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata
|
||||
|
||||
popd
|
||||
fi
|
||||
|
||||
# Specific configuration
|
||||
configure_netdata
|
||||
|
||||
# Store the app.src file
|
||||
popd
|
||||
cp ../conf/app.src /opt/netdata/etc/netdata
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue