Check packages files added
This commit is contained in:
parent
507aa56403
commit
d326ada414
47
check_packages.sh
Executable file
47
check_packages.sh
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION=$1
|
||||||
|
#echo $VERSION
|
||||||
|
## Replace VERSION with $VERSION in packages_uri.txt and save it as packages_uri_new.txt
|
||||||
|
sed 's,VERSION,'$VERSION',g' packages_uri.txt > packages_uri_new.txt
|
||||||
|
|
||||||
|
checkPackages(){
|
||||||
|
## Set S3 Bucket URL
|
||||||
|
if [ $1 == "production" ]; then
|
||||||
|
PACKAGES_URL=https://packages.wazuh.com/4.x/
|
||||||
|
elif [ $1 == "pre-release" ]; then
|
||||||
|
PACKAGES_URL=https://packages-dev.wazuh.com/pre-release/
|
||||||
|
elif [ $1 == "staging" ]; then
|
||||||
|
PACKAGES_URL=https://packages-dev.wazuh.com/staging/
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Set EXISTS to 0 (true)
|
||||||
|
EXISTS=0
|
||||||
|
|
||||||
|
## Loop through the packages_uri_new.txt file
|
||||||
|
while IFS= read -r URI
|
||||||
|
do
|
||||||
|
#echo "$URI"
|
||||||
|
## Check if the package exists
|
||||||
|
PACKAGE=$(curl --silent -I $PACKAGES_URL$URI | grep -E "^HTTP" | awk '{print $2}')
|
||||||
|
## If it does not exist set EXISTS to 1 (false)
|
||||||
|
if [ "$PACKAGE" != "200" ]; then
|
||||||
|
EXISTS=1
|
||||||
|
return $EXISTS
|
||||||
|
fi
|
||||||
|
done < packages_uri_new.txt
|
||||||
|
|
||||||
|
return $EXISTS
|
||||||
|
}
|
||||||
|
|
||||||
|
## Call the checkPackages function for each repository
|
||||||
|
if checkPackages "production"; then
|
||||||
|
echo "production"
|
||||||
|
exit 0
|
||||||
|
elif checkPackages "pre-release"; then
|
||||||
|
echo "pre-release"
|
||||||
|
exit 0
|
||||||
|
elif checkPackages "staging"; then
|
||||||
|
echo "staging"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
8
packages_uri.txt
Normal file
8
packages_uri.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
yum/wazuh-manager-VERSION-1.x86_64.rpm
|
||||||
|
yum/wazuh-agent-VERSION-1.x86_64.rpm
|
||||||
|
windows/wazuh-agent-VERSION-1.msi
|
||||||
|
apt/pool/main/w/wazuh-manager/wazuh-manager_VERSION-1_amd64.deb
|
||||||
|
apt/pool/main/w/wazuh-indexer/wazuh-indexer_VERSION-1_amd64.deb
|
||||||
|
apt/pool/main/f/filebeat/filebeat-oss-7.10.2-amd64.deb
|
||||||
|
apt/pool/main/w/wazuh-dashboard/wazuh-dashboard_VERSION-1_amd64.deb
|
||||||
|
apt/pool/main/w/wazuh-agent/wazuh-agent_VERSION-1_ppc64el.deb
|
||||||
Loading…
Reference in New Issue
Block a user