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

Update setup-Linux-debian-9.sh #1034

Merged
merged 22 commits into from
Feb 1, 2022
Merged

Update setup-Linux-debian-9.sh #1034

merged 22 commits into from
Feb 1, 2022

Conversation

dchassin
Copy link
Member

This PR fixes the Debian 9 installer needed for WSL support.

Current issues

  1. Validation hangs on isochronous generator tests.

Code changes

  • Update build-aux/setup-linux-debian9.sh

Documentation changes

None

Test and Validation Notes

None

@dchassin dchassin self-assigned this Nov 18, 2021
@dchassin dchassin added the bug Request a fix or change to the code label Nov 18, 2021
@dchassin
Copy link
Member Author

dchassin commented Jan 18, 2022

@jewelnewman's shell history from running a manual install:

    1  apt install git
    2  apt update
    3  apt install git
    4  cat /etc/os-release 
    5  apt -q -y install tzdata
    6  apt -q -y install software-properties-common
    7  apt -q -y install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libssl-dev libreadline-dev libffi-dev curl
    8  cd /usr/local/src
    9  curl https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz | tar xz
   10  curl https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz | tar xz
   11  ls
   12  cd Python-3.9.6/
   13  apt remove python3
   14  python3
   15  apt remove python3
   16  apt autoremove
   17  python3
   18  ls /usr/local/opt
   19  mkdir /usr/local/opt
   20  ./configure --silent --prefix=/usr/local/opt/python3 --enable-optimizations --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC"
   21  nproc
   22  export MAKEFLAGS=-j36
   23  export PYTHONSETUPFLAGS="-j 36"
   24  make --silent
   25  apt -q -y install libz-dev
   26  apt -q -y install libbz2-dev
   27  apt -q -y install liblzma-dev tk-dev uuid sqlite-dev
   28  apt -q -y install liblzma-dev tk-dev uuid sqlite2-dev
   29  apt -q -y install liblzma-dev tk-dev uuid libsqlite2-dev
   30  apt -q -y install liblzma-dev tk-dev uuid libsqlite-dev
   31  make --silent
   32  ./configure --silent --prefix=/usr/local/opt/python3 --enable-optimizations --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC"
   33  make --silent
   34  apt -q -y install uuid libsqlite3-dev
   35  apt -q -y install uuid
   36  ./configure --silent --prefix=/usr/local/opt/python3 --enable-optimizations --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC"
   37  make --silent
   38  apt -q -y install uuid-dev
   39  make --silent
   40  ./configure --silent --prefix=/usr/local/opt/python3 --enable-optimizations --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC"
   41  make --silent
   42  make altinstall
   43  ln -sf /usr/local/opt/python3/python3.9 /usr/local/bin/python3
   44  python3 --version
   45  export PATH=/usr/local/bin:$PATH
   46  python3 --version
   47  ln -sf /usr/local/opt/python3/bin/python3.9 /usr/local/bin/python3
   48  python3 --version
   49  ln -sf /usr/local/opt/python3/bin/python3.9 /usr/local/bin/python3.9
   50  ln -sf /usr/local/opt/python3/bin/python3.9-config /usr/local/bin/python3.9-config
   51  ln -sf /usr/local/opt/python3/bin/pydoc3.9 /usr/local/bin/pydoc
   52  ln -sf /usr/local/opt/python3/bin/idle3.9 /usr/local/bin/idle
   53  ln -sf /usr/local/opt/python3/bin/pip3 /usr/local/bin/pip3
   54  ln -sf /usr/local/opt/python3/include/python3.9 /usr/local/include/python3.9
   55  ln -sf /usr/local/opt/python3/lib/python3.9 /usr/local/lib/python3.9
   56  python3 -m pip -q install upgrade pip
   57  curl -sL http://install.gridlabd.us/requirements.txt | pip3 -q install -r /dev/stdin
   58  curl -sL http://install.gridlabd.us/requirements.txt | /usr/local/bin/pip3 -q install -r /dev/stdin
   59  ln -sf /usr/local/opt/python3/bin/pip3.9 /usr/local/bin/pip3
   60  curl -sL http://install.gridlabd.us/requirements.txt | /usr/local/bin/pip3 -q install -r /dev/stdin
   61  vi /etc/bashrc
   62  vi /.profile
   63  vi /etc/shrc
   64  ls /etc/*rc*
   65  vi /etc/bash.bashrc
   66  cd ..
   67  ls
   68  git clone https://github.com/slacgismo/gridlabd --depth 1
   69  cd gridlabd
   70  autoreconf -isf
   71  autoconf
   72  apt -q -y install autoconf automake libtool
   73  autoreconf -isf
   74  ./configure
   75  echo $MAKEFLAGS
   76  make system
   77  apt -q -y install curl-dev
   78  apt -q -y install curl
   79  apt -q -y install libcurl-dev
   80  apt -q -y install libcurl
   81  apt -q -y install libcurl4-dev
   82  apt -q -y install libcurl4
   83  make
   84  python3-config --cflags
   85  ls /usr/local/bin
   86  mv /usr/local/bin/python3.9-confi /usr/local/bin/python3-config
   87  mv /usr/local/bin/python3.9-config /usr/local/bin/python3-config
   88  ./configure
   89  make
   90  apt -q -y libcurl4-gnutls.dev
   91  apt -q -y install libcurl4-gnutls.dev
   92  apt -q -y install libcurl4-gnutls-dev
   93  apt -q -y install libcurl4-openssl-dev
   94  make
   95  make system
   96  gridlabd --version
   97  gridlabd -T 0 -W autotest --validate
   98  gridlabd -T 0 -W gldcore --validate
   99  gridlabd -W gldcore --validate
  100  cd /usr/local/opt
  101  ls
  102  history > install-linux-debug9.sh

@dchassin dchassin mentioned this pull request Jan 18, 2022
23 tasks
@catzzz
Copy link
Contributor

catzzz commented Jan 19, 2022

1). Update debia:9 installation. Run installation and pass validation in temporary Dockerfile under Mac OSX. Since current Windows wsl/debian only support debian:11. Therefore, It didn't run installation and validation under Windows10 wsl/debian:9.

2). Fix #1087 missing default timezone issue

export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
apt-get install -y tzdata
dpkg-reconfigure --frontend noninteractive tzdata

Set default timezone to Los_Angeles.
Update setup-Linux-debian-11.sh, setup-Linux-debian-10.sh and setup-Linux-debian-9.sh.

  1. Add latex installation for doxgygen in setup-Linux-debian-11.sh, setup-Linux-debian-10.sh and setup-Linux-debian-9.sh.

@dchassin
Copy link
Member Author

You should be able to determine the local timezone with the python geocoder and timezonefinder, e.g.,

import timezonefinder, geocoder
latlon = getcoder.ip('me').latlng
timezonefinder.TimezoneFinder.timezone_at(lat=latlon[0],lon=latlon[1])

@catzzz catzzz marked this pull request as ready for review January 19, 2022 17:27
Copy link
Member Author

@dchassin dchassin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to https://ipapi.co/timezone is potentially rate limited. We should catch this error and fall back on another method if it occurs.

@catzzz
Copy link
Contributor

catzzz commented Jan 20, 2022

In windows WSL/Debain:11, the default timezone is Etc/GMT+X
If the timezone is Etc, we enforce user to set timezone manually.

if [ "$(cat /etc/timezone | cut -f1 -d'/')" == "Etc" ]; then 
	apt-get install dialog -y
	export DEBIAN_FRONTEND=dialog
	dpkg-reconfigure tzdata
fi

@catzzz
Copy link
Contributor

catzzz commented Jan 24, 2022

If http code is 200, set the timezone from the response of URL. Otherwise , set the default timezone as UTC/GMT

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

@aivanova5 aivanova5 merged commit 2293bd5 into develop Feb 1, 2022
@aivanova5 aivanova5 deleted the develop-fix-debian9-setup branch February 1, 2022 23:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Request a fix or change to the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing default timezone setup in the installation process under Windows WSL/Debian.
4 participants