System Upgrade Procedure internals » History » Version 1
Oleksandr Rybalko, 05/16/2012 11:10 AM
1 | 1 | Oleksandr Rybalko | h1. System Upgrade Procedure internals |
---|---|---|---|
2 | 1 | Oleksandr Rybalko | |
3 | 1 | Oleksandr Rybalko | # Web interface show page to user with following form: |
4 | 1 | Oleksandr Rybalko | <pre> |
5 | 1 | Oleksandr Rybalko | <form method="POST" action="/upgrade.lua" enctype="multipart/form-data"> |
6 | 1 | Oleksandr Rybalko | <input type="file" name="firmware" /> |
7 | 1 | Oleksandr Rybalko | <input type="submit" value="Upgrade" /> |
8 | 1 | Oleksandr Rybalko | </form> |
9 | 1 | Oleksandr Rybalko | </pre> |
10 | 1 | Oleksandr Rybalko | # User input filename |
11 | 1 | Oleksandr Rybalko | # User activate submit |
12 | 1 | Oleksandr Rybalko | # Action page (can be other than "/upgrade.lua", depend on Web interface handler) receive request: |
13 | 1 | Oleksandr Rybalko | ## Stop watchdog |
14 | 1 | Oleksandr Rybalko | ## Stop Wireless |
15 | 1 | Oleksandr Rybalko | ## Stop services not used in networking |
16 | 1 | Oleksandr Rybalko | ## Stop IPSec? (maybe better to keep it running, for case when corporate admin update boxes remotely) |
17 | 1 | Oleksandr Rybalko | ## Allocate memory storage with size of /dev/(map|redboot)/upgrade partition @mdconfig -a -t malloc -s8m -o reserve@ |
18 | 1 | Oleksandr Rybalko | ## Run _upgrade_ utility on a separate port with current web interface login/password hash (so _upgrade_ will be able to check it) |
19 | 1 | Oleksandr Rybalko | @upgrade -p 79 -H YWRtaW46YWRtaW4= -S /dev/md1@ |
20 | 1 | Oleksandr Rybalko | ## Send redirect header to new port (79 in example) |
21 | 1 | Oleksandr Rybalko | # Browser made new connection to port that port and send form |
22 | 1 | Oleksandr Rybalko | # _upgrade_ accept connection |
23 | 1 | Oleksandr Rybalko | ## Verify storage presence (/dev/md1) |
24 | 1 | Oleksandr Rybalko | ## Verify browser supplied Authentication hash |
25 | 1 | Oleksandr Rybalko | ## Get multipart boundary key |
26 | 1 | Oleksandr Rybalko | ## Search for Content-Disposition: form-data; name="firmware"; filename="${firmware name}" |
27 | 1 | Oleksandr Rybalko | ## Parse filename to get Vendor, Model, H/W_Rev, Version? and md5 hash (D-Link_DIR-620-0.1-ALPHA.45c7222d56450210c701452833b83201.zimage) |
28 | 1 | Oleksandr Rybalko | ## Check Vendor, Model, H/W_Rev |
29 | 1 | Oleksandr Rybalko | ## Check Version? |
30 | 1 | Oleksandr Rybalko | ## Fetch, md5, store (to /dev/md1) until boundary key |
31 | 1 | Oleksandr Rybalko | ## Check if md5 hash equals |
32 | 1 | Oleksandr Rybalko | ### if Bad - do reboot |
33 | 1 | Oleksandr Rybalko | ## kill other services? |
34 | 1 | Oleksandr Rybalko | ## write new firmware to /dev/(map|redboot)/upgrade |
35 | 1 | Oleksandr Rybalko | ## reboot |