77#
88
99Log=" /var/log/${0##*/ } .log"
10+ VerifyRepairExcludes=" /etc/|/boot/|cache|getty"
1011
1112Main () {
1213 # check if stdout is a terminal...
@@ -32,18 +33,18 @@ Main() {
3233VerifyFiles () {
3334 echo -e " \n### file verification:\n"
3435
35- OUTPUT=$( dpkg --verify | egrep -v " /etc/|/boot/ " | awk -F" /" ' {print "/"$2}' )
36+ OUTPUT=$( dpkg --verify | egrep -v -i " ${VerifyRepairExcludes} " | awk -F" /" ' {print "/"$2}' )
3637
3738 if [[ -z $OUTPUT ]]; then
3839 echo -e " ${LGREEN}${BOLD} It would appear you don't have any corrupt files or packages!${NC} "
3940 echo -e " If you still have concerns, use this scripts media test mode"
4041 echo -e " to do a stress test of your drive/storage device.\n"
4142 else
42- echo -e " ${LRED}${BOLD} It appears you may have corrupt packages.${NC} To prevent avoidable issues in the"
43- echo -e " future (and reduce support requests on the forum) it is strongly recommended "
44- echo -e " you re-run this script NOW in fix (-f) mode to try and fix these packages! \n"
43+ echo -e " ${LRED}${BOLD} It appears you * may* have corrupt packages.${NC} If you believe this to be the"
44+ echo -e " case (and not a customisation that you or a script has applied), re-run this "
45+ echo -e " script in fix mode to try and fix these packages. \n"
4546
46- echo -e " ### The following suspect files or issues were detected:\n"
47+ echo -e " ### The following changed from packaged state files were detected:\n"
4748 echo -e " ${OUTPUT} \n"
4849 fi
4950
@@ -53,17 +54,17 @@ VerifyFiles() {
5354VerifyAndFixFiles () {
5455 echo -e " \n### file verification and file/package repair:\n"
5556
56- STAGE1=$( dpkg --verify | egrep -v " /etc/|/boot/ " | awk -F" /" ' {print "/"$2}' )
57+ STAGE1=$( dpkg --verify | egrep -v -i " ${VerifyRepairExcludes} " | awk -F" /" ' {print "/"$2}' )
5758
5859 if [[ -z $STAGE1 ]]; then
5960 echo -e " ${LGREEN}${BOLD} It would appear you don't have any corrupt files or packages!${NC} "
6061 echo -e " \nIf you are experiencing issues, it is probably best to back"
6162 echo -e " up your data, and reinstall the OS from a new image.\n"
6263 else
63- echo -e " ### The following files were found to be corrupt :\n"
64+ echo -e " ### The following changed from packaged state files were detected :\n"
6465 echo -e " ${STAGE1} "
6566
66- echo -e " \n### Identifying which packages the corrupt files belong to... "
67+ echo -e " \n### Identifying which packages the changed files belong to... "
6768 STAGE2=$( echo " ${STAGE1} " | while read ; do dpkg -S " ${REPLY} " | cut -f1 -d: ; done | sort | uniq)
6869
6970 if [[ -z ${STAGE2} ]]; then
@@ -267,13 +268,19 @@ GetDevice() {
267268} # GetDevice
268269
269270UploadSupportLogs () {
271+ # prevent colour escape sequences in log
272+ BOLD=' '
273+ NC=' '
274+ LGREEN=' '
275+ LRED=' '
276+
270277 # check requirements
271278 which fping > /dev/null 2>&1 || MissingTools=" fping"
272279 which curl > /dev/null 2>&1 || MissingTools=" ${MissingTools} curl"
273280 which iostat > /dev/null 2>&1 || MissingTools=" ${MissingTools} sysstat"
274281
275282 if [ " X${MissingTools} " != " X" ]; then
276- echo -e " Some tools are missing, installing: \c ${MissingTools} " >&2
283+ echo -e " Some tools are missing, installing: ${MissingTools} " >&2
277284 apt-get -f -qq -y install ${MissingTools} > /dev/null 2>&1
278285 fi
279286
@@ -292,7 +299,7 @@ UploadSupportLogs() {
292299 sed -E ' s/([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3}\.)([0-9]{1,3})/XXX.XXX.\3\4/g' \
293300 | curl -F ' sprunge=<-' http://sprunge.us
294301
295- echo -e " Please post the above URL in the pine64 forum where you've been asked for it."
302+ echo -e " Please post the above URL on the forum where you've been asked for it."
296303} # UploadSupportLogs
297304
298305RequireRoot () {
0 commit comments