-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathremoteinfo.sh
executable file
·118 lines (105 loc) · 3.24 KB
/
remoteinfo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)
#
# Collect CoreELEC remote control configuration information
#
#####################################################
#
# Comand Line Arguments
# -l = Show local only
# -r = Remove items that are redundant between debug scripts, and show local only
#
#####################################################
OUTPUTFILE="/storage/remoteinfo.txt"
fancycat()
{
# $1 = file $2 = message if file not found
printf "------------ $1 ------------" >> $OUTPUTFILE
if [ -f $1 ]; then
printf "\n" >> $OUTPUTFILE
cat $1 | tr '\000' '\n' >> $OUTPUTFILE
else
printf " $2\n" >> $OUTPUTFILE
fi
}
fancychk()
{
printf "------------ $1 ------------" >> $OUTPUTFILE
if [ -f $1 ]; then
printf " Set by user!\n" >> $OUTPUTFILE
else
printf " Unset by user!\n" >> $OUTPUTFILE
fi
}
fancycatdir()
{
# $1 = directory $2 = filename pattern $3 = message if file not found
printf "------------ $1 ------------" >> $OUTPUTFILE
if [ -d $1 ]; then
printf "\n" >> $OUTPUTFILE
for filename in $1/$2
do
[ -e $filename ] || continue
if [ -f $filename ]; then
fancycat $filename $3
fi
done
else
printf " Directory Not Found!\n"
fi
}
wildcat()
{
# $1 = filename pattern $2 = message if file not found
printf "------------ $1 ------------" >> $OUTPUTFILE
if [ -e $1 ]; then
printf "\n" >> $OUTPUTFILE
for filename in $1
do
[ -e $filename ] || continue
if [ -f $filename ]; then
fancycat $filename $2
fi
done
else
printf " $2\n" >> $OUTPUTFILE
fi
}
printf "CoreELEC Remote Control Information...\n\n" > $OUTPUTFILE
if [ "$1" != "-r" ]; then
fancycat "/etc/os-release" "Not Found!"
fancycat "/proc/device-tree/coreelec-dt-id" "Not Found!"
fancycat "/proc/device-tree/le-dt-id" "Not Found!"
fancycat "/proc/cmdline" "Not Found!"
fi
fancycat "/proc/device-tree/meson-ir/status" "Not Found!"
fancycat "/proc/device-tree/meson-remote/status" "Not Found!"
fancychk "/storage/.config/remote.disable"
fancychk "/flash/remote.disable"
wildcat "/storage/.config/remote*.conf" "Unset by user!"
wildcat "/flash/remote*.conf" "Unset by user!"
fancycat "/storage/.config/lircd.conf" "Unset by user!"
fancycat "/storage/.config/lirc_options.conf" "Unset by user!"
fancycat "/storage/.config/rc_maps.cfg" "Unset by user!"
fancycatdir "/storage/.config/rc_keymaps" "*" "Unset by user!"
fancycat "/storage/.kodi/userdata/Lircmap.xml" "Unset by user!"
fancycat "/storage/.kodi/userdata/keyboard.xml" "Unset by user!"
fancycatdir "/storage/.kodi/userdata/keymaps" "*.xml" "Unset by user!"
printf "------------ BL301 ------------\n" >> $OUTPUTFILE
if [[ -x /usr/sbin/checkbl301 ]]; then
/usr/sbin/checkbl301 -v >> $OUTPUTFILE
else
printf "checkbl301 not found!\n"
fi
if [ "$1" != "-r" ]; then
fancycat "/flash/boot.ini" "Not Found!"
fancycat "/flash/config.ini" "Not Found!"
fancycat "/storage/.config/autostart.sh" "Unset by user!"
fi
if [ "$1" = "-l" ] || [ "$1" = "-r" ]; then
cat $OUTPUTFILE
else
paste $OUTPUTFILE
fi