Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- #create log file
- rm -f QC.log
- touch QC.log
- #optical drives
- QCVAR=$(ls /sys/block/ | grep sr | wc -l)
- if test $QCVAR -eq 1
- then echo "PASSED : CD/DVD drive test" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : CD/DVD drive test. Too many optical drives exist!" >> QC.log
- elif test $QCVAR -lt 1
- then echo "FAILED : CD/DVD drive test. Add an optical drive!" >> QC.log
- fi
- #hdd
- QCVAR=$(ls /sys/block/ | grep sd[a-z] | wc -l)
- if test $QCVAR -eq 1
- then echo "PASSED : Hard drive test." >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : Hard drive test. Too many hard drives in the computer!" >> QC.log
- elif test $QCVAR -lt 1
- then echo "FAILED : Hard drive test. Something went wrong with the test!" >> QC.log
- fi
- #RAM
- QCVAR=$(awk '/MemTotal/ {print $2}' /proc/meminfo)
- if test $QCVAR -le 327680
- then echo "FAILED : Memory test. Add more memory to the computer." >> QC.log
- elif test $QCVAR -ge 524288
- then echo "FAILED : Memory test. Take some RAM out!" >> QC.log
- else
- echo "PASSED : Memory test." >> QC.log
- fi
- #CPU
- QCVAR=$(awk '/MHz/ {print $4; exit}' /proc/cpuinfo)
- if test $QCVAR -lt 400.000
- then echo "FAILED : CPU clockspeed test." >> QC.log
- else
- echo "PASSED : CPU clockspeed test." >> QC.log
- fi
- #network
- QCVAR=$(ls /sys/class/net | grep eth | wc -l)
- if test $QCVAR -lt 1
- then echo "FAILED : Network card test. There is no network card!" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : Network card test. There are too many network cards!" >> QC.log
- else
- echo "PASSED : Network card test." >> QC.log
- fi
- #sound
- QCVAR=$(ls /sys/class/sound/ | grep card | wc -l)
- if test $QCVAR -lt 1
- then echo "FAILED : Sound card test. There is no sound card!" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : Sound card test. There are too many sound cards in the computer!" >> QC.log
- else
- echo "PASSED : Sound card test." >> QC.log
- fi
- #video
- QCVAR=$(ls /sys/class/graphics/ | grep fb[0-9] | wc -l)
- if test $QCVAR -lt 1
- then echo "FAILED : Video card test. Something went wrong with the test!" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : Video card test. There are too many video cards in the computer!" >> QC.log
- else
- echo "PASSED : Video card test." >> QC.log
- fi
- #usb
- QCVAR=$(ls /sys/bus/usb/devices | wc -l)
- if test $QCVAR -lt 1
- then echo "FAILED : USB port test. There are no USB ports!" >> QC.log
- else
- echo "PASSED : USB port test." >> QC.log
- fi
- #users
- QCVAR=$(ls /home | wc -l)
- if test $QCVAR -lt 1
- then echo "FAILED : User count. Something is wrong with this test!" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : User count. There is more than one user account!" >> QC.log
- else
- echo "PASSED : User count test." >> QC.log
- fi
- #edubuntu
- QCVAR=$(dpkg --list 'ubuntu-edu*' | grep ii | wc -l)
- if test $QCVAR -lt 4
- then echo "FAILED : Edubuntu. Package 'edubuntu-desktop' needs to be installed!" >> QC.log
- elif test $QCVAR -gt 1
- then echo "FAILED : Edubuntu. Something is wrong with this test!" >> QC.log
- else
- echo "PASSED : Edubuntu test." >> QC.log
- fi
- #output log to dialog box for ease of reading
- dialog --title "Free IT Athens Quality Control Test Results" --textbox ./QC.log 17 80
Add Comment
Please, Sign In to add comment