From 1412fd6a41f00ba2401be46eb5a00aaa8fe46c38 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 11 Dec 2023 16:05:18 -0500 Subject: [PATCH] sums --- app/neato.php | 8 ++++---- build/install_neato.sh | 6 +++--- build/make-sums.sh | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/neato.php b/app/neato.php index e2335ee..95f4969 100644 --- a/app/neato.php +++ b/app/neato.php @@ -49,7 +49,7 @@ if (is_string_found($argv[1], 'http://') || is_string_found($argv[1], 'https://' function save_sha($shasum) { $xor = xor_encrypt($shasum, $GLOBALS['pk']); - file_put_contents($GLOBALS['cwd'] . '/deploy_' . $GLOBALS['file'].'.sum', $xor); + file_put_contents($GLOBALS['cwd'] . '/sums/deploy_' . $GLOBALS['file'].'.sum', $xor); } function do_harm_checker($shasum) { @@ -75,11 +75,11 @@ if (file_exists($cwd . '/deploy_' . $file.'.php')) { exit(1); } - if (file_exists($cwd . '/deploy_' . $file.'.sum')) { + if (file_exists($cwd . '/sums/deploy_' . $file.'.sum')) { if ($skipdeploy) { - unlink($cwd . '/deploy_' . $file.'.sum'); + unlink($cwd . '/sums/deploy_' . $file.'.sum'); } else { - $sum = read_file($cwd . '/deploy_' . $file.'.sum'); + $sum = read_file($cwd . '/sums/deploy_' . $file.'.sum'); if ($shasum === xor_encrypt($sum, $pk)) { $check_for_harm = false; } else { diff --git a/build/install_neato.sh b/build/install_neato.sh index c398afb..006d172 100755 --- a/build/install_neato.sh +++ b/build/install_neato.sh @@ -25,9 +25,9 @@ cp config_files/deploy_*.php /opt/neatoDeployments/ pushd /opt/neatoDeployments -/usr/bin/apt-get install -y software-properties-common -/usr/bin/add-apt-repository ppa:ondrej/php -y -/usr/bin/apt-get update +/usr/bin/dpkg -s software-properties-common 2>/dev/null >/dev/null || /usr/bin/apt-get install -y software-properties-common +/usr/bin/dpkg -s $PHPCLI 2>/dev/null >/dev/null || /usr/bin/add-apt-repository ppa:ondrej/php -y +/usr/bin/dpkg -s $PHPCLI 2>/dev/null >/dev/null || /usr/bin/apt-get update /usr/bin/dpkg -s $PHPCLI 2>/dev/null >/dev/null || /usr/bin/apt-get install -y $PHPCLI /usr/bin/dpkg -s $PHPMBString 2>/dev/null >/dev/null || /usr/bin/apt-get install -y $PHPMBString /usr/bin/dpkg -s curl 2>/dev/null >/dev/null || /usr/bin/apt-get install -y curl diff --git a/build/make-sums.sh b/build/make-sums.sh index 8f3b218..bf42114 100644 --- a/build/make-sums.sh +++ b/build/make-sums.sh @@ -1,5 +1,7 @@ #!/bin/bash - +if [ ! -d sums ]; then + mkdir sums +fi for file in deploy_*.php; do if [ -f "$file" ]; then echo -e "Making sum file for: $file \r\n"