====== Online external images usage ======
* updated: Fri 26 May 2023 01:47:31 PM CST WIP:
* At this moment testing images not visible inside Wizard need to use force to show all files via write into eMMC ...
* Need to try to improve OOWOW image logic! original images slow check and show warnings, and don't have meta information WIP:
* Need to share this information with images developers for making better results
* Test repack image with ''xze'' - OK
* Test redirect usage to dl again with ''xze'' - OK
===== Original Armbian images =====
==== Testing ====
https://www.armbian.com/khadas-edge-2/
https://redirect.armbian.com/khadas-edge2/Jammy_legacy
```shell check original link
curl https://redirect.armbian.com/khadas-edge2/Jammy_legacy -i
HTTP/2 302
server: nginx/1.18.0
date: Fri, 26 May 2023 02:11:33 GMT
content-length: 0
location: https://mirror.iscas.ac.cn/armbian-releases/khadas-edge2/archive/Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
x-geo-distance: 3377558.166124
~$ curl -i http://redirect.armbian.com/khadas-edge2/Jammy_legacy
HTTP/1.1 302 Found
Server: nginx/1.18.0
Date: Fri, 26 May 2023 03:23:24 GMT
Content-Length: 0
Connection: keep-alive
Location: http://armbian.tnahosting.net/dl/khadas-edge2/archive/Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
X-Geo-Distance: 1883751.967384
```
=== Create redirection to external link ===
```shell create external image link
~$ echo http://redirect.armbian.com/khadas-edge2/Jammy_legacy > test-edge2-armbian-external.img.xz
storage@web:/storage/.images/edge2$ ls -l1 test-edge2-armbian-external.img.xz
-rw-rw-r-- 1 storage storage 54 May 25 23:24 test-edge2-armbian-external.img.xz
## setup permission for use link features
~$ chmod 0667 test-edge2-armbian-external.img.xz
~$ ls -l1 test-edge2-armbian-external.img.xz
-rw-rw-rwx 1 storage storage 54 May 25 23:24 test-edge2-armbian-external.img.xz
```
```shell check link redirection from dl server
~$ curl -is http://dl.khadas.com/.images/edge2/test-edge2-armbian-external.img.xz | head -n7
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Fri, 26 May 2023 05:32:14 GMT
Content-Type: text/html
Content-Length: 138
Connection: keep-alive
Location: http://redirect.armbian.com/khadas-edge2/Jammy_legacy
```
=== External link showing on web browser ===
/*
{{./original/oowow-edge2-images-list.webp?linkonly}}
*/
{{./original/oowow-edge2-images-list.webp?X800&direct}}
==== Images testing ====
```shell decompression original files
master@universe:~/khadas/img/edge2$ time xz -dc Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz > Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img
real 0m31.879s
user 0m30.135s
sys 0m1.418s
master@universe:~/khadas/img/edge2$ time pixz -dc Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img
real 0m3.181s
user 0m39.479s
sys 0m1.180s
~$ ls -l1 Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
-rw-rw-r-- 1 master master 582247696 May 26 10:11 Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
```
==== Screenshots problematic installation process ====
{{gallery>original?*.webp&lightbox&1920X1080}}
===== Repack testing =====
```sh repack original armbian image example
cd ~ && mkdir -p armbian-test && cd armbian-test # prepare space
# download xze script
wget https://raw.githubusercontent.com/khadas/krescue/master/tools/xze
chmod 0777 xze
# download original armbian image
wget --content-disposition http://redirect.armbian.com/khadas-edge2/Jammy_legacy
# decompress to raw
pixz -dc Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
# setup output filename
export OUT=Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
# compress image
./xze "Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img" \
--meta \
label=Armbian \
builder=Armbian \
date="$(LANG=C TZ= date)" \
match=BOARD=Edge2 \
link=https://www.armbian.com/khadas-edge-2/ \
duration=60 \
desc="Armbian Jammy legacy testing ... "
```
```shell check repacked image
~$ ./xze Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
Strms Blocks Compressed Uncompressed Ratio Check Filename
2 26 472.9 MiB 2,244.0 MiB 0.211 CRC64 Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
[i] blocks: 26 // 472.9*MiB // 2,244.0*MiB
##META_FILE##
FILE: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
UNPACKED_SIZE: 2353004544
PACKED_SIZE: 495833088
FILE_SIZE: 495837184
##META-FILE##
##KRESCUE_META##
type:xz
label: Armbian
builder: Armbian
date: Fri 26 May 2023 07:26:58 AM UTC
match: BOARD=Edge2
link: https://www.armbian.com/khadas-edge-2/
duration: 60
desc: Armbian Jammy legacy testing ...
image: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img
##KRESCUE-META##
##KRESCUE##END
```
```shell put redirect links to oowow collection
storage@web:/storage/.images/edge2$ cat test-edge2-armbian-external.img.xz
http://redirect.armbian.com/khadas-edge2/Jammy_legacy
storage@web:/storage/.images/edge2$ cat test-edge2-armbian-repack.img.xz
http://dl.khadas.com/.test/edge2/armbian/Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
```
==== check meta by online ====
```shell check meta by online
~$ curl -s -jkLf -r-4096 http://dl.khadas.com/.test/edge2/armbian/Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz | xz -dc
##META_FILE##
FILE: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
UNPACKED_SIZE: 2353004544
PACKED_SIZE: 495833088
FILE_SIZE: 495837184
##META-FILE##
##KRESCUE_META##
type:xz
label: Armbian
builder: Armbian
date: Fri 26 May 2023 07:26:58 AM UTC
match: BOARD=Edge2
link: https://www.armbian.com/khadas-edge-2/
duration: 60
desc: Armbian Jammy legacy testing ...
image: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img
##KRESCUE-META##
##KRESCUE##END
```
```shell check redirect from images collection
~$ curl http://dl.khadas.com/.images/edge2/test-edge2-armbian-repack.img.xz -i | head -n7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 138 100 138 0 0 251 0 --:--:-- --:--:-- --:--:-- 251
HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Fri, 26 May 2023 07:41:18 GMT
Content-Type: text/html
Content-Length: 138
Connection: keep-alive
Location: http://dl.khadas.com/.test/edge2/armbian/Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
```
```shell final check image meta
~$ curl -s -jkLf -r-4096 http://dl.khadas.com/.images/edge2/test-edge2-armbian-repack.img.xz | xz -dc
##META_FILE##
FILE: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img.xz
UNPACKED_SIZE: 2353004544
PACKED_SIZE: 495833088
FILE_SIZE: 495837184
##META-FILE##
##KRESCUE_META##
type:xz
label: Armbian
builder: Armbian
date: Fri 26 May 2023 07:26:58 AM UTC
match: BOARD=Edge2
link: https://www.armbian.com/khadas-edge-2/
duration: 60
desc: Armbian Jammy legacy testing ...
image: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160-repack.img
##KRESCUE-META##
##KRESCUE##END
```
==== Screenshots normal installation process ====
{{gallery>repack?*.webp&lightbox&1920X1080}}
===== Image oowow compatible requirements =====
We recommend using [[https://github.com/khadas/krescue/blob/master/tools/xze|zxe]] feature for image developers, to provide better service for users like as:
* Provide additional information about images
* Its fully compatible with the common xz format, and same possible to use anywhere
* Fast-checking image integrity before writing it
* Make warranty its image will be suitable for current board installation
* Fast optimal compression for fastest decompression on SBC
* Image signup
* etc...
Sure all requirements are **optional**, but why not follow them by other developers, because its images will be created especially for our devices
WIP:
```shell check oowow meta online example
~$ curl -s -jkLf -r-4096 http://dl.khadas.com/.images/edge2/edge2-ubuntu-22.04-server-linux-5.10-fenix-1.5-230425.img.xz | xz -dc
##META_FILE##
FILE: edge2-ubuntu-22.04-server-linux-5.10-fenix-1.5-230425.img.xz
UNPACKED_SIZE: 2634022912
PACKED_SIZE: 429813760
FILE_SIZE: 429817856
##META-FILE##
##KRESCUE_META##
type:xz
label: Ubuntu
match: BOARD=Edge2
builder: fenix
link: https://dl.khadas.com/Firmware/
desc: Ubuntu 1.5 server jammy - fenix generated images https://github.com/khadas/fenix
duration: 60
date: Tue 25 Apr 2023 01:56:58 PM UTC
image: edge2-ubuntu-22.04-server-linux-5.10-fenix-1.5-230425.img
##KRESCUE-META##
##KRESCUE##END
```
```shell show image meta online example for armbian
~$ curl -s -jkLf -r-4096 http://dl.khadas.com/.test/edge2/armbian/edge2-armbian-jammy-legacy-original-repack.img.xz | xz -dc
##META_FILE##
FILE: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img.xz
UNPACKED_SIZE: 2353004544
PACKED_SIZE: 495833088
FILE_SIZE: 495837184
##META-FILE##
##KRESCUE_META##
type:xz
label: Armbian
builder: Armbian
date: Fri 26 May 2023 06:03:01 AM UTC
match: BOARD=Edge2
link: https://www.armbian.com/khadas-edge-2/
duration: 60
desc: Armbian Jammy legacy testing ...
image: Armbian_23.2.9_Khadas-edge2_jammy_legacy_5.10.160.img
##KRESCUE-META##
##KRESCUE##END
```