Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved checking for uninstalled tools for unsupported linux distributions. #2887

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sming/Arch/Esp32/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ case $DIST in
darwin)
;;

*)
check_for_installed_tools dfu-util bison flex gperf

berhoel marked this conversation as resolved.
Show resolved Hide resolved
check_for_installed_files "/usr/include/ffi.h" "/usr/include/ssl/ssl.h"
PACKAGES=()
;;

esac

$PKG_INSTALL "${PACKAGES[@]}"
Expand Down
60 changes: 55 additions & 5 deletions Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,46 @@ FONT_PACKAGES=(\
fonts-droid-fallback \
)

check_for_installed_tools () {
berhoel marked this conversation as resolved.
Show resolved Hide resolved
berhoel marked this conversation as resolved.
Show resolved Hide resolved
REQUIRED_TOOLS="${@}"
berhoel marked this conversation as resolved.
Show resolved Hide resolved
echo -e "Checking for installed tools.\nrequirded tools: ${REQUIRED_TOOLS}"
berhoel marked this conversation as resolved.
Show resolved Hide resolved
TOOLS_MISSING=0
for TOOL in ${REQUIRED_TOOLS}; do
if ! command -v "${TOOL}" > /dev/null ; then
TOOLS_MISSING=1
echo "Install required tool ${TOOL}"
fi
done
berhoel marked this conversation as resolved.
Show resolved Hide resolved
if [ $TOOLS_MISSING != 0 ]; then
echo "ABORTING"
if [ $sourced = 1 ]; then
return 1
else
exit 1
fi
berhoel marked this conversation as resolved.
Show resolved Hide resolved
fi
}

check_for_installed_files () {
berhoel marked this conversation as resolved.
Show resolved Hide resolved
REQUIRED_FILES="${@}"
berhoel marked this conversation as resolved.
Show resolved Hide resolved
echo -e "Checking for installed files.\nrequirded files: ${REQUIRED_FILES}"
berhoel marked this conversation as resolved.
Show resolved Hide resolved
FILES_MISSING=0
for FILE in ${REQUIRED_FILES}; do
if ! [ -f "${FILE}" ]; then
FILES_MISSING=1
echo "Install required FILE ${FILE}"
fi
done
berhoel marked this conversation as resolved.
Show resolved Hide resolved
if [ $FILES_MISSING != 0 ]; then
echo "ABORTING"
if [ $sourced = 1 ]; then
return 1
else
exit 1
fi
berhoel marked this conversation as resolved.
Show resolved Hide resolved
fi
}

EXTRA_PACKAGES=()
OPTIONAL_PACKAGES=()

Expand Down Expand Up @@ -99,12 +139,20 @@ elif [ -n "$(command -v dnf)" ]; then
DIST=fedora
PKG_INSTALL="sudo dnf install -y"
else
TOOLS_MISSING=0
berhoel marked this conversation as resolved.
Show resolved Hide resolved
echo "Unsupported distribution"
if [ $sourced = 1 ]; then
return 1
else
exit 1
fi
check_for_installed_tools \
ccache \
cmake \
curl \
git \
make \
ninja \
unzip \
g++ \
python3 \
pip3 \
wget
fi

# Common install
Expand Down Expand Up @@ -183,9 +231,11 @@ case $DIST in

esac

if [ $(/usr/bin/python -c "import sys;print(sys.version_info[0])") != 3 ]; then
berhoel marked this conversation as resolved.
Show resolved Hide resolved
if [ "$DIST" != "darwin" ]; then
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 100
fi
fi

set -e

Expand Down
1 change: 1 addition & 0 deletions samples/Basic_Serial/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/files/