#!/bin/bash
cd $HOME/Desktop/final-patches/Tallycloud-Zabbix-agent/payload

#creating zip file of payload that contain files.tar(package) and installer script.


ls > /tmp/p1.txt

tar cf ../payload.tar ./*
cd ..

if [ -e "payload.tar" ]; then
    gzip payload.tar

    if [ -e "payload.tar.gz" ]; then
        cat decompress payload.tar.gz > Tiguin.patch
    else
        echo "payload.tar.gz does not exist"
        exit 1
    fi
else
    echo "payload.tar does not exist"
    exit 1
fi

echo "Tiguin.patch is created"
exit 0
