Upgrade system » Historial » Versió 6
Roger Pueyo Centelles, 15-07-2015 10:31
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 | h3. Devices file |
||
46 | |||
47 | This file is needed to know which DEVICE_NAME (Alix, RouterStation, etc.) should be use by the device which is upgrading the system. |
||
48 | The syntax is: |
||
49 | <pre> |
||
50 | DEVICE_TYPE_HASH DEVICE_NAME |
||
51 | </pre> |
||
52 | |||
53 | DEVICE_TYPE_HASH is an special hash which is calculated using the next command (from inside the same device!) |
||
54 | |||
55 | <pre> |
||
56 | 6 | Roger Pueyo Centelles | ( [ -f /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || cat /proc/cpuinfo | egrep "^vendor_id|^model name|^machine") | md5sum | awk '{print $1}' |
57 | 1 | Pau Escrich | </pre> |
58 | 6 | Roger Pueyo Centelles | |
59 | Previously, -cat /proc/cpuinfo | egrep "^vendor_id|^model name|^machine" | md5sum | awk '{print $1}'- was used. |
||
60 | 1 | Pau Escrich | |
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 | 3 | Pau Escrich | # qmpcontrol upgrade http://fw.qmp.cat/testing/Alix-qMp_testing-sysupgrade-20120411_1932.bin |
79 | # qmpcontrol upgrade /tmp/Alix-qMp_testing-sysupgrade-20120411_1932.bin |
||
80 | 1 | Pau Escrich | |
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 |