sonic-buildimage/installer
Nazarii Hnydyn 6f0dbf2c44
[installer]: Prevent filesystem corruption (#7264)
This improvement reads current SONiC version directly from `/proc/cmdline`.
it supports `grub/aboot/uboot` bootloaders.

**Code snippet**:
```bash
cat /proc/cmdline | sed -n 's/^.*loop=\/*image-\(\S\+\)\/.*$/\1/p'
```

**Description**:
```
-n         don't print lines
s          substitute
^.*        matches anything before the <image_version>
loop=      matches <loop> kernel parameter
\/*image-  matches <image_version> prefix
\(\S\+\)   matches <image_version> group and assigns it to \1
\/.*$      matches anything after the <image_version>
\1         replace everything with <image_version>
p          print it
```
closes #6267

#### Why I did it
* To fix #6267

#### How I did it
* Fixed installer scripts

#### How to verify it
1. Write invalid SONiC version to sonic_version.yml
2. Run SONiC-To-SONiC update
2021-04-12 10:48:44 -07:00
..
arm64 [installer]: Prevent filesystem corruption (#7264) 2021-04-12 10:48:44 -07:00
armhf [installer]: Prevent filesystem corruption (#7264) 2021-04-12 10:48:44 -07:00
x86_64 [installer]: Prevent filesystem corruption (#7264) 2021-04-12 10:48:44 -07:00
sharch_body.sh [image]: build sonic-broadcom.raw image for sonic conversion from ftos (#901) 2017-08-27 20:13:38 -07:00