Hexxeh / rpi-update

An easier way to update the firmware of your Raspberry Pi
MIT License
1.94k stars 232 forks source link

How to install new firmware from code (Uninterrupted by -y) ? #328

Closed gaamaaresosa closed 1 year ago

gaamaaresosa commented 1 year ago

I need to update the firmware by python code as how I update other packages and libs. I pass the Raspberry device to the client and I can't access it again. When user click a buttom it should upfate latest firmware.

When I use below command, I see my program is waiting for -y to press. os.system('sudo UPDATE_SELF=0 rpi-update')

If I -y on the command I get below warnings. os.system('sudo UPDATE_SELF=0 -y rpi-update')

$ sudo UPDATE_SELF=0 -y rpi-update sudo: invalid option -- 'y' usage: sudo -h | -K | -k | -V usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user] usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command] usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>] usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] file ...

pelwell commented 1 year ago

As the README says:

This repo is now deprecated Development is continuing at https://github.com/raspberrypi/rpi-update

Try os.system('echo y | sudo UPDATE_SELF=0 rpi-update').

gaamaaresosa commented 1 year ago

os.system('echo y | sudo UPDATE_SELF=0 rpi-update')

Thank you so much Pelwell, I will try this.

Edit: Thanks again ! With your tips my code updated the firmware in one shot.