Guest User

Untitled

a guest
Aug 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. #create log file
  4. rm -f QC.log
  5. touch QC.log
  6.  
  7. #optical drives
  8. QCVAR=$(ls /sys/block/ | grep sr | wc -l)
  9. if test $QCVAR -eq 1
  10. then echo "PASSED : CD/DVD drive test" >> QC.log
  11. elif test $QCVAR -gt 1
  12. then echo "FAILED : CD/DVD drive test. Too many optical drives exist!" >> QC.log
  13. elif test $QCVAR -lt 1
  14. then echo "FAILED : CD/DVD drive test. Add an optical drive!" >> QC.log
  15. fi
  16.  
  17. #hdd
  18. QCVAR=$(ls /sys/block/ | grep sd[a-z] | wc -l)
  19. if test $QCVAR -eq 1
  20. then echo "PASSED : Hard drive test." >> QC.log
  21. elif test $QCVAR -gt 1
  22. then echo "FAILED : Hard drive test. Too many hard drives in the computer!" >> QC.log
  23. elif test $QCVAR -lt 1
  24. then echo "FAILED : Hard drive test. Something went wrong with the test!" >> QC.log
  25. fi
  26.  
  27. #RAM
  28. QCVAR=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
  29. if test $QCVAR -le 327680
  30. then echo "FAILED : Memory test. Add more memory to the computer." >> QC.log
  31. elif test $QCVAR -ge 524288
  32. then echo "FAILED : Memory test. Take some RAM out!" >> QC.log
  33. else
  34. echo "PASSED : Memory test." >> QC.log
  35. fi
  36.  
  37. #CPU
  38. QCVAR=$(awk '/MHz/ {print $4; exit}' /proc/cpuinfo)
  39. if test $QCVAR -lt 400.000
  40. then echo "FAILED : CPU clockspeed test." >> QC.log
  41. else
  42. echo "PASSED : CPU clockspeed test." >> QC.log
  43. fi
  44.  
  45. #network
  46. QCVAR=$(ls /sys/class/net | grep eth | wc -l)
  47. if test $QCVAR -lt 1
  48. then echo "FAILED : Network card test. There is no network card!" >> QC.log
  49. elif test $QCVAR -gt 1
  50. then echo "FAILED : Network card test. There are too many network cards!" >> QC.log
  51. else
  52. echo "PASSED : Network card test." >> QC.log
  53. fi
  54.  
  55. #sound
  56. QCVAR=$(ls /sys/class/sound/ | grep card | wc -l)
  57. if test $QCVAR -lt 1
  58. then echo "FAILED : Sound card test. There is no sound card!" >> QC.log
  59. elif test $QCVAR -gt 1
  60. then echo "FAILED : Sound card test. There are too many sound cards in the computer!" >> QC.log
  61. else
  62. echo "PASSED : Sound card test." >> QC.log
  63. fi
  64.  
  65. #video
  66. QCVAR=$(ls /sys/class/graphics/ | grep fb[0-9] | wc -l)
  67. if test $QCVAR -lt 1
  68. then echo "FAILED : Video card test. Something went wrong with the test!" >> QC.log
  69. elif test $QCVAR -gt 1
  70. then echo "FAILED : Video card test. There are too many video cards in the computer!" >> QC.log
  71. else
  72. echo "PASSED : Video card test." >> QC.log
  73. fi
  74.  
  75. #usb
  76. QCVAR=$(ls /sys/bus/usb/devices | wc -l)
  77. if test $QCVAR -lt 1
  78. then echo "FAILED : USB port test. There are no USB ports!" >> QC.log
  79. else
  80. echo "PASSED : USB port test." >> QC.log
  81. fi
  82.  
  83. #users
  84. QCVAR=$(ls /home | wc -l)
  85. if test $QCVAR -lt 1
  86. then echo "FAILED : User count. Something is wrong with this test!" >> QC.log
  87. elif test $QCVAR -gt 1
  88. then echo "FAILED : User count. There is more than one user account!" >> QC.log
  89. else
  90. echo "PASSED : User count test." >> QC.log
  91. fi
  92.  
  93. #edubuntu
  94. QCVAR=$(dpkg --list 'ubuntu-edu*' | grep ii | wc -l)
  95. if test $QCVAR -lt 4
  96. then echo "FAILED : Edubuntu. Package 'edubuntu-desktop' needs to be installed!" >> QC.log
  97. elif test $QCVAR -gt 1
  98. then echo "FAILED : Edubuntu. Something is wrong with this test!" >> QC.log
  99. else
  100. echo "PASSED : Edubuntu test." >> QC.log
  101. fi
  102.  
  103. #output log to dialog box for ease of reading
  104. dialog --title "Free IT Athens Quality Control Test Results" --textbox ./QC.log 17 80
Add Comment
Please, Sign In to add comment