diff --git a/conf/netdata-deps.control b/conf/netdata-deps.control new file mode 100644 index 0000000..f6b9ee9 --- /dev/null +++ b/conf/netdata-deps.control @@ -0,0 +1,13 @@ +Section: misc +Priority: optional +Homepage: https://https://my-netdata.io/ +Standards-Version: 3.9.2 + +Package: netdata-deps +Version: 1.5.0-1 +Depends: zlib1g-dev, uuid-dev, libmnl-dev, gcc, make, git, autoconf, autoconf-archive, autogen, automake, pkg-config, curl, jq, nodejs +Architecture: all +Description: meta package for NetData dependencies + netdata is a system for distributed real-time performance and health monitoring. It provides unparalleled insights, in real-time, of everything happening on the system it runs (including applications such as web and database servers), using modern interactive web dashboards. + . + This meta-package is only responsible of installing its dependencies. diff --git a/scripts/_common.sh b/scripts/_common.sh index 771d713..e56e265 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,6 +9,9 @@ VERSION="1.5.0" # Remote URL to fetch application source archive APPLICATION_SOURCE_URL="https://github.com/firehol/netdata/releases/download/v${VERSION}/netdata-${VERSION}.tar.gz" +# Package name for NetData dependencies +DEPS_PKG_NAME="netdata-deps" + # # Common helpers # diff --git a/scripts/install b/scripts/install index cc4720c..cd924cf 100644 --- a/scripts/install +++ b/scripts/install @@ -9,6 +9,7 @@ app=$YNH_APP_INSTANCE_NAME # Source local helpers source ./_common.sh + SRCPATH=$(pwd) # Retrieve arguments @@ -30,19 +31,22 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Download and extract application -TMPDIR=$(extract_application) +NETDATA_TMPDIR=$(extract_application) # Install dependencies -ynh_package_update -ynh_package_install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs +ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \ +|| ynh_die "Unable to install dependencies" # Launch netdata installation in /opt directory -cd $TMPDIR +cd $NETDATA_TMPDIR sudo ./netdata-installer.sh --install /opt --dont-wait + # Store the uninstaller for the removal script sudo mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata -# Store the local helper for backup/restore scripts + +# Store useful files for backup/restore scripts sudo cp $SRCPATH/_common.sh /opt/netdata/etc/netdata +sudo cp $SRCPATH/../conf/netdata-deps.control /opt/netdata/etc/netdata # Modify Nginx configuration file and copy it to Nginx conf directory if [[ "$path" == "/" ]] ; then diff --git a/scripts/remove b/scripts/remove index 517050f..5e6d018 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,6 +9,9 @@ app=$YNH_APP_INSTANCE_NAME # Source YunoHost helpers source /usr/share/yunohost/helpers +# Source local helpers +source ./_common.sh + # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) @@ -25,6 +28,9 @@ sudo sed -i "s/rm -I/rm -f/g" ${UNINSTALL_SCRIPT} # Execute the uninstall script sudo ./${UNINSTALL_SCRIPT} --force +# Remove app dependencies +ynh_package_autoremove "$DEPS_PKG_NAME" || true + # Remove user and group sudo userdel netdata diff --git a/scripts/restore b/scripts/restore index e109675..dd2f4b7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,8 +1,5 @@ #!/bin/bash -# Note: each files and directories you've saved using the ynh_backup helper -# will be located in the current directory, regarding the last argument. - # Exit on command errors and treat unset variables as an error set -eu @@ -27,14 +24,14 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Download and extract application -TMPDIR=$(extract_application) +NETDATA_TMPDIR=$(extract_application) # Install dependencies -ynh_package_update -ynh_package_install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl jq nodejs +ynh_package_install_from_equivs ./conf/${DEPS_PKG_NAME}.control \ +|| ynh_die "Unable to install dependencies" # Launch netdata installation in /opt directory -cd $TMPDIR +cd $NETDATA_TMPDIR sudo ./netdata-installer.sh --install /opt --dont-wait sudo mv ./netdata-uninstaller.sh /opt/netdata diff --git a/scripts/upgrade b/scripts/upgrade index 9da03d3..e359745 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,7 +23,7 @@ is_public=$(ynh_app_setting_get "$app" is_public) path=$(fix_path $path) # Download and extract application -TMPDIR=$(extract_application) +NETDATA_TMPDIR=$(extract_application) # signal netdata to start saving its database # this is handy if your database is big @@ -36,7 +36,7 @@ tmp=$(mktemp /tmp/netdata-updater-log-XXXXXX.log) exec 3>${tmp} # Launch netdata installation in /opt directory -cd $TMPDIR +cd $NETDATA_TMPDIR sudo ./netdata-installer.sh --install /opt --dont-wait >&3 2>&3 || ynh_die "FAILED TO COMPILE/INSTALL NETDATA" # Store the uninstaller for the removal script sudo mv ./netdata-uninstaller.sh /opt/netdata/etc/netdata