Optimize OS/release/version detection for faster execution #70

Merged
benpro merged 86 commits from fast-debian-check into master 2019-04-05 11:01:57 +02:00

86 commits

Author SHA1 Message Date
Benoît S. bbb34c7df0 Merge branch 'cleanup' into fast-debian-check
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-04-05 10:59:01 +02:00
Jérémy Lecour 9e50962b17 do not print warnings in quiet mode
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-04-04 20:52:13 +02:00
Jérémy Lecour 53b86b991f add a break
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2019-04-04 18:32:43 +02:00
Jérémy Lecour 4d952b1013 limit Samba check to lenny 2019-04-04 18:30:46 +02:00
Jérémy Lecour 0fa12b0cfd use octal representation of permissions 2019-04-04 18:28:49 +02:00
Jérémy Lecour 7dab67e303 fix typo 2019-04-04 18:25:10 +02:00
Jérémy Lecour 774796e190 fix lenny test
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2019-04-03 21:25:57 +02:00
Jérémy Lecour e9cee7c4c0 report if blkid is missing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-03-25 10:04:40 +01:00
Jérémy Lecour decb3fbb0c bump version
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-03-24 21:56:20 +01:00
Jérémy Lecour 4547705b45 skip test if munin is not setup in cron mode 2019-03-24 21:52:32 +01:00
Jérémy Lecour 3838f07c3b awstats must be installed to check its configuration 2019-03-24 21:50:51 +01:00
Jérémy Lecour f4b1c96be0 verbose mode for AUTOIF 2019-03-24 21:35:28 +01:00
Jérémy Lecour 809146de52 systemd network configuration is not supported yet 2019-03-24 21:27:16 +01:00
Jérémy Lecour a7abd80f93 Use awk to have a rounded percentage
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
python is slow
bash supports only integer arithmetics
"bc" can't round to the ceiling
2019-03-24 21:10:47 +01:00
Jérémy Lecour 4136b310c1 fallback to python if bc(1) is missing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-03-23 21:09:36 +01:00
Jérémy Lecour e2fb5ae837 fail if lspci is missing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-03-23 10:32:53 +01:00
Jérémy Lecour 9cd5e1c325 improve backup detection 2019-03-23 10:32:29 +01:00
Jérémy Lecour 3979b71831 Check for files before going further
Some non conventional servers might have important files or programs 
missing.
2019-03-23 10:18:01 +01:00
Jérémy Lecour 83379f6787 fix excessive quoting
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
it breaks globbing
2019-03-23 02:36:42 +01:00
Jérémy Lecour 8f255fa392 IS_EVOMAINTENANCEUSERS search trap only in active users home 2019-03-23 02:36:42 +01:00
Jérémy Lecour 4daaf99e36 split IS_EVOMAINTENANCECONF in 3 checks 2019-03-23 02:36:42 +01:00
Jérémy Lecour f377df3370 fix evobakup scripts detection
find returns with 0 even if nothing is found, so we use the number of 
occurences
2019-03-23 02:36:42 +01:00
Jérémy Lecour c9acd91671 Break the loop unless in verbose mode 2019-03-23 02:36:42 +01:00
Jérémy Lecour 8980ca7b69 document -h for help option 2019-03-23 02:36:42 +01:00
Jérémy Lecour 140a5d1a84 typo 2019-03-23 02:36:42 +01:00
Jérémy Lecour 3598154e4a find user's home directory via getent(1) 2019-03-23 02:36:42 +01:00
Jérémy Lecour 48cbf6385f improve reserved blocks math
bc(1) round to the lower integer, so we add 1 to always be around the 
ceiling.
2019-03-23 02:36:42 +01:00
Jérémy Lecour df9af8061d log if not QUIET 2019-03-23 02:36:42 +01:00
Jérémy Lecour 7702a8dd84 Add options parsing (verbose/quiet/cron/help/version) 2019-03-23 02:36:42 +01:00
Jérémy Lecour 2fdc3338fd Disable a few shellcheck style warnings 2019-03-23 02:36:42 +01:00
Jérémy Lecour a7bfbe0a19 awk instead of tr | cut 2019-03-23 02:36:42 +01:00
Jérémy Lecour 3591e265c8 grep -c instead of grep | wc -l 2019-03-23 02:36:42 +01:00
Jérémy Lecour 92754deef0 whitespaces 2019-03-23 02:36:42 +01:00
Jérémy Lecour 8f46b6c811 variable extraction 2019-03-23 02:36:42 +01:00
Jérémy Lecour 97b13b2a60 cut < file instead of cat file | cut 2019-03-23 02:36:42 +01:00
Jérémy Lecour fa53e1a293 command grouping with braces 2019-03-23 02:36:42 +01:00
Jérémy Lecour 1c0f00c473 quotes 2019-03-23 02:36:42 +01:00
Jérémy Lecour 9861e22614 test command return value directly 2019-03-23 02:36:42 +01:00
Jérémy Lecour 8254877240 Add IS_ETCGIT to check for /etc.git Git repository 2019-03-23 02:36:42 +01:00
Jérémy Lecour ae0b3ae2f1 Use bc (instead of python) to have a rounded percentage 2019-03-23 02:36:42 +01:00
Jérémy Lecour 4f8a9ceecc fix quotes 2019-03-23 02:36:42 +01:00
Jérémy Lecour a8178598e9 use braces instead of parenthesis 2019-03-23 02:36:41 +01:00
Jérémy Lecour 3a484cf694 add quotes 2019-03-23 02:36:41 +01:00
Jérémy Lecour c073f5ca87 homeDir is useless here 2019-03-23 02:36:41 +01:00
Jérémy Lecour 0fe664f571 rework the EVOACME check 2019-03-23 02:36:41 +01:00
Jérémy Lecour 55f720972b add a lot of verbose output 2019-03-23 02:36:41 +01:00
Jérémy Lecour 8957b19a96 reorganize IS_EVOMAINTENANCEUSERS 2019-03-23 02:36:41 +01:00
Jérémy Lecour 4a70693114 conditional readability 2019-03-23 02:36:41 +01:00
Jérémy Lecour cfb4602bed extract variable 2019-03-23 02:36:41 +01:00
Jérémy Lecour 5b9d41de0c wording 2019-03-23 02:36:41 +01:00
Jérémy Lecour 76354bed48 extract variable 2019-03-23 02:36:41 +01:00
Jérémy Lecour a01b53111d OpenBSD version detection 2019-03-23 02:36:41 +01:00
Jérémy Lecour 8aadbed4de Don't limit to Lenny
This test doesn't seem to be limited to Lenny, so we should check for 
all backports
2019-03-23 02:36:41 +01:00
Jérémy Lecour c2fda32d0d extract main conditional 2019-03-23 02:36:41 +01:00
Jérémy Lecour 3b8617b20c use grep -s instead of redirecting stderr 2019-03-23 02:36:41 +01:00
Jérémy Lecour 7cb7a47be7 improve readability 2019-03-23 02:36:41 +01:00
Jérémy Lecour 0afdfbf3a1 Use braces instead for command grouping.
It avoids subshells
2019-03-23 02:36:40 +01:00
Jérémy Lecour 9658e531ad quotes 2019-03-23 02:36:40 +01:00
Jérémy Lecour 2267b79618 remove unused IS_TOOMUCHDEBIANSYSMAINT 2019-03-23 02:36:40 +01:00
Jérémy Lecour fc3d2e28cf APACHEMUNIN: muunin config can be in other files 2019-03-23 02:36:40 +01:00
Jérémy Lecour a4c1629912 verbose comments for RAID checks 2019-03-23 02:36:40 +01:00
Jérémy Lecour d51c64d410 reorganize IS_APACHEMUNIN 2019-03-23 02:36:40 +01:00
Jérémy Lecour 3353096ebe don't use a sub shell for IS_REPVOLATILE 2019-03-23 02:36:40 +01:00
Jérémy Lecour 366fc03237 print duplicate labels on a single line 2019-03-23 02:36:40 +01:00
Jérémy Lecour 9b31ab030e fix "is_debian_lenny" 2019-03-23 02:36:40 +01:00
Jérémy Lecour 2ad82591f3 test if it's a file, to ignore directories 2019-03-23 02:36:40 +01:00
Jérémy Lecour c3b4efd71e fix debian version detection for IS_LSBRELEASE 2019-03-23 02:36:40 +01:00
Jérémy Lecour e525141ae4 move VERBOSE block to log comment 2019-03-23 02:36:40 +01:00
Jérémy Lecour 419ecbc10f fix conditions grouping 2019-03-23 02:36:40 +01:00
Jérémy Lecour 367756d6b2 variables extraction 2019-03-23 02:36:40 +01:00
Jérémy Lecour 99ddd1a05c better test ordering 2019-03-23 02:36:40 +01:00
Jérémy Lecour 3e14210a0b extract if 2019-03-23 02:36:40 +01:00
Jérémy Lecour 9dcdd8202e more permissions check with stat 2019-03-23 02:36:40 +01:00
Jérémy Lecour 057cb7026a even more quotes 2019-03-23 02:36:40 +01:00
Jérémy Lecour 0fc9d0921e grep can count occurrences too 2019-03-23 02:36:40 +01:00
Jérémy Lecour ae12b37c7f add verbose comments for IS_BACKPORTSCONF 2019-03-23 02:36:40 +01:00
Jérémy Lecour 830db4743c more quotes 2019-03-23 02:36:40 +01:00
Jérémy Lecour 38b0342d0c use stat instead of ls -l | grep 2019-03-23 02:36:10 +01:00
Jérémy Lecour 00311e8f0e quote 2019-03-23 02:36:10 +01:00
Jérémy Lecour fa79f1d1a8 big cleanup
* tests organization
* shellcheck conventions
* variables extractions
* quotes and indentations
2019-03-23 02:36:10 +01:00
Jérémy Lecour 2c44db77a3 replace `` with $()
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2019-03-23 02:30:18 +01:00
Jérémy Lecour 720ea03b0c Add IS_LSBRELEASE check 2019-03-23 02:29:24 +01:00
Jérémy Lecour 36fa3af815 replace old-fashioned tests with functions 2019-03-23 02:29:24 +01:00
Jérémy Lecour d3cb743f76 MINIFW_FILE for Debian Lenny 2019-03-23 02:28:53 +01:00
Jérémy Lecour 1b4b2a2ff8 workaround possibly missing lsb_release command 2019-03-23 02:28:53 +01:00
Jérémy Lecour 9c4a40b585 optimize OS/release/version detection 2019-03-23 02:28:53 +01:00