From 14a87f418e8939a6c9daac35ccef8101956212be Mon Sep 17 00:00:00 2001 From: Jimmy Leu Date: Wed, 16 Feb 2022 10:04:54 -0800 Subject: [PATCH] Update setup-Linux-debian-11.sh (#1090) * fix make install causes pyhton validation error fix #1056 * fix missing when using --parallel option #1044 * update python3.9.6 and necessary packages * update mono installation * fix numpy and matrix version not the latest version issue. #1045 * repair test_matrix_random,#assert == '1.22.0' * remove test Dockerfile' * add setup-Linux-debian-11.sh * copy debian10 content to debian11 * add --enable-share in debian 11 * temporary test file * add --enable-shared , remove unnecessary dependencies for test * set localtime from America/Los_Angeles * passs installation and validation * merge from previous change about * add determine timezone condition * modify bash if condifion * remove temporary Dockerfile and restore install docemnts dependencies * temperory file for windows wsl test * pass installation and validation in docker and windows/wsl * add install idalog -y * fix shell arrow key broken * add get timezone from web. if the httpcode is not 200, set default timezone as UTC/GMT * add update pip * remove Dockerfile, pass installation and validation in Docker debian:11 and Windows/WSL/Debian * remove dupliacte install curl * add config tzdata * check /etc/timezone exist Co-authored-by: JimmyLeu76 Co-authored-by: Alyona Teyber --- build-aux/setup-Linux-centos-8.sh | 4 + build-aux/setup-Linux-debian-11.sh | 117 +++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100755 build-aux/setup-Linux-debian-11.sh diff --git a/build-aux/setup-Linux-centos-8.sh b/build-aux/setup-Linux-centos-8.sh index bc8df044d..1ad75bc15 100755 --- a/build-aux/setup-Linux-centos-8.sh +++ b/build-aux/setup-Linux-centos-8.sh @@ -30,7 +30,11 @@ if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version)" != "Py ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip3 # install python packages /usr/local/bin/python3 -m pip install --upgrade pip +<<<<<<< HEAD + /usr/local/bin/python3 -m pip install matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd +======= /usr/local/bin/python3 -m pip install mysql-connector matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd +>>>>>>> 13db67f9f90774b9ca73620eb394a1d9c37e5c08 /usr/local/bin/python3 -m pip install IPython censusdata diff --git a/build-aux/setup-Linux-debian-11.sh b/build-aux/setup-Linux-debian-11.sh new file mode 100755 index 000000000..69434788d --- /dev/null +++ b/build-aux/setup-Linux-debian-11.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +# Install needed system tools +# update first +apt-get -q update + +apt-get install tzdata -y +apt-get install curl -y +apt-get install apt-utils -y + +# "Etc" will cause installation error +if [ ! -f /etc/timezone -o "$(cat /etc/timezone | cut -f1 -d'/')" == "Etc" ]; then + # get time zone from URL + URL="https://ipapi.co/timezone" + response=$(curl -s -w "%{http_code}" $URL) + http_code=$(tail -n1 <<< "${response: -3}") # get the last 3 digits + if [ $http_code == "200" ]; then + time_zone=$(sed 's/.\{3\}$//' <<< "${response}") # remove the last 3 digits + echo "successful get timezone from $URL , Set time zone as $time_zone" + ln -fs /usr/share/zoneinfo/$time_zone /etc/localtime + else + echo "Can not get timezone from $URL , http_code is $http_code " + echo "Set default time zone as UTC/GMT. " + ln -fs /usr/share/zoneinfo/UTC/GMT /etc/localtime + fi + + export DEBIAN_FRONTEND=noninteractive + apt-get install -y tzdata + dpkg-reconfigure --frontend noninteractive tzdata +fi + +apt-get -q install software-properties-common -y +apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y + +# install system build tools needed by gridlabd + +apt-get -q install git -y +apt-get -q install unzip -y +apt-get -q install autoconf -y +apt-get -q install libtool -y +apt-get -q install g++ -y +apt-get -q install cmake -y +apt-get -q install flex -y +apt-get -q install bison -y +apt-get -q install libcurl4-gnutls-dev -y +apt-get -q install subversion -y +apt-get -q install util-linux -y +apt-get install liblzma-dev -y +apt-get install libbz2-dev -y +apt-get install libncursesw5-dev -y +apt-get install xz-utils -y + +# Install python 3.9.6 +# python3 support needed as of 4.2 +if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version | cut -f2 -d.)" != "Python 3.9" ]; then + echo "install python 3.9.6" + cd /usr/local/src + + curl https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz | tar xz + # tar xzf Python-3.9.6.tgz + cd Python-3.9.6 + + ./configure --prefix=/usr/local --enable-shared --enable-optimizations --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC" + + make -j $(nproc) + make altinstall + /sbin/ldconfig /usr/local/lib + ln -sf /usr/local/bin/python3.9 /usr/local/bin/python3 + ln -sf /usr/local/bin/python3.9-config /usr/local/bin/python3-config + ln -sf /usr/local/bin/pydoc3.9 /usr/local/bin/pydoc + ln -sf /usr/local/bin/idle3.9 /usr/local/bin/idle + ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip3 + /usr/local/bin/python3 -m pip install --upgrade pip + /usr/local/bin/python3 -m pip install matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd boto3 + /usr/local/bin/python3 -m pip install IPython censusdata +fi + +# # install latex +apt-get install texlive -y + +# doxgygen +apt-get -q install gawk -y +if [ ! -x /usr/bin/doxygen ]; then + if [ ! -d /usr/local/src/doxygen ]; then + git clone https://github.com/doxygen/doxygen.git /usr/local/src/doxygen + fi + if [ ! -d /usr/local/src/doxygen/build ]; then + mkdir /usr/local/src/doxygen/build + fi + cd /usr/local/src/doxygen/build + cmake -G "Unix Makefiles" .. + make + make install +fi + +# # # mono + +if [ ! -f /usr/bin/mono ]; then + cd /tmp + apt install apt-transport-https dirmngr gnupg ca-certificates -y + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF + echo "deb https://download.mono-project.com/repo/debian stable-bustergrid main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list + apt-get -q update -y + apt-get -q install mono-devel -y +fi + +# # natural_docs +if [ ! -x /usr/local/bin/natural_docs ]; then + cd /usr/local + curl https://www.naturaldocs.org/download/natural_docs/2.0.2/Natural_Docs_2.0.2.zip > natural_docs.zip + unzip -qq natural_docs + rm -f natural_docs.zip + mv Natural\ Docs natural_docs + echo '#!/bin/bash +mono /usr/local/natural_docs/NaturalDocs.exe \$*' > /usr/local/bin/natural_docs + chmod a+x /usr/local/bin/natural_docs +fi