update Venus rollout script and guidance
This commit is contained in:
parent
2bc09112ae
commit
2fecc345db
Binary file not shown.
|
@ -29,14 +29,22 @@ async def run_rclocal(remote_host):
|
||||||
return await run_remote_command(remote_host, command)
|
return await run_remote_command(remote_host, command)
|
||||||
|
|
||||||
async def stop_battery_service(remote_host):
|
async def stop_battery_service(remote_host):
|
||||||
command = "/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB0"
|
command1 = "cd /opt/victronenergy/serial-starter && ./stop-tty.sh ttyUSB0"
|
||||||
# command = "/opt/victronenergy/serial-starter/stop-tty.sh ttyUSB1"
|
command2 = "cd /opt/victronenergy/serial-starter && ./stop-tty.sh ttyUSB1"
|
||||||
return await run_remote_command(remote_host, command)
|
|
||||||
|
result1 = await run_remote_command(remote_host, command1)
|
||||||
|
result2 = await run_remote_command(remote_host, command2)
|
||||||
|
|
||||||
|
return result1, result2
|
||||||
|
|
||||||
async def start_battery_service(remote_host):
|
async def start_battery_service(remote_host):
|
||||||
command = "/opt/victronenergy/serial-starter/start-tty.sh ttyUSB0"
|
command1 = "cd /opt/victronenergy/serial-starter && ./start-tty.sh ttyUSB0"
|
||||||
# command = "/opt/victronenergy/serial-starter/start-tty.sh ttyUSB1"
|
command2 = "cd /opt/victronenergy/serial-starter && ./start-tty.sh ttyUSB1"
|
||||||
return await run_remote_command(remote_host, command)
|
|
||||||
|
result1 = await run_remote_command(remote_host, command1)
|
||||||
|
result2 = await run_remote_command(remote_host, command2)
|
||||||
|
|
||||||
|
return result1, result2
|
||||||
|
|
||||||
async def resize(remote_host):
|
async def resize(remote_host):
|
||||||
command = "sh /opt/victronenergy/swupdate-scripts/resize2fs.sh"
|
command = "sh /opt/victronenergy/swupdate-scripts/resize2fs.sh"
|
||||||
|
@ -96,30 +104,55 @@ async def import_pika(remote_host):
|
||||||
command = f"{change_dir_command} && {install_command}"
|
command = f"{change_dir_command} && {install_command}"
|
||||||
return await run_remote_command(remote_host, command)
|
return await run_remote_command(remote_host, command)
|
||||||
|
|
||||||
|
async def make_rclocal_executable(remote_host):
|
||||||
|
command = "chmod +x /data/rc.local"
|
||||||
|
return await run_remote_command(remote_host, command)
|
||||||
|
|
||||||
|
async def check_connection(remote_host):
|
||||||
|
result = await run_remote_command(remote_host, 'echo Connection successful')
|
||||||
|
return "Connection successful" in result
|
||||||
|
|
||||||
|
async def restart_gui(remote_host):
|
||||||
|
command1 = "svc -d /service/gui"
|
||||||
|
command2 = "svc -u /service/gui"
|
||||||
|
result1 = await run_remote_command(remote_host, command1)
|
||||||
|
result2 = await run_remote_command(remote_host, command2)
|
||||||
|
|
||||||
|
return result1, result2
|
||||||
|
|
||||||
async def main(remote_host):
|
async def main(remote_host):
|
||||||
##### 1. check whether it's Venus ######
|
##### 1. check connection ######
|
||||||
|
print("Check connection!")
|
||||||
|
if not await check_connection(remote_host):
|
||||||
|
sys.exit("Failed to ssh!")
|
||||||
|
|
||||||
|
##### 2. check whether it's Venus ######
|
||||||
gx_type = await check_GX_type(remote_host)
|
gx_type = await check_GX_type(remote_host)
|
||||||
if gx_type == "beaglebone\n":
|
if gx_type == "beaglebone\n":
|
||||||
##### 2. upload VPN and battery files ######
|
##### 3. upload VPN and battery files ######
|
||||||
print("Upload pika and battery files!")
|
print("Upload pika and battery files!")
|
||||||
if(await upload_files(remote_host)!="All files uploaded successfully."):
|
if(await upload_files(remote_host)!="All files uploaded successfully."):
|
||||||
sys.exit("Failed to upload files!")
|
sys.exit("Failed to upload files!")
|
||||||
else:
|
else:
|
||||||
print(await upload_files(remote_host))
|
print(await upload_files(remote_host))
|
||||||
#### 3. import pika ####
|
#### 4. import pika ####
|
||||||
print("Import pika!")
|
print("Import pika!")
|
||||||
print(await import_pika(remote_host))
|
print(await import_pika(remote_host))
|
||||||
#### 4. resize /dev/root #####
|
#### 5. resize /dev/root #####
|
||||||
print("Resize /dev/root now!")
|
print("Resize /dev/root now!")
|
||||||
print(await resize(remote_host))
|
print(await resize(remote_host))
|
||||||
# ##### 5. run rc.local ######
|
#### 6. stop battery service ######
|
||||||
# print("Run rc.local to set password, timezone and cp battery folder!")
|
print("Stop battery service!")
|
||||||
# print(await run_rclocal(remote_host))
|
print(await stop_battery_service(remote_host))
|
||||||
##### 5. reboot to run rc.local and update qml ######
|
##### 7. run rc.local ######
|
||||||
print("Reboot!")
|
print("Run rc.local!")
|
||||||
print(await run_rclocal(remote_host))
|
print(await run_rclocal(remote_host))
|
||||||
|
##### 8. start battery service ######
|
||||||
|
print("Start battery service!")
|
||||||
|
print(await start_battery_service(remote_host))
|
||||||
|
##### 9. restart gui ######
|
||||||
|
print("Restart gui!")
|
||||||
|
print(await restart_gui(remote_host))
|
||||||
else:
|
else:
|
||||||
sys.exit("It's not Venus GX!")
|
sys.exit("It's not Venus GX!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue