From 682b4a5d70c4554de446b27a6d43fdea5c140bbb Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Tue, 27 Aug 2013 04:32:33 -0400 Subject: [PATCH] Updated patch script. --- server/scripts/ispconfig_patch | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/server/scripts/ispconfig_patch.php b/server/scripts/ispconfig_patch similarity index 90% rename from server/scripts/ispconfig_patch.php rename to server/scripts/ispconfig_patch index 3e7694a..9376ba1 100644 --- a/server/scripts/ispconfig_patch.php +++ b/server/scripts/ispconfig_patch @@ -1,3 +1,4 @@ +#!/usr/bin/php <?php /* @@ -77,6 +78,15 @@ return $answer; } +function is_installed($appname) { + exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode); + if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) { + return true; + } else { + return false; + } +} + echo "\n\n".str_repeat('-',80)."\n"; echo " _____ ___________ _____ __ _ |_ _/ ___| ___ \ / __ \ / _(_) @@ -90,11 +100,15 @@ echo "\n\n>> Patch tool \n\n"; echo "Please enter the patch id that you want to be applied to your ISPConfig installation.\nPlease be aware that we take NO responsibility that this will work for you.\nOnly use patches if you know what you are doing.\n\n"; +if(!is_installed('patch')) { + swriteln("The program 'patch' is missing on your server. Please install it and try again."); +} + $patch_id = simple_query('Enter patch id', false, ''); if($patch_id == '') { swriteln("Patch terminated by user.\n"); die(); -} elseif(preg_match('/^[a-zA-Z0-9_\-\.]+$/', $patch_id) == false) { +} elseif(preg_match('/^[a-zA-Z0-9_\-]+$/', $patch_id) == false) { swriteln("Invalid patch id.\n"); die(); } -- Gitblit v1.9.1