Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Update setup-Linux-debian-9.sh (#1034)
Browse files Browse the repository at this point in the history
* Update setup-Linux-debian-9.sh

* Update setup-Linux-debian-9.sh

* add setup-Linux-debian-11.sh

* add --enable-share

* remove temporary test Dockerfile

* add install latex

* comment out unnecessary installation to speed up test in windows debian

* set default timezone to fix window wsl/debian timezone missing issue

* change debian 10 setup

* change timezone los angeles

* pass validataion on windows/wsl/debian:11,restore natural_docs , mono and doxgygen

* remove temporary Dockerfile

* delete setup-Linux-debian-11.sh in this PR  and move to new PR

* update set local timezone from

* add condition to determine local timezone. If local timezone is Etc/..., enforcing user to set local time zone

* update comments

* add install dialog

* fix arrow key broken in shell dialog seleciton

* add setup timezone from web, if httpcode is not 200, set as deault timezone as UTC/GMT

* pass installation docker/debian9

* update check if /etc/timezone exit

Co-authored-by: JimmyLeu76 <jimmyleu@slac.stanford.edu>
  • Loading branch information
David P. Chassin and JimmyLeu76 authored Feb 1, 2022
1 parent 39bfce4 commit 2293bd5
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 25 deletions.
35 changes: 31 additions & 4 deletions build-aux/setup-Linux-debian-10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,35 @@
# Install needed system tools
# update first
apt-get -q update
apt-get -q install tzdata -y


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 curl -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

Expand All @@ -28,7 +53,7 @@ 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)" != "Python 3.9.6" ]; then
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

Expand All @@ -46,11 +71,13 @@ if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version)" != "Py
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
Expand Down
86 changes: 65 additions & 21 deletions build-aux/setup-Linux-debian-9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,38 @@
# Install needed system tools
# update first
apt-get -q update
apt-get -q install tzdata -y

# install python 3.7
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 curl -y
cd /tmp
curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar -xf Python-3.7.3.tar.xz
cd Python-3.7.3
./configure --enable-optimizations --enable-shared CXXFLAGS="-fPIC"
make -j10 altinstall
cd /usr/local/bin
ln -s python3.7 python3
ln -s python3.7m-config python3-config
ln -s pip3.7 pip3

# install python libraries by validation
pip3 -q install --upgrade pip
pip -q install pandas matplotlib mysql-client Pillow
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
Expand All @@ -33,8 +44,40 @@ 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 libncurses5-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-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
Expand All @@ -51,12 +94,13 @@ if [ ! -x /usr/bin/doxygen ]; then
make install
fi

# mono
apt-get -q install curl -y
# # 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 http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0 main" | tee /etc/apt/sources.list.d/mono-official.list
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
Expand Down

0 comments on commit 2293bd5

Please sign in to comment.