summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangYoun Kwak <sy.kwak@samsung.com>2024-04-23 19:57:30 +0900
committerSangYoun Kwak <sy.kwak@samsung.com>2024-04-24 19:39:06 +0900
commit7c839703773e745b206ce7ff453a14b05943f552 (patch)
tree580af316f40aa294865635293f7171e705e20e2d
parent6756449a9dc7a244e6001347c21567d5f411bc20 (diff)
downloadupgrade-tools-generic-7c839703773e745b206ce7ff453a14b05943f552.tar.gz
upgrade-tools-generic-7c839703773e745b206ce7ff453a14b05943f552.tar.bz2
upgrade-tools-generic-7c839703773e745b206ce7ff453a14b05943f552.zip
scripts: Add a script to download images
delta-generation-download-source-image.sh will be used to download source image for generating delta image. Change-Id: I007c9654f4762a73feccdcfa46b7f01ce940ade6 Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r--packaging/upgrade-tools-generic.spec12
-rwxr-xr-xscripts/delta-generation-download-source-image.sh37
2 files changed, 46 insertions, 3 deletions
diff --git a/packaging/upgrade-tools-generic.spec b/packaging/upgrade-tools-generic.spec
index c481637..9640323 100644
--- a/packaging/upgrade-tools-generic.spec
+++ b/packaging/upgrade-tools-generic.spec
@@ -1,3 +1,7 @@
+%define install_path /%{name}
+%define mk_delta_install_path %{install_path}/mk_delta
+%define scripts_install_path %{install_path}/scripts
+
Name: upgrade-tools-generic
Version: 1.0.0
Release: 0
@@ -22,8 +26,10 @@ make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
-mkdir -p %{buildroot}/upgrade-tools/mk_delta
-cp -r ./rpi4 %{buildroot}/upgrade-tools/mk_delta/.
+mkdir -p %{buildroot}/%{mk_delta_install_path}
+mkdir -p %{buildroot}/%{scripts_install_path}
+cp -r ./rpi4 %{buildroot}/%{mk_delta_install_path}/.
+cp scripts/* %{buildroot}/%{scripts_install_path}/.
%files
-/upgrade-tools/*
+%{install_path}/*
diff --git a/scripts/delta-generation-download-source-image.sh b/scripts/delta-generation-download-source-image.sh
new file mode 100755
index 0000000..44c23dc
--- /dev/null
+++ b/scripts/delta-generation-download-source-image.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+IMAGE_TYPE=''
+TIZEN_VERSION=''
+
+get_reference_image_file_name() {
+ local reference_image_url=$1
+ curl -s "${reference_image_url}/manifest.json" \
+ | tr '\n' ' ' \
+ | sed -n 's@.*\"image_files\".*:.*\[\s*"\([^"]*\)".*@\1@p'
+}
+
+download_reference_image_file() {
+ local reference_image_url="http://download.tizen.org/snapshots/TIZEN/${TIZEN_VERSION}/${TIZEN_VERSION}-Unified/reference/images/standard/${IMAGE_TYPE}"
+ local reference_image_file_name=$(get_reference_image_file_name "${reference_image_url}")
+ local reference_image_file_url="${reference_image_url}/${reference_image_file_name}"
+ curl -sO "${reference_image_file_url}"
+}
+
+IMAGE_TYPE=$1
+TIZEN_VERSION=$2
+
+if [[ -z ${IMAGE_TYPE} ]] || [[ -z ${TIZEN_VERSION} ]]; then
+ echo "$0: 2 parameters are required: <IMAGE_TYPE> <TIZEN_VERSION>"
+ echo -e "\t<IMAGE_TYPE>: ex) tizen-boot-armv7l-rpi4"
+ echo -e "\t<TIZEN_VERSION>: ex) Tizen-8.0"
+ exit 1
+fi
+
+download_reference_image_file
+
+RET=$?
+if [[ ${RET} -ne 0 ]]; then
+ echo "Failed to download image"
+fi
+
+exit ${RET}