eive-obsw/scripts/install-obsw-yocto.sh

101 lines
2.9 KiB
Bash
Raw Normal View History

#!/bin/bash
2022-05-06 15:41:29 +02:00
# This is a helper script to install the compiles EIVE OBSW files
# into the yocto repository to re-generate the mission root filesystem
build_dir=cmake-build-release-q7s
2022-10-27 14:11:09 +02:00
if [[ ! -z ${1} && "${1}" == "em" ]] || [[ ${EIVE_Q7S_EM} == "1" ]]; then
2022-10-20 18:03:37 +02:00
echo "-I- Installing EM binaries"
em_install="1"
build_dir=cmake-build-release-q7s-em
fi
2022-05-06 15:38:50 +02:00
init_dir=$(pwd)
obsw_root=""
q7s_yocto_dir="q7s-yocto"
q7s_package_path="q7s-package/${q7s_yocto_dir}"
2022-05-06 15:53:16 +02:00
obsw_version_filename="obsw_version.txt"
yocto_obsw_path="yocto/meta-eive/recipes-core/eive-obsw/files"
variant_specific_path=""
2022-10-27 14:11:09 +02:00
if [[ ${em_install} == "1" ]]; then
variant_specific_path="${yocto_obsw_path}/em"
else
variant_specific_path="${yocto_obsw_path}/fm"
fi
yocto_watchdog_path="yocto/meta-eive/recipes-support/eive-obsw-watchdog/files"
2022-05-06 16:47:09 +02:00
obsw_bin_name="eive-obsw"
watchdog_bin_name="eive-watchdog"
2022-05-06 15:38:50 +02:00
obsw_target_name="eive-obsw"
watchdog_target_name="eive-watchdog"
if [ ! -z ${EIVE_OBSW_ROOT} ]; then
cd ${EIVE_OBSW_ROOT}
2022-05-06 15:38:50 +02:00
obsw_root=$(pwd)
elif [ -d ${build_dir} ]; then
2022-08-02 20:12:25 +02:00
obsw_root=$(pwd)
:
elif [ -d ../${build_dir} ]; then
cd ..
obsw_root=$(pwd)
else
2022-05-06 15:53:16 +02:00
echo "-E- No way into the EIVE OBSW Root folder found. Exiting"
exit 1
fi
yocto_root=""
if [ -d ../${q7s_package_path} ]; then
cd ../${q7s_package_path}
yocto_root=$(pwd)
2022-05-06 15:38:50 +02:00
elif [ -d ../${q7s_yocto_dir} ]; then
cd ../${q7s_yocto_dir}
yocto_root=$(pwd)
fi
if [ -z ${yocto_root} ]; then
2022-05-06 15:53:16 +02:00
echo "-E- No yocto directory found. Exiting"
exit 1
fi
cd ${obsw_root}
2022-05-06 15:53:16 +02:00
version_cmd="git describe --tags --always --exclude docker_*"
echo "-I- Running ${version_cmd} to retrieve OBSW version and store it into ${obsw_version_filename}"
version_tag=$(${version_cmd})
echo "-I- Detected version tag ${version_tag}"
echo ${version_tag} > ${obsw_version_filename}
if [ ! -d ${build_dir} ]; then
echo "No Q7S Release binary folder ${build_dir} found. Exiting"
exit 1
fi
2022-05-06 15:38:50 +02:00
if [ ! -f ${build_dir}/${obsw_bin_name} ]; then
2022-05-06 15:53:16 +02:00
echo "-W- No EIVE OBSW binary found to intall to yocto"
else
cp_cmd="cp $(pwd)/${build_dir}/${obsw_bin_name} ${yocto_root}/${variant_specific_path}/${obsw_target_name}"
2022-05-06 15:53:16 +02:00
echo "-I- Executing: ${cp_cmd}"
eval ${cp_cmd}
cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${variant_specific_path}"
2022-05-06 15:53:16 +02:00
echo "-I- Executing: ${cp_ver_cmd}"
eval ${cp_ver_cmd}
echo "-I- Installed EIVE OBSW into yocto repository successfully"
fi
#if [ ! -f ${build_dir}/${watchdog_bin_name} ]; then
# echo "-W- No EIVE Watchdog found to intall to yocto"
#else
# cp_cmd="cp $(pwd)/${build_dir}/${watchdog_bin_name} ${yocto_root}/${yocto_watchdog_path}/${watchdog_target_name}"
# echo "-I- Executing: ${cp_cmd}"
# eval ${cp_cmd}
# cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${yocto_watchdog_path}"
# echo "-I- Executing: ${cp_ver_cmd}"
# eval ${cp_ver_cmd}
# echo "-I- Installed EIVE watchdog into yocto repository successfully"
#fi
2022-05-06 15:53:16 +02:00
if [ -f $(pwd)/${obsw_version_filename} ]; then
rm $(pwd)/${obsw_version_filename}
fi
2022-05-06 15:38:50 +02:00
cd ${init_dir}