-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.py
47 lines (36 loc) · 1.47 KB
/
installer.py
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
import mip
import urequests as requests
import network
import os
import machine
ssid = 'YOUR NETWORK NAME'
password = 'YOUR NETWORK PASSWORD'
sta_if = network.WLAN(network.STA_IF)
def downloadfile(filename, path):
r=requests.get(path).text()
file=open(filename, 'w')
file.write(r)
file.close()
print('Connecting to network: '+ssid)
sta_if.active(True)
sta_if.connect(ssid, password)
while not sta_if.isconnected():
print('.')
print('Installing SD Card library')
mip.install('sdcard')
#create directories
os.mkdir('/system')
os.mkdir('/apps')
os.mkdir('/tmp')
os.mkdir('/system/drivers')
downloadfile('/system/microOS.py', 'https://raw.githubusercontent.com/asherevan/microOS/master/microOS.py')
downloadfile('/system/functions.py', 'https://raw.githubusercontent.com/asherevan/microOS/master/functions.py')
downloadfile('/system/systemsettings.txt', 'https://raw.githubusercontent.com/asherevan/microOS/master/systemsettings.txt')
downloadfile('/system/sound.py', 'https://raw.githubusercontent.com/asherevan/microOS/master/sound.py')
downloadfile('/boot.py', 'https://raw.githubusercontent.com/asherevan/microOS/master/boot.py')
downloadfile('/system/appRefresh.py', 'https://raw.githubusercontent.com/asherevan/microOS/master/appRefresh.py')
downloadfile('/system/drivers/drivers.conf', 'https://raw.githubusercontent.com/asherevan/microOS/master/drivers/drivers.conf')
print('MicroOS has now been installed!')
os.remove('./installer.py')
time.sleep(1)
machine.reset()