Skip to content

Commit

Permalink
scripts: Fixes ShellCheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
psaavedra committed Jan 25, 2025
1 parent c0faf58 commit 02ca861
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
10 changes: 5 additions & 5 deletions scripts/oe-env-checkout-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
B=$1
SRC="${BUILDDIR}/../../sources"

pushd ${SRC}
pushd "${SRC}" || exit 1

for i in *; do
if [ -d "$i" ]; then
echo -e "\n>>> $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
pushd $i > /dev/null 2>&1
pushd "$i" > /dev/null 2>&1 || exit 1
git fetch -a
git checkout $B
popd > /dev/null 2>&1;
git checkout "$B"
popd > /dev/null 2>&1 || exit 1
fi
done

popd
popd || exit 1
8 changes: 4 additions & 4 deletions scripts/oe-env-pull-branches
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

SRC="${BUILDDIR}/../../sources"

pushd ${SRC}
pushd "${SRC}" || exit 1

for i in *; do
if [ -d "$i" ]; then
echo -e "\n>>> $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
pushd $i > /dev/null 2>&1
pushd "$i" > /dev/null 2>&1 || exit 1
git status | grep -e "On branch"
git pull
popd > /dev/null 2>&1;
popd > /dev/null 2>&1 || exit 1
fi
done

popd
popd || exit 1
8 changes: 4 additions & 4 deletions scripts/oe-env-status-branches
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ if [ "${1}" = "--help" ]; then
exit 0
fi

pushd ${SRC}
pushd "${SRC}" || exit 1

for i in *; do
if [ -d "$i" ]; then
echo -e "\n>>> $i <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
pushd $i > /dev/null 2>&1
pushd "$i" > /dev/null 2>&1 || exit 1
if [ "${1}" = "--verbose" ]; then
git remote -v
git status
Expand All @@ -21,8 +21,8 @@ for i in *; do
git status | grep -e "On branch"
git log -1 --oneline
fi
popd > /dev/null 2>&1;
popd > /dev/null 2>&1 || exit 1
fi
done

popd
popd || exit 1
2 changes: 1 addition & 1 deletion scripts/oe-env-update
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
if [ "${0}" != "${BASH_SOURCE}" ]; then
if [ "${0}" != "${BASH_SOURCE[0]}" ]; then
echo "Please don't source this script, but directly run it"
return
fi
Expand Down
33 changes: 17 additions & 16 deletions scripts/setup-environment
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function print_machines ()
{
echo -e "\e[32mMachines:\e[0m"
echo -e "\e[1m"
local basedir="${BSPDIR}/sources/meta-wpe-image/conf/machine"
local basedir="${BSPDIR}/sources/meta-wpe-image/conf/machine"
local machine
for machine in "${basedir}"/*.conf ; do
[[ -f ${machine} ]] || continue
Expand Down Expand Up @@ -93,27 +93,27 @@ function print_help_info ()
echo -e "\e[0m"
}

if [ "${0}" = "${BASH_SOURCE}" ]; then
if [ "${0}" = "${BASH_SOURCE[0]}" ]; then
echo "Please don't run the script but source it"
echo -e "\e[32mUsage:\e[1m source ${0} targetname\e[0m"
echo -e "\e[1m source ${BASH_SOURCE} targetname machine distro bblayers presets --update-config"
echo -e "\e[1m source ${BASH_SOURCE[*]} targetname machine distro bblayers presets --update-config"
return 1
fi

if [ "$#" -lt "1" ]
then
echo -e "\e[32mUsage:\e[1m ${BASH_SOURCE} targetname\e[0m"
echo -e "\e[1m ${BASH_SOURCE} targetname machine distro bblayers presets --update-config"
echo -e "\e[32mUsage:\e[1m ${BASH_SOURCE[*]} targetname\e[0m"
echo -e "\e[1m ${BASH_SOURCE[*]} targetname machine distro bblayers presets --update-config"
echo -e "\e[0m"
print_help_info
return 1
fi

if [ "$#" -gt "1" ] && [ "${6}" != "--update-config" ]; then
echo -e "\e[32mUse only the target argument:\e[0m"
echo -e "\e[1m ${BASH_SOURCE} ${1}\e[0m"
echo -e "\e[1m ${BASH_SOURCE[*]} ${1}\e[0m"
echo -e "\e[32mOr specify the missing parameters:\e[0m"
echo -e "\e[1m ${BASH_SOURCE} ${1} machine(${2}) distro(${3}) bblayers(${4}) presets(${5}) --update-config"
echo -e "\e[1m ${BASH_SOURCE[*]} ${1} machine(${2}) distro(${3}) bblayers(${4}) presets(${5}) --update-config"
echo -e "\e[0m"
print_help_info
return 1
Expand All @@ -132,8 +132,8 @@ if [ "${6}" = "--update-config" ]; then
fi

OEROOT="${BSPDIR}/sources/poky"
if [ -f ${TEMPLATECONF}/poky.path ]; then
OEROOT="${BSPDIR}/$(cat ${TEMPLATECONF}/poky.path)"
if [ -f "${TEMPLATECONF}/poky.path" ]; then
OEROOT="${BSPDIR}"/$(cat "${TEMPLATECONF}"/poky.path)
fi

OESCRIPT="${OEROOT}/oe-init-build-env"
Expand All @@ -146,22 +146,23 @@ fi
# Variables that need to be passed to the poky script.
export OEROOT
export TEMPLATECONF
export BASH_SOURCE="${OESCRIPT}"
export BASH_SOURCE=( "${OESCRIPT}" )
# shellcheck source=/dev/null
source "${OESCRIPT}" "${BSPDIR}/builds/${TARGET}"

# cp conf files
if [ "${6}" = "--update-config" ]; then
cp -a ${TEMPLATECONF}/presets ${BUILDDIR}/conf/
cp -a "${TEMPLATECONF}/presets" "${BUILDDIR}/conf/"

IFS='.' read -ra LAYERS <<< "$BBLAYERS"
for i in "${LAYERS[@]}"; do
cat ${TEMPLATECONF}/bblayers/bblayers.conf.${i}
cat "${TEMPLATECONF}/bblayers/bblayers.conf.${i}"
done > "${BUILDDIR}/conf/bblayers.conf"

IFS='.' read -ra P <<< "$PRESETS"
for i in "${P[@]}"; do
echo "require presets/${i}.conf"
done > ${BUILDDIR}/conf/presets.conf
done > "${BUILDDIR}/conf/presets.conf"

sed -i "s|##MACHINE##|${MACHINE}|g" "${BUILDDIR}/conf/local.conf"
sed -i "s|##DISTRO##|${DISTRO}|g" "${BUILDDIR}/conf/local.conf"
Expand All @@ -174,9 +175,9 @@ if [ "${6}" = "--update-config" ]; then
fi
fi

alias oe-goto-deploy-images="pushd ${BUILDDIR}/tmp/deploy/images"
alias oe-goto-sources="pushd ${BUILDDIR}/../../sources"
alias oe-goto-builddir="pushd ${BUILDDIR}/"
alias oe-goto-deploy-images='pushd ${BUILDDIR}/tmp/deploy/images'
alias oe-goto-sources='pushd ${BUILDDIR}/../../sources'
alias oe-goto-builddir='pushd ${BUILDDIR}/'

export PATH=$PATH:$BSPDIR/sources/meta-wpe-image/scripts

Expand Down

0 comments on commit 02ca861

Please sign in to comment.