2020-07-17 04:01:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
VERSION=`xpath -q -e 'string(//PLUGIN/@version)' zabbix_agent.plg`
|
2020-08-12 04:37:27 +00:00
|
|
|
FILE="zabbix_agent-$VERSION-x86_64-1.txz"
|
2020-07-17 04:01:19 +00:00
|
|
|
echo "Version in plugin file: $VERSION"
|
|
|
|
echo "Generated file will be: $FILE"
|
2020-08-12 04:01:56 +00:00
|
|
|
|
|
|
|
if [ -e "$FILE" ]; then
|
2020-08-22 12:27:50 +00:00
|
|
|
echo
|
2020-08-12 04:01:56 +00:00
|
|
|
echo "File already exists."
|
|
|
|
|
|
|
|
givenMD5=`xpath -q -e 'string(//PLUGIN/@packageMD5)' zabbix_agent.plg`
|
|
|
|
read currentMD5 _ < <(md5sum "$FILE")
|
|
|
|
|
|
|
|
if [ "$givenMD5" = "$currentMD5" ]; then
|
2020-08-22 12:27:50 +00:00
|
|
|
echo "MD5 value is OK."
|
2020-08-12 04:01:56 +00:00
|
|
|
else
|
|
|
|
echo "MD5 value does not match!"
|
|
|
|
echo "unraid_zabbix.plg: $givenMD5"
|
|
|
|
echo "$FILE: $currentMD5"
|
|
|
|
fi
|
|
|
|
|
2020-08-22 12:27:50 +00:00
|
|
|
echo
|
|
|
|
|
2020-08-12 04:01:56 +00:00
|
|
|
if [ "$1" != "--force" ]; then
|
|
|
|
echo "Stopping now. Call '$0 --force' to force recreating the file."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-07-17 04:01:19 +00:00
|
|
|
echo "Is this correct? If yes, press Enter. If not, press Ctrl-C."
|
|
|
|
read
|
|
|
|
|
|
|
|
echo "Creating $FILE..."
|
|
|
|
echo
|
2020-08-12 04:37:27 +00:00
|
|
|
tar -cv --owner=root --group=root --lzma -C files -f "$FILE" .
|
2020-07-17 04:01:19 +00:00
|
|
|
echo
|
|
|
|
read md5 _ < <(md5sum "$FILE")
|
|
|
|
echo "MD5 of the resulting file for the plugin file: $md5"
|
2020-08-12 04:01:56 +00:00
|
|
|
echo "Run this tool again to validate the MD5 value from the plugin file."
|