From 15204682b811a655e8f1802b82473b44351b79e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Michalak-Szmaci=C5=84ski?= <25711553+DamMicSzm@users.noreply.github.com> Date: Tue, 2 Aug 2022 07:37:35 +0200 Subject: [PATCH] [TIZEN] Support for installing Tizen SDK without docker (#21346) * [TIZEN] Support for installing Tizen SDK without docker * Style fixes * Update integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh Co-authored-by: Arkadiusz Bokowy * Update integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh Co-authored-by: Arkadiusz Bokowy * Update integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh Co-authored-by: Arkadiusz Bokowy * Download changes * Update Docker file version and add lost one PATH for echo export Co-authored-by: Arkadiusz Bokowy --- config/tizen/scripts/install_sdk.sh | 88 ----- .../docker/images/chip-build-tizen/Dockerfile | 126 +------ .../tizen-sdk-installer/install.sh | 330 ++++++++++++++++++ .../{ => tizen-sdk-installer}/secret-tool.py | 0 integrations/docker/images/chip-build/version | 2 +- scripts/setup/tizen/sdk-installer | 1 + 6 files changed, 346 insertions(+), 201 deletions(-) delete mode 100755 config/tizen/scripts/install_sdk.sh create mode 100755 integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh rename integrations/docker/images/chip-build-tizen/{ => tizen-sdk-installer}/secret-tool.py (100%) create mode 120000 scripts/setup/tizen/sdk-installer diff --git a/config/tizen/scripts/install_sdk.sh b/config/tizen/scripts/install_sdk.sh deleted file mode 100755 index 7d9facad97a239..00000000000000 --- a/config/tizen/scripts/install_sdk.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -ROOTSTRAP_PATH="$1" -CHIPROOT=$(git rev-parse --show-toplevel) - -NSD_DNS_LIBS="libnsd-dns-sd.so*" - -echo "$ROOTSTRAP_PATH" - -if [ -z "$ROOTSTRAP_PATH" ]; then - echo "ROOTSTRAP_PATH should be input" - exit 1 -fi - -if [[ ! -d $ROOTSTRAP_PATH ]]; then - echo "Can't find the rootstrap dir, please make dir and run this script again" - exit 1 -fi - -cd "$ROOTSTRAP_PATH" - -# Get Tizen rootstrap -if [[ ! -f mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip ]]; then - echo "Getting tizen rootstrap..." - wget http://download.tizen.org/sdk/tizenstudio/official/binary/mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip -fi -unzip mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip -mv data/platforms/tizen-6.0/mobile/rootstraps/mobile-6.0-device.core/usr . -mv data/platforms/tizen-6.0/mobile/rootstraps/mobile-6.0-device.core/lib . - -# Clean files -rm -rf data -rm -rf mobile-6.0-rs-device.* -rm pkginfo.manifest - -# Copy internal dns-sd header into rootstrap -# After finishing ACR for internal APIs, we will remove this. - -rm "$ROOTSTRAP_PATH/usr/lib/$NSD_DNS_LIBS" - -# Get tizen packages -function download_pkg() { - if [ "$2" = "snapshots" ]; then - wget -r -nd --no-parent -A "$1" "http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/armv7l/" - else - wget -r -nd --no-parent -A "$1" "http://download.tizen.org/releases/milestone/tizen/${2:-base}/latest/repos/standard/packages/armv7l/" - fi -} - -# Base package -for pkg in 'pcre-devel-*.armv7l.rpm' 'libffi-devel-*.armv7l.rpm' 'libmount-devel-*.armv7l.rpm' \ - 'libblkid-devel-*.armv7l.rpm' 'libcap-*.armv7l.rpm' 'liblzma-*.armv7l.rpm'; do - download_pkg "$pkg" -done - -# Unified package -for pkg in 'vconf-compat-*.armv7l.rpm' 'libcynara-commons-*.armv7l.rpm' 'cynara-devel-*.armv7l.rpm' \ - 'libcynara-client-*.armv7l.rpm' 'dbus-1*.armv7l.rpm' 'dbus-devel-*.armv7l.rpm' \ - 'dbus-libs-1*.armv7l.rpm' 'glib2-devel-2*.armv7l.rpm' 'libdns_sd-*.armv7l.rpm' \ - 'buxton2-*.armv7l.rpm' 'libsystemd-*.armv7l.rpm'; do - download_pkg "$pkg" unified -done - -# Latest snapshots package (For nsd) -for pkg in 'capi-network-nsd-0*.armv7l.rpm' 'capi-network-nsd-devel*.armv7l.rpm' 'libnsd-dns-sd*.armv7l.rpm' 'libdns_sd-*.armv7l.rpm'; do - download_pkg "$pkg" snapshots -done - -unrpm *.rpm - -cp usr/lib/pkgconfig/openssl1.1.pc usr/lib/pkgconfig/openssl.pc - -rm usr/lib/libdns_sd.so -cp usr/lib/libdns_sd.so.878.* usr/lib/libdns_sd.so - -rm *.rpm - -# Get toolchain -wget http://download.tizen.org/sdk/tizenstudio/official/binary/cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip -unzip cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip - -cp -rf data/tools/arm-linux-gnueabi-gcc-9.2/* . - -rm pkginfo.manifest -rm changelog -rm -rf data - -rm cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip diff --git a/integrations/docker/images/chip-build-tizen/Dockerfile b/integrations/docker/images/chip-build-tizen/Dockerfile index 13fb66e234f1db..4aac9c1846f01a 100644 --- a/integrations/docker/images/chip-build-tizen/Dockerfile +++ b/integrations/docker/images/chip-build-tizen/Dockerfile @@ -21,132 +21,34 @@ RUN set -x \ cpio \ obs-build \ openjdk-8-jre-headless \ + wget \ zip \ # Cleanup && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/apt/lists \ && : # last line # ------------------------------------------------------------------------------ -# Install tizen SDK -ENV TIZEN_SDK_ROOT /opt/tizen-sdk +# Install tizen ENV TIZEN_VERSION 6.0 +ENV TIZEN_SDK_ROOT /opt/tizen-sdk -WORKDIR /tmp/workdir - -# ------------------------------------------------------------------------------ -# Get tizen studio CLI +COPY tizen-sdk-installer /tmp/tizen-sdk-installer RUN set -x \ - && mkdir -p $TIZEN_SDK_ROOT \ - # Download - && wget --progress=dot:giga \ - http://download.tizen.org/sdk/tizenstudio/official/binary/certificate-encryptor_1.0.7_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/certificate-generator_0.1.3_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/new-common-cli_2.5.7_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/new-native-cli_2.5.7_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/sdb_4.2.23_ubuntu-64.zip \ - # Install tizen studio CLI - && unzip -o '*.zip' \ - && cp -rf data/* $TIZEN_SDK_ROOT \ - && echo "TIZEN_SDK_INSTALLED_PATH=$TIZEN_SDK_ROOT" > $TIZEN_SDK_ROOT/sdk.info \ - && echo "TIZEN_SDK_DATA_PATH=$USER_HOME/tizen-sdk-data" >> $TIZEN_SDK_ROOT/sdk.info \ - && ln -sf $USER_HOME/.tizen-cli-config $TIZEN_SDK_ROOT/tools/.tizen-cli-config \ + && bash /tmp/tizen-sdk-installer/install.sh \ + --tizen-sdk-path $TIZEN_SDK_ROOT \ + --tizen-sdk-data-path $USER_HOME/tizen-sdk-data \ + --tizen-version $TIZEN_VERSION \ + --override-secret-tool \ # Cleanup - && rm -rf /tmp/workdir \ + && rm -rf /tmp/tizen-sdk-installer \ && : # last line -COPY secret-tool.py $TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool -RUN chmod 0755 $TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool -ENV PATH="$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH" - # ------------------------------------------------------------------------------ -# Get toolchain -RUN set -x \ - && mkdir -p $TIZEN_SDK_ROOT \ - # Download - && wget --progress=dot:giga \ - http://download.tizen.org/sdk/tizenstudio/official/binary/cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/sbi-toolchain-gcc-9.2.cpp.app_2.2.16_ubuntu-64.zip \ - # Install toolchain - && unzip -o '*.zip' \ - && cp -rf data/* $TIZEN_SDK_ROOT \ - # Cleanup - && rm -rf /tmp/workdir \ - && : # last line - +# Set environment ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2 -ENV PATH="$TIZEN_SDK_TOOLCHAIN/bin:$PATH" - -# ------------------------------------------------------------------------------ -# Get tizen sysroot -ENV TIZEN_SDK_SYSROOT \ - $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core -RUN set -x \ - # Base sysroot - && wget --progress=dot:giga \ - http://download.tizen.org/sdk/tizenstudio/official/binary/mobile-$TIZEN_VERSION-core-add-ons_0.0.262_ubuntu-64.zip \ - http://download.tizen.org/sdk/tizenstudio/official/binary/mobile-$TIZEN_VERSION-rs-device.core_0.0.123_ubuntu-64.zip \ - # Base packages - && wget --progress=dot:mega -r -nd --no-parent \ - http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/armv7l/ \ - -A 'iniparser-*.armv7l.rpm' \ - -A 'libblkid-devel-*.armv7l.rpm' \ - -A 'libcap-*.armv7l.rpm' \ - -A 'libffi-devel-*.armv7l.rpm' \ - -A 'liblzma-*.armv7l.rpm' \ - -A 'libmount-devel-*.armv7l.rpm' \ - -A 'libncurses6-*.armv7l.rpm' \ - -A 'libreadline-*.armv7l.rpm' \ - -A 'libuuid-*.armv7l.rpm' \ - -A 'pcre-devel-*.armv7l.rpm' \ - -A 'readline-devel-*.armv7l.rpm' \ - -A 'xdgmime-*.armv7l.rpm' \ - # Unified packages - && wget --progress=dot:mega -r -nd --no-parent \ - http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/armv7l/ \ - -A 'aul-0*.armv7l.rpm' \ - -A 'aul-devel-*.armv7l.rpm' \ - -A 'bundle-0*.armv7l.rpm' \ - -A 'bundle-devel-*.armv7l.rpm' \ - -A 'buxton2-*.armv7l.rpm' \ - -A 'cynara-devel-*.armv7l.rpm' \ - -A 'dbus-1*.armv7l.rpm' \ - -A 'dbus-devel-*.armv7l.rpm' \ - -A 'dbus-libs-1*.armv7l.rpm' \ - -A 'glib2-devel-2*.armv7l.rpm' \ - -A 'json-glib-devel-*.armv7l.rpm' \ - -A 'libcynara-client-*.armv7l.rpm' \ - -A 'libcynara-commons-*.armv7l.rpm' \ - -A 'libdns_sd-*.armv7l.rpm' \ - -A 'libjson-glib-*.armv7l.rpm' \ - -A 'libsessiond-0*.armv7l.rpm' \ - -A 'libsystemd-*.armv7l.rpm' \ - -A 'libtzplatform-config-*.armv7l.rpm' \ - -A 'parcel-0*.armv7l.rpm' \ - -A 'parcel-devel-*.armv7l.rpm' \ - -A 'pkgmgr-info-*.armv7l.rpm' \ - -A 'vconf-compat-*.armv7l.rpm' \ - -A 'vconf-internal-keys-devel-*.armv7l.rpm' \ - # Unified packages (snapshots) - && wget --progress=dot:mega -r -nd --no-parent \ - http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/armv7l/ \ - -A 'capi-network-nsd-*.armv7l.rpm' \ - -A 'capi-network-thread-*.armv7l.rpm' \ - -A 'libnsd-dns-sd-*.armv7l.rpm' \ - # Install base sysroot - && unzip -o '*.zip' \ - && cp -rf data/* $TIZEN_SDK_ROOT \ - # Install packages - && unrpm *.rpm \ - && cp -rf lib usr $TIZEN_SDK_SYSROOT \ - # Make symbolic links relative - && for LNK in $(find $TIZEN_SDK_SYSROOT/usr/lib -maxdepth 1 -type l); \ - do ln -sf $(basename $(readlink "$LNK")) "$LNK" ; done \ - && ln -sf ../../lib/libcap.so.2 $TIZEN_SDK_SYSROOT/usr/lib/libcap.so \ - && ln -sf openssl1.1.pc $TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc \ - # Cleanup - && rm -rf /tmp/workdir \ - && : # last line +ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core +ENV PATH="$TIZEN_SDK_TOOLCHAIN/bin:$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH" # ------------------------------------------------------------------------------ # Switch to the non-root user diff --git a/integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh b/integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh new file mode 100755 index 00000000000000..f4c3222cd5a599 --- /dev/null +++ b/integrations/docker/images/chip-build-tizen/tizen-sdk-installer/install.sh @@ -0,0 +1,330 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +# Default settings options +TIZEN_SDK_ROOT=/opt/tizen-sdk +TIZEN_SDK_DATA_PATH=~/tizen-sdk-data +TIZEN_VERSION=6.0 +SECRET_TOOL=false + +SCRIPT_NAME=$(basename -- "$(readlink -f "${BASH_SOURCE:?}")") +SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE:?}")") +DEPENDENCIES=('cpio' 'openjdk-8-jre-headless' 'obs-build' 'wget' 'zip') + +# If color is available use colors +if which tput >/dev/null 2>&1 && [[ $(tput -T $TERM colors) -ge 8 ]]; then + COLOR_NONE="$(tput sgr0)" + COLOR_RED="$(tput setaf 1)" + COLOR_GREEN="$(tput setaf 2)" + COLOR_YELLOW="$(tput setaf 3)" + COLOR_BLUE="$(tput setaf 4)" +fi + +# ------------------------------------------------------------------------------ +# Help display function +function show_help() { + echo "Usage: $SCRIPT_NAME [ options .. ]" + echo "Example: $SCRIPT_NAME --tizen-sdk-path ~/tizen-sdk --tizen-version 6.0 --install-dependencies" + echo + echo "Options:" + echo " --help Display this information" + echo " --tizen-sdk-path Set directory where Tizen will be installed. Default is $TIZEN_SDK_ROOT" + echo " --tizen-sdk-data-path Set directory where Tizen have data. Default is $TIZEN_SDK_DATA_PATH" + echo " --install-dependencies This options install all dependencies." + echo " --tizen-version Select Tizen version. Default is $TIZEN_VERSION" + echo " --override-secret-tool Without password manager circumvents the requirement of having functional D-Bus Secrets service" + echo + echo "Note:" + echo "The script should run fully with ubuntu. For other distributions you may have to manually" + echo "install all needed dependencies. Use the script specifying --tizen-sdk-path with or" + echo "without --tizen-version. The script will only install the tizen platform for Matter." +} + +# ------------------------------------------------------------------------------ +# Error print function +function error() { + echo "$COLOR_RED[ERROR]: $1$COLOR_NONE" +} + +# ------------------------------------------------------------------------------ +# Info print function +function info() { + echo "$COLOR_GREEN$1$COLOR_NONE" +} + +# ------------------------------------------------------------------------------ +# Warning print function +function warning() { + echo "$COLOR_YELLOW[WARNING]: $1$COLOR_NONE" +} + +# ------------------------------------------------------------------------------ +# Show dependencies +function show_dependencies() { + warning "Need dependencies for use this script installation SDK: cpio wget unzip unrpm" + warning "Need dependencies for Tizen SDK: JAVA JRE >=8.0" +} + +# ------------------------------------------------------------------------------ +# Function helper massive download +# Usage: download "url_dir_package" ${package_array[@]} +function download() { + echo "$COLOR_BLUE" + + PKGS=() + for PKG in "${@:2}"; do + PKGS+=("-A" "$PKG") + done + wget -r -nd --no-parent --progress=dot:mega "${PKGS[@]}" "$1" + + # Check if the files have been downloaded + for PKG in "${@:2}"; do + if [[ ! $(find . -type f -name "$PKG") ]]; then + error "PKG is missing: $PKG" + return 1 + fi + done + + echo -n "$COLOR_NONE" +} + +# ------------------------------------------------------------------------------ +# Function install all dependencies. +function install_dependencies() { + if ! command -v apt-get &>/dev/null; then + show_dependencies + error "Cannot install dependencies - apt package manager not available. Install dependencies manually." + return 1 + fi + + info "Installing dependencies" + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends "${DEPENDENCIES[@]}" || return +} + +# ------------------------------------------------------------------------------ +# Function clean on EXIT +function cleanup() { + rm -rf "${TMP_DIR:?}" +} + +# ------------------------------------------------------------------------------ +# Function install tizen sdk. +function install_tizen_sdk() { + + mkdir -p "$TIZEN_SDK_ROOT" || return + + info "Tizen SDK installation directory: $TIZEN_SDK_ROOT" + + TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core" + + # Get tizen studio CLI + info "Get tizen studio CLI [...]" + cd "$TMP_DIR" || return + + # Download + URL="http://download.tizen.org/sdk/tizenstudio/official/binary/" + PKG_ARR=( + 'certificate-encryptor_1.0.7_ubuntu-64.zip' + 'certificate-generator_0.1.3_ubuntu-64.zip' + 'new-common-cli_2.5.7_ubuntu-64.zip' + 'new-native-cli_2.5.7_ubuntu-64.zip' + 'sdb_4.2.23_ubuntu-64.zip') + download "$URL" "${PKG_ARR[@]}" + + # Get toolchain + info "Get toolchain" + + # Download + URL="http://download.tizen.org/sdk/tizenstudio/official/binary/" + PKG_ARR=( + "cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip" + "sbi-toolchain-gcc-9.2.cpp.app_2.2.16_ubuntu-64.zip") + download "$URL" "${PKG_ARR[@]}" + + # Get tizen sysroot + info "Get tizen sysroot" + + # Base sysroot + # Different versions of tizen have different rootstrap versions + URL="http://download.tizen.org/sdk/tizenstudio/official/binary/" + PKG_ARR=( + "mobile-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip" + "mobile-$TIZEN_VERSION-rs-device.core_*_ubuntu-64.zip") + download "$URL" "${PKG_ARR[@]}" + + # Base packages + URL="http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/armv7l/" + PKG_ARR=( + 'iniparser-*.armv7l.rpm' + 'libblkid-devel-*.armv7l.rpm' + 'libcap-*.armv7l.rpm' + 'libffi-devel-*.armv7l.rpm' + 'liblzma-*.armv7l.rpm' + 'libmount-devel-*.armv7l.rpm' + 'libncurses6-*.armv7l.rpm' + 'libreadline-*.armv7l.rpm' + 'libuuid-*.armv7l.rpm' + 'pcre-devel-*.armv7l.rpm' + 'readline-devel-*.armv7l.rpm' + 'xdgmime-*.armv7l.rpm') + download "$URL" "${PKG_ARR[@]}" + + # Unified packages + URL="http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/armv7l/" + PKG_ARR=( + 'aul-0*.armv7l.rpm' + 'aul-devel-*.armv7l.rpm' + 'bundle-0*.armv7l.rpm' + 'bundle-devel-*.armv7l.rpm' + 'buxton2-*.armv7l.rpm' + 'cynara-devel-*.armv7l.rpm' + 'dbus-1*.armv7l.rpm' + 'dbus-devel-*.armv7l.rpm' + 'dbus-libs-1*.armv7l.rpm' + 'glib2-devel-2*.armv7l.rpm' + 'json-glib-devel-*.armv7l.rpm' + 'libcynara-client-*.armv7l.rpm' + 'libcynara-commons-*.armv7l.rpm' + 'libdns_sd-*.armv7l.rpm' + 'libjson-glib-*.armv7l.rpm' + 'libsessiond-0*.armv7l.rpm' + 'libsystemd-*.armv7l.rpm' + 'libtzplatform-config-*.armv7l.rpm' + 'parcel-0*.armv7l.rpm' + 'parcel-devel-*.armv7l.rpm' + 'pkgmgr-info-*.armv7l.rpm' + 'vconf-compat-*.armv7l.rpm' + 'vconf-internal-keys-devel-*.armv7l.rpm') + download "$URL" "${PKG_ARR[@]}" + + # Unified packages (snapshots) + URL="http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/armv7l/" + PKG_ARR=( + 'capi-network-nsd-*.armv7l.rpm' + 'capi-network-thread-*.armv7l.rpm' + 'libnsd-dns-sd-*.armv7l.rpm') + download "$URL" "${PKG_ARR[@]}" + + # Install all + info "Installation Tizen SDK [...]" + + unzip -o '*.zip' + cp -rf data/* "$TIZEN_SDK_ROOT" + + unrpm *.rpm + cp -rf lib usr "$TIZEN_SDK_SYSROOT" + + # Install secret tool or not + if ("$SECRET_TOOL"); then + info "Override secret tool" + cp "$SCRIPT_DIR/secret-tool.py" "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool" + chmod 0755 "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool" + fi + + # Configure tizen cli + echo "TIZEN_SDK_INSTALLED_PATH=$TIZEN_SDK_ROOT" >"$TIZEN_SDK_ROOT/sdk.info" + echo "TIZEN_SDK_DATA_PATH=$TIZEN_SDK_DATA_PATH" >>"$TIZEN_SDK_ROOT/sdk.info" + ln -sf "$TIZEN_SDK_DATA_PATH/.tizen-cli-config" "$TIZEN_SDK_ROOT/tools/.tizen-cli-config" + + # Make symbolic links relative + find "$TIZEN_SDK_SYSROOT/usr/lib" -maxdepth 1 -type l | while IFS= read -r LNK; do + ln -sf "$(basename "$(readlink "$LNK")")" "$LNK" + done + ln -sf ../../lib/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib/libcap.so" + ln -sf openssl1.1.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc" + + # Information on necessary environment variables + warning "You must add the appropriate environment variables before proceeding with matter." + echo "$COLOR_YELLOW" + echo "export TIZEN_VESRSION=\"$TIZEN_VERSION\"" + echo "export TIZEN_SDK_ROOT=\"$(realpath "$TIZEN_SDK_ROOT")\"" + echo "export TIZEN_SDK_TOOLCHAIN=\"\$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2\"" + echo "export TIZEN_SDK_SYSROOT=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core\"" + echo "export PATH=\"\$TIZEN_SDK_TOOLCHAIN/bin:\$TIZEN_SDK_ROOT/tools/ide/bin:\$TIZEN_SDK_ROOT/tools:\$PATH\"" + echo -n "$COLOR_NONE" +} + +while (($#)); do + case $1 in + --help) + show_help + exit 0 + ;; + --tizen-sdk-path) + TIZEN_SDK_ROOT="$2" + shift + ;; + --tizen-sdk-data-path) + TIZEN_SDK_DATA_PATH="$2" + shift + ;; + --tizen-version) + TIZEN_VERSION=$2 + shift + ;; + --install-dependencies) + INSTALL_DEPENDENCIES=true + ;; + --override-secret-tool) + SECRET_TOOL=true + ;; + *) + error "Wrong options usage!" + exit 1 + ;; + esac + shift +done + +# ------------------------------------------------------------------------------ +# Prepare a temporary directory and cleanup +trap cleanup EXIT +TMP_DIR=$(mktemp -d) +info "Created tmp directory $TMP_DIR" + +# ------------------------------------------------------------------------------ +# Checks if the user need install dependencies +if [ "$INSTALL_DEPENDENCIES" = true ]; then + if ! install_dependencies; then + error "Cannot install dependencies, please use this script as sudo user or root. Use --help" + show_dependencies + exit 1 + fi +else + show_dependencies +fi + +# ------------------------------------------------------------------------------ +# Checking dependencies needed to install the tizen platform +for PKG in 'cpio' 'unzip' 'wget' 'unrpm'; do + if ! command -v "$PKG" &>/dev/null; then + warning "Not found $PKG" + dep_lost=1 + fi +done +if [[ $dep_lost ]]; then + error "You need install dependencies before [HINT]: On Ubuntu-like distro run: sudo apt install ${DEPENDENCIES[@]}" + exit 1 +fi + +# ------------------------------------------------------------------------------ +# Installation Tizen SDK +install_tizen_sdk diff --git a/integrations/docker/images/chip-build-tizen/secret-tool.py b/integrations/docker/images/chip-build-tizen/tizen-sdk-installer/secret-tool.py similarity index 100% rename from integrations/docker/images/chip-build-tizen/secret-tool.py rename to integrations/docker/images/chip-build-tizen/tizen-sdk-installer/secret-tool.py diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 89a140eb53a3ca..a9a413cff22633 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.5.91 Version bump reason: [nRF Connect] Update nRF Connect SDK version +0.5.92 Version bump reason: [TIZEN] Support for installing Tizen SDK without docker diff --git a/scripts/setup/tizen/sdk-installer b/scripts/setup/tizen/sdk-installer new file mode 120000 index 00000000000000..b2ea9d0bbf89ad --- /dev/null +++ b/scripts/setup/tizen/sdk-installer @@ -0,0 +1 @@ +../../../integrations/docker/images/chip-build-tizen/tizen-sdk-installer \ No newline at end of file