From 2af403bbeae898a450a40a532c643a08f039d0bc Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sat, 16 Apr 2016 18:15:38 +0200 Subject: [PATCH] services: remove SMART from base --- Makefile | 1 - .../app/models/OPNsense/Base/Menu/Menu.xml | 1 - src/www/diag_smart.php | 324 ------------------ src/www/widgets/include/smart_status.inc | 4 - .../widgets/widgets/smart_status.widget.php | 80 ----- 5 files changed, 410 deletions(-) delete mode 100644 src/www/diag_smart.php delete mode 100644 src/www/widgets/include/smart_status.inc delete mode 100644 src/www/widgets/widgets/smart_status.widget.php diff --git a/Makefile b/Makefile index 54125f6fe..ea01d2acc 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,6 @@ CORE_DEPENDS?= apinger \ relayd \ rrdtool12 \ samplicator \ - smartmontools \ squid \ sshlockout_pf \ strongswan \ diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml index b6baf81d9..df2ea4e21 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -266,7 +266,6 @@ - diff --git a/src/www/diag_smart.php b/src/www/diag_smart.php deleted file mode 100644 index e6a99d5d4..000000000 --- a/src/www/diag_smart.php +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - -
-
-
- -
- -' . gettext("PASSED") . ''; - $replacements[1] = '' . gettext("FAILED") . ''; - $replacements[2] = '' . gettext("Warning") . ''; - ksort($patterns); - ksort($replacements); - return preg_replace($patterns, $replacements, $string); -} - -// What page, aka. action is being wanted -// If they "get" a page but don't pass all arguments, smartctl will throw an error -$action = (isset($_POST['action']) ? $_POST['action'] : $_GET['action']); -$targetdev = basename($_POST['device']); -if (!file_exists('/dev/' . $targetdev)) { - echo "Device does not exist, bailing."; - return; -} -switch($action) { - // Testing devices - case 'test': - { - $test = $_POST['testType']; - if (!in_array($test, $valid_test_types)) { - echo "Invalid test type, bailing."; - return; - } - $output = add_colors(shell_exec($smartctl . " -t " . escapeshellarg($test) . " /dev/" . escapeshellarg($targetdev))); - echo '
' . $output . '
-    
- - - -
-
'; - break; - } - - // Info on devices - case 'info': - { - $type = $_POST['type']; - if (!in_array($type, $valid_info_types)) { - echo "Invalid info type, bailing."; - return; - } - $output = add_colors(shell_exec($smartctl . " -" . escapeshellarg($type) . " /dev/" . escapeshellarg($targetdev))); - echo "
$output
"; - break; - } - - // View logs - case 'logs': - { - $type = $_POST['type']; - if (!in_array($type, $valid_log_types)) { - echo "Invalid log type, bailing."; - return; - } - $output = add_colors(shell_exec($smartctl . " -l " . escapeshellarg($type) . " /dev/" . escapeshellarg($targetdev))); - echo "
$output
"; - break; - } - - // Abort tests - case 'abort': - { - $output = shell_exec($smartctl . " -X /dev/" . escapeshellarg($targetdev)); - echo "
$output
"; - break; - } - - // Default page, prints the forms to view info, test, etc... - default: - { - - // Get all AD* and DA* (IDE and SCSI) devices currently installed and stores them in the $devs array - exec("ls /dev | grep '^\(ad\|da\|ada\)[0-9]\{1,2\}$'", $devs); - ?> - -
-
- - - - - - - - - - - - - - - - -
-   -   -   -   - -
-
- -
  - - " /> -
-
-
-
- - -
- -
-
- - - - - - - - - - - - - - - - -
-
-   -   -   - -
-
- -
  - - " /> -
-
-
-
- - -
-
-
- - - - - - - - - - - - - - - - -
-
-   - -
-
- -
  - - " /> -
-
-
-
- - -
-
-
- - - - - - - - - - - - -
- -
  - - " class="btn btn-primary" onclick="return confirm('')" /> -
-
-
-
- - ' . gettext("Back") . ''; -} -?> -
-" . $ulmsg . "

\n"; ?> - -
- - - - - - diff --git a/src/www/widgets/include/smart_status.inc b/src/www/widgets/include/smart_status.inc deleted file mode 100644 index 3b51107f4..000000000 --- a/src/www/widgets/include/smart_status.inc +++ /dev/null @@ -1,4 +0,0 @@ - - - - - - - - - - 0) { - foreach ($devs as $dev) { -## for each found drive do - $dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); ## get identifier from drive - $dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit} -/^SMART Health Status/ {print $2;exit}'")); ## get SMART state from drive - $dev_state_translated = ""; - switch ($dev_state) { - case "PASSED": - case "OK": - $dev_state_translated = gettext('OK'); - $color = "#90EE90"; - break; - case "": - $dev_state = "Unknown"; - $dev_state_translated = gettext('Unknown'); - $color = "#C0B788"; - break; - default: - $color = "#F08080"; - break; - } -?> - - - - - - -