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 all 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
6 changes: 6 additions & 0 deletions Sming/Arch/Esp32/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ case $DIST in
darwin)
;;

*)
check_for_installed_tools dfu-util bison flex gperf
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 @@ -84,6 +84,47 @@ source "$(dirname "${BASH_SOURCE[0]}")/export.sh"

export WGET="wget --no-verbose"

# Scripts for checking for required resources

abort () {
echo "ABORTING"
if [ $sourced = 1 ]; then
return 1
else
exit 1
fi
}

check_for_installed_tools() {
REQUIRED_TOOLS=( "$@" )
echo -e "Checking for installed tools.\nRequired tools: ${REQUIRED_TOOLS[*]}"
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
if [ $TOOLS_MISSING != 0 ]; then
abort
fi
}

check_for_installed_files() {
REQUIRED_FILES=( "$@" )
echo -e "Checking for installed files.\nRequired files: ${REQUIRED_FILES[*]}"
FILES_MISSING=0
for FILE in "${REQUIRED_FILES[@]}"; do
if ! [ -f "$FILE" ]; then
FILES_MISSING=1
echo "Install required FILE $FILE"
fi
done
if [ $FILES_MISSING != 0 ]; then
abort
fi
}

# Installers put downloaded archives here
DOWNLOADS="downloads"
mkdir -p $DOWNLOADS
Expand All @@ -100,11 +141,18 @@ elif [ -n "$(command -v dnf)" ]; then
PKG_INSTALL="sudo dnf install -y"
else
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
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/
Loading