-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·113 lines (100 loc) · 2.73 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·113 lines (100 loc) · 2.73 KB
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
#!/bin/sh
VARS="/opt/config/mod_data/variables.cfg"
if [ ! -f "$VARS" ]; then
echo "Error: $VARS not found"
exit 1
fi
bambufy_version=$(sed -n "s/^bambufy_version = //p" "$VARS")
#rename ifs_xxxxx to bambufy_xxxxx (variables.cfg)
awk '
/^\[Variables\]/ {
print
next
}
/^ifs_motion_sensor/ {
print
next
}
/^ifs_/ {
sub(/^ifs_/, "bambufy_")
print
next
}
{ print }
' "$VARS" > "$VARS.tmp" && mv "$VARS.tmp" "$VARS"
#web = mainsail|fluidd (variables.cfg)
WEB="fluidd"; grep -q "^CLIENT=mainsail" /opt/config/mod_data/web.conf && WEB="mainsail"
if grep -q "^[[:space:]]*web[[:space:]]*=" "$VARS"; then
sed -i "s|^[[:space:]]*web[[:space:]]*=.*|web = '$WEB'|" "$VARS"
else
echo "web = '$WEB'" >> "$VARS"
fi
if grep -q "^[[:space:]]*bambufy_mesh[[:space:]]*=" "$VARS"; then
sed -i "s|^[[:space:]]*bambufy_mesh[[:space:]]*=.*|bambufy_mesh = 0|" "$VARS"
else
echo "bambufy_mesh = 0" >> "$VARS"
fi
#display_off_timeout = 10 (variables.cfg)
if grep -qE '^[[:space:]]*display_off_timeout[[:space:]]*=' "$VARS" 2>/dev/null; then
sed -i 's/^[[:space:]]*display_off_timeout[[:space:]]*=.*/display_off_timeout = 10/' "$VARS"
else
echo "display_off_timeout = 10" >> "$VARS"
fi
#use kamp_offset as gcode_offset if exist
kamp_offset=$(sed -n "s/^kamp_offsets = //p" "$VARS")
if [ -n "$kamp_offset" ]; then
sed -i "/^\(kamp\|gcode\)_offsets = /d" "$VARS"
echo "gcode_offsets = $kamp_offset" >> "$VARS"
elif [ -z "$bambufy_version" ]; then #version empty
sed -i "/^gcode_offsets = /d" "$VARS"
echo "gcode_offsets = {'z': '0'}" >> "$VARS"
fi
#g28_tenz
CONF=/opt/config/printer.base.cfg
awk '
/^\[stepper_z\]/ {
in_z = 1
print
next
}
/^\[/ {
in_z = 0
print
next
}
in_z && /^[[:space:]]*position_endstop[[:space:]]*:/ && !/^[[:space:]]*;/ {
print ";" $0
next
}
{ print }
' ${CONF} > /tmp/tmp && mv /tmp/tmp $CONF
#update custom.css
cat > "/opt/config/.theme/custom.css" << 'EOF'
.v-dialog .bambufy-button{
width: 76px !important;
padding: 0 8px !important;
margin: 3px !important;
}
.v-dialog .bambufy-color{
width: 31px !important;
min-width: 31px !important;
padding: 0 8px !important;
margin: 3px !important;
}
.v-dialog .bambufy-type{
width: 54px !important;
min-width: 54px !important;
padding: 0 8px !important;
margin: 3px !important;
}
EOF
VERSION=2
#Version control for reinstallation if necessary.
if grep -q "^[[:space:]]*bambufy_version[[:space:]]*=" "$VARS"; then
sed -i "s|^[[:space:]]*bambufy_version[[:space:]]*=.*|bambufy_version = $VERSION|" "$VARS"
else
echo "bambufy_version = $VERSION" >> "$VARS"
fi
#uninstall g28_tenz: bambufy already include g28_tenz
sed -i "/plugins\/g28_tenz\//d" /opt/config/mod_data/plugins.cfg
echo "FIRMWARE_RESTART" >/tmp/printer