-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildBot.lua
More file actions
33 lines (33 loc) · 1.31 KB
/
Copy pathbuildBot.lua
File metadata and controls
33 lines (33 loc) · 1.31 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
socket=require"ssl.https"
chat_id="-182420953"
chat_id="-213111483"
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
os.execute("nano /tmp/message")
os.execute("cd .. && sudo umount mnt")
os.execute("cd .. && sshfs root@a20-olimex-2:/media/usb-stick/site/qdigi/downloads mnt")
if os.execute("./build") and os.execute("mkdir -p lbuild && cd lbuild && /usr/local/Qt-5.10-static/bin/qmake ../qdigi.pro && make -j8") then
os.execute("cp INSTALL install.sh lbuild")
os.execute("cd lbuild && tar -czf qdigi.tar.gz qdigi")
os.execute("rm -rf win;mkdir win")
os.execute("cp qdigi.zip ../mnt/")
os.execute("cp lbuild/qdigi ../mnt/")
os.execute("cp lbuild/qdigi.tar.gz ../mnt/")
os.execute("cd win && unzip ../qdigi.zip")
os.execute("cp -r win/qdigi/* ~/mnt/")
U=io.open("/tmp/message")
message=U:read("*a")
U:close()
if (message:gsub("\n","")):len()>0 then
message="Neues Update:\n"..message
print(socket.request("https://api.telegram.org/bot324897373:AAGKPfQHDUqWPIE7EyT_ScgeCLfU2iaWvHg/sendMessage?chat_id="..chat_id.."&text="..urlencode(message)))
end
os.execute("rm -rf win qdigi")
end