Upgrade system » Historial » Versió 1
Pau Escrich, 11-04-2012 22:45
1 | 1 | Pau Escrich | h1. Upgrade system |
---|---|---|---|
2 | |||
3 | There is a function to easy upgrade the system. |
||
4 | |||
5 | These are the options available in /etc/config/qmp related with the upgrade system: |
||
6 | <pre> |
||
7 | config 'qmp' 'update' |
||
8 | option 'url' 'http://upc2.qmp.cat/qmp' |
||
9 | option 'images' 'IMAGES' |
||
10 | option 'devices' 'DEVICES' |
||
11 | option 'filter' 'sysupgrade' |
||
12 | option 'preserve' '/etc/config/qmp /etc/shadow /etc/passwd' |
||
13 | |||
14 | </pre> |
||
15 | |||
16 | * url: Specify the url (http, https or ftp) to get the images |
||
17 | * images: specify the name of the images file |
||
18 | * devices: specify the name of the devices file |
||
19 | * filter: specify a image name filter |
||
20 | * preserve: the list of file to preserve. Use "none" to specify any file |
||
21 | |||
22 | All these options have default values so define them is not mandatory |
||
23 | |||
24 | h3. Images file |
||
25 | |||
26 | This file is a list with the available images in the server. The syntax is: |
||
27 | <pre> |
||
28 | CHECKSUM_MD5 FILENAME |
||
29 | </pre> |
||
30 | |||
31 | There is an special syntax for the FILENAME: |
||
32 | |||
33 | <pre> |
||
34 | <DEVICE_NAME>-<FILTER>-<TIMESTAMP>_[OPTIONAL_INFORMATION].[OPTIONAL_EXTENSION] |
||
35 | </pre> |
||
36 | |||
37 | Some valid examples are: |
||
38 | # Alix-sysupgrade-20120411_1932.bin |
||
39 | # RouterStationPro-guifi-20120410.img |
||
40 | # NanoStationM5-sysupgrade-20120211_p4u |
||
41 | |||
42 | Of course the image file must be reachable from URL/FILENAME, so an easy way to generate this file is: |
||
43 | # Place your shell in the web server directory (with all the images) |
||
44 | # Execute: md5sum *.bin > IMAGES |
||
45 | |||
46 | |||
47 | h3. Devices file |
||
48 | |||
49 | This file is needed to know which DEVICE_NAME (Alix, RouterStation, etc.) should be use by the device which is upgrading the system. |
||
50 | The syntax is: |
||
51 | <pre> |
||
52 | DEVICE_TYPE_HASH DEVICE_NAME |
||
53 | </pre> |
||
54 | |||
55 | DEVICE_TYPE_HASH is an special hash which is calculated using the next command (from inside the same device!) |
||
56 | |||
57 | <pre> |
||
58 | cat /proc/cpuinfo | egrep "^vendor_id|^model name|^machine" | md5sum | awk '{print $1}' |
||
59 | </pre> |
||
60 | |||
61 | In theory this HASH is able to identify the kind of device! It works at least for: Alix, RouterStation, NanoStation, Tplink2543 |
||
62 | |||
63 | So, when a device checks if there is any new image, it first downloads this file to know which DEVICE_NAME must use. |
||
64 | |||
65 | A valid example of this file: |
||
66 | <pre> |
||
67 | d11c4c408a408f6a14c80b92d24af992 Alix |
||
68 | 5c220ec807601507cf28c785d944dcd2 Tplink2543 |
||
69 | 02f054340bd0eb44c7a9c5a2bbdb49f3 RouterStationPro |
||
70 | </pre> |
||
71 | |||
72 | h3. Executing the upgrade |
||
73 | |||
74 | There is a functions file placed on /etc/qmp/qmp_update.sh This file is used by "qmpcontrol" to perform the actions. |
||
75 | |||
76 | There are three ways to use the upgrade function: |
||
77 | # qmpcontrol upgrade |
||
78 | # qmpcontrol upgrade http://fw.qmp.cat/testing/Alix-sysupgrade-20120411_1932.bin |
||
79 | # qmpcontrol upgrade /tmp/Alix-sysupgrade-20120411_1932.bin |
||
80 | |||
81 | First one (default one) check the server url, get the devices file, get the images file and upgrade the system if there is any new version available |
||
82 | |||
83 | Second one upgrades from a specific URL |
||
84 | |||
85 | Third one upgrades from a image placed on the filesystem |