wigust-spectre-meltdown-checker.scm 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (gnu packages wigust-spectre-meltdown-checker)
  19. #:use-module (gnu packages base)
  20. #:use-module (gnu packages bash)
  21. #:use-module (gnu packages compression)
  22. #:use-module (gnu packages perl)
  23. #:use-module (gnu packages)
  24. #:use-module (guix build-system trivial)
  25. #:use-module (guix download)
  26. #:use-module ((guix licenses) #:prefix license:)
  27. #:use-module (guix packages))
  28. (define-public spectre-meltdown-checker
  29. (package
  30. (name "spectre-meltdown-checker")
  31. (version "0.34")
  32. (source
  33. (origin
  34. (method url-fetch)
  35. (uri (string-append "https://github.com/speed47/spectre-meltdown-checker"
  36. "/archive/" "v" version ".tar.gz"))
  37. (file-name (string-append name "-" version ".tar.gz"))
  38. (sha256
  39. (base32
  40. "0dashyjzjhjvg6gw3vj8fx4pkil9262xg16lgqc7vb22d84g5952"))))
  41. (build-system trivial-build-system)
  42. (native-inputs
  43. `(("bash" ,bash)
  44. ("gzip" ,gzip)
  45. ("perl" ,perl)
  46. ("tar" ,tar)))
  47. (arguments
  48. `(#:modules ((guix build utils))
  49. #:builder
  50. (begin
  51. (use-modules (guix build utils))
  52. ;; bootstrap
  53. (setenv "PATH" (string-append
  54. (assoc-ref %build-inputs "tar") "/bin" ":"
  55. (assoc-ref %build-inputs "gzip") "/bin"))
  56. (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
  57. (chdir (string-append ,name "-" ,version))
  58. (substitute* "spectre-meltdown-checker.sh"
  59. (("/bin/sh")
  60. (string-append (assoc-ref %build-inputs "bash") "/bin/sh")))
  61. ;; install
  62. (let ((out (assoc-ref %outputs "out")))
  63. (install-file "spectre-meltdown-checker.sh"
  64. (string-append out "/bin"))
  65. (for-each (lambda (file)
  66. (install-file file (string-append out "/share/doc")))
  67. '("LICENSE" "README.md"))))))
  68. (home-page "https://github.com/speed47/spectre-meltdown-checker/")
  69. (synopsis "Spectre & Meltdown vulnerability/mitigation checker for Linux")
  70. (description "A simple shell script to tell if your Linux installation is
  71. vulnerable against the 3 “speculative execution” CVEs that were made public
  72. early 2018.
  73. Without options, it'll inspect your currently running kernel. You can also
  74. specify a kernel image on the command line, if you'd like to inspect a kernel
  75. you're not running.
  76. The script will do its best to detect mitigations, including backported
  77. non-vanilla patches, regardless of the advertised kernel version number.")
  78. (license license:gpl3+)))