Skip to content

Commit

Permalink
Detect distribution and support install on Fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Mar 1, 2021
1 parent f299b74 commit 25801b6
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 33 deletions.
24 changes: 20 additions & 4 deletions Sming/Arch/Esp32/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@

if [ -n "$IDF_PATH" ] && [ -n "$IDF_TOOLS_PATH" ]; then

sudo apt-get install -y \
PACKAGES=(\
bison \
ccache \
dfu-util \
flex \
gperf \
libffi-dev \
libssl-dev \
ninja-build
ninja-build \
)

case $DIST in
debian)
PACKAGES+=(\
libffi-dev \
libssl-dev \
)
;;

fedora)
PACKAGES+=(\
libffi-devel \
)
;;
esac

$PKG_INSTALL ${PACKAGES[*]}

git clone -b release/v4.1 https://github.com/espressif/esp-idf.git $IDF_PATH

Expand Down
4 changes: 2 additions & 2 deletions Sming/Arch/Esp8266/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ -n "$UDK_ROOT" ]; then
mkdir -p $UDK_ROOT
ln -s $(pwd)/esp-open-sdk/xtensa-lx106-elf $UDK_ROOT/.
if [ -z "$KEEP_DOWNLOADS" ]; then
rm $TOOLCHAIN
rm -f $TOOLCHAIN
fi
fi

Expand All @@ -19,6 +19,6 @@ if [ -n "$EQT_ROOT" ]; then
mkdir -p $EQT_ROOT
tar -zxf $TOOLCHAIN -C $EQT_ROOT --totals
if [ -z "$KEEP_DOWNLOADS" ]; then
rm $TOOLCHAIN
rm -f $TOOLCHAIN
fi
fi
2 changes: 1 addition & 1 deletion Sming/Arch/Host/Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Required by deployment script
if [ -n "$APPVEYOR" ]; then
sudo apt-get install -y \
$PKG_INSTALL \
jq \
xmlstarlet
fi
91 changes: 68 additions & 23 deletions Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# . /opt/sming/Tools/install.sh
#

set -e

[ "$0" = "$BASH_SOURCE" ]; sourced=$?

inst_host=0
Expand Down Expand Up @@ -48,25 +50,34 @@ if [[ $err -eq 1 ]] || [ $# -eq 0 ]; then
fi
fi

if [ $sourced != 1 ]; then
echo "Please source this script:"
echo " source $0"
exit 1
fi

SMINGTOOLS=https://github.com/SmingHub/SmingTools/releases/download/1.0

if [ -z "$APPVEYOR" ]; then
source $(dirname $BASH_SOURCE)/export.sh
fi

# Common install
# At present we can only
if [ -n "$(grep debian /etc/os-release)" ]; then
DIST=debian
PKG_INSTALL="sudo apt-get install -y"
elif [ -n "$(grep fedora /etc/os-release)" ]; then
DIST=fedora
PKG_INSTALL="sudo dnf install -y"
else
echo "Unsupported distribution"
if [ $sourced = 1 ]; then
return 1
else
exit 1
fi
fi

sudo apt-get -y update
# Common install

if [ -n "$APPVEYOR" ]; then

sudo apt-get install -y \
sudo apt-get -y update
$PKG_INSTALL \
clang-format-6.0 \
g++-9-multilib \
python3-setuptools
Expand All @@ -75,19 +86,43 @@ if [ -n "$APPVEYOR" ]; then

else

sudo apt-get install -y \
clang-format-6.0 \
cmake \
curl \
git \
make \
unzip \
g++ \
g++-multilib \
python3 \
python3-pip \
python3-setuptools \
wget
case $DIST in
debian)
sudo apt-get -y update
$PKG_INSTALL \
clang-format-6.0 \
cmake \
curl \
git \
make \
unzip \
g++ \
g++-multilib \
python3 \
python3-pip \
python3-setuptools \
wget
;;

fedora)
$PKG_INSTALL \
cmake \
gawk \
gcc \
gcc-c++ \
gettext \
git \
glibc-devel.i686 \
libstdc++.i686 \
make \
python3 \
python3-pip \
sed \
unzip \
wget
;;

esac

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 100

Expand All @@ -114,5 +149,15 @@ if [ $inst_esp8266 -eq 1 ]; then
fi

if [ $inst_esp32 -eq 1 ]; then
echo install Esp32
install Esp32
fi

echo
echo Installation complete
echo

if [ $sourced != 1 ]; then
echo "You may need to set environment variables:"
echo " source $SMING_HOME/../Tools/export.sh"
echo
fi
23 changes: 20 additions & 3 deletions docs/Tools/install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# Documentation build tools

sudo apt-get install -y \
PACKAGES=(\
doxygen \
graphviz-dev \
python3-sphinx \
python3-cairocffi
python3-cairocffi \
)

case $DIST in
debian)
PACKAGES+=(\
graphviz-dev \
)
;;

fedora)
PACKAGES+=(\
python-wheel \
graphviz-devel \
)
;;
esac

$PKG_INSTALL ${PACKAGES[*]}

python3 -m pip install -r $SMING_HOME/../docs/requirements.txt

0 comments on commit 25801b6

Please sign in to comment.