#!/bin/bash pushd /opt/neatoDeployments || exit 1 if [ ! -d sums ]; then mkdir sums fi if which "openssl" >/dev/null 2>&1; then file_to_verify="/opt/neatoDeployments/neatoDeploy.phar" signature_file="/opt/neatoDeployments/neatoDeploy.phar.sig" public_key_file="/opt/neatoDeployments/neatoDeploy.phar.pubkey" # Verify the signature openssl dgst -sha256 -verify "$public_key_file" -signature "$signature_file" "$file_to_verify" # Check the exit code to determine the verification result if [ $? -eq 0 ]; then echo "Signature is valid." else echo "Signature is not valid." exit 1 fi else echo "openssl is not installed!!" fi for file in deploy_files/deploy_*.php; do if [ -f "$file" ]; then echo -e "Making sum file for: $file \r\n" # Remove "deploy_" from the beginning and ".php" from the end new_file_name=$(echo "$file" | sed 's/deploy_files\///;s/^deploy_//;s/\.php$//') php -c /opt/neatoDeployments/neato_deploy_php_cli.ini -f /opt/neatoDeployments/neatoDeploy.phar "$new_file_name" -marksafe -skipdeploy fi done popd || exit 1