Skip to content

Commit 3b70461

Browse files
pfeerickayufan
authored andcommitted
Changes based on tkaiser feedback on OMV (#31)
* Changes on tkaiser feedback on OMV Added extra exclusions for verify/repair mode. Changed wording of fix/verify messages to be a bit less scary. Removed a leftover pine64 reference. Prevent colour escape making it into the uploaded support log. pfeerick/pine64-scripts@feec9d3 * Remove escape character blocking echo output
1 parent aadd1a0 commit 3b70461

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

package/root/usr/local/sbin/pine64_diagnostics.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88

99
Log="/var/log/${0##*/}.log"
10+
VerifyRepairExcludes="/etc/|/boot/|cache|getty"
1011

1112
Main() {
1213
# check if stdout is a terminal...
@@ -32,18 +33,18 @@ Main() {
3233
VerifyFiles() {
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() {
5354
VerifyAndFixFiles() {
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

269270
UploadSupportLogs() {
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

298305
RequireRoot() {

0 commit comments

Comments
 (0)