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