ncc.zabbix_fbsd_templates

Yohn Y. 2025-07-12 Parent:74c0d4d119d4 Child:dab245c08aae

22:e386b9d6312f Go to Latest

ncc.zabbix_fbsd_templates/tools/make_dist.sh

+ Автоматическую загрузку дистрибутива на ФС

History
     1.1 --- a/tools/make_dist.sh	Sat Jul 12 09:17:03 2025 +0300
     1.2 +++ b/tools/make_dist.sh	Sat Jul 12 10:37:42 2025 +0300
     1.3 @@ -1,13 +1,33 @@
     1.4 -#!/bin/sh
     1.5 +#!/bin/bash
     1.6  src_root="$(dirname "$(dirname "$(readlink -f "$0")")")"
     1.7  dist_root="$(readlink -f "$src_root/../dist")"
     1.8  
     1.9 +### VARS
    1.10 +dist_name="aw.fbsd-mon-helper.tgz"
    1.11 +dist_s3_link="s3fs/dist/config/zabbix/freebsd-template/${dist_name}"
    1.12 +
    1.13  echo "###"
    1.14 -tar -cvzf "$dist_root/aw.fbsd-mon-helper.tgz" \
    1.15 +tar -cvzf "${dist_root}/${dist_name}" \
    1.16     --owner=root --group=root \
    1.17     -C "$src_root/src" \
    1.18     aw.fbsd-mon-helper
    1.19  
    1.20  echo "==="
    1.21 -echo "$dist_root/aw.fbsd-mon-helper.tgz"
    1.22 -stat "$dist_root/aw.fbsd-mon-helper.tgz"
    1.23 +echo "${dist_root}/${dist_name}"
    1.24 +stat "${dist_root}/${dist_name}"
    1.25 +
    1.26 +if [ "$(which minioctl)" ] && [ -f "${dist_root}/${dist_name}" ] ; then
    1.27 +  echo "### PUSH DISTRIBUTION TO FS ###"
    1.28 +  read -p "Upload file [y/N]: " _ans
    1.29 +  case "$_ans" in 
    1.30 +    [Yy] | [yY][eE][sS] )
    1.31 +      minioctl cp "${dist_root}/${dist_name}" "$dist_s3_link"
    1.32 +      ;;
    1.33 +   
    1.34 +    * )
    1.35 +      echo "WARNING: Answer is '${_ans}', abort uploading"
    1.36 +      ;;
    1.37 +  
    1.38 +  esac
    1.39 +fi
    1.40 +