forked from zabbix-tooling/zabbix-agent-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_publish.sh
executable file
·30 lines (22 loc) · 1.08 KB
/
ci_publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
TARGET_HOST=$1
TARGET_USER=${2:-"aptly"}
TARGET_DESTINATION=${3:-"/srv/repos/"}
TARGET_DESTINATION_YUM=${TARGET_DESTINATION}"yum"
TARGET_DESTINATION_APT="/tmp"
set -e
echo -------------------------Publishing YUM---------------------------
set -x
scp zabbix-agent-extensions*.rpm ${TARGET_USER}@${TARGET_HOST}:${TARGET_DESTINATION_YUM}
ssh ${TARGET_USER}@${TARGET_HOST} "/usr/bin/createrepo -s sha ${TARGET_DESTINATION_YUM}"
set +x
echo -------------------------Publishing APT---------------------------
DEB_FILE=`ls zabbix-agent-extensions*.deb`
set -x
scp ${DEB_FILE} ${TARGET_USER}@${TARGET_HOST}:${TARGET_DESTINATION_APT}
ssh ${TARGET_USER}@${TARGET_HOST} "aptly repo add -force-replace stable ${TARGET_DESTINATION_APT}/${DEB_FILE}"
ssh ${TARGET_USER}@${TARGET_HOST} "aptly snapshot create stable-$(date "+%Y-%m-%d_%H-%M") from repo stable"
ssh ${TARGET_USER}@${TARGET_HOST} "aptly publish drop trusty"
ssh ${TARGET_USER}@${TARGET_HOST} "aptly publish snapshot stable-$(date "+%Y-%m-%d_%H-%M")"
ssh ${TARGET_USER}@${TARGET_HOST} "rm ${TARGET_DESTINATION_APT}/${DEB_FILE}"
set +x