Improve the way we determine the distro/release
authorChris Sharp <csharp@georgialibraries.org>
Tue, 24 Sep 2019 11:40:50 +0000 (07:40 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 24 Sep 2019 11:40:50 +0000 (07:40 -0400)
templates/setup-functions

index f5166f1..94f441e 100755 (executable)
@@ -123,10 +123,11 @@ chown -R opensrf:opensrf /openils
 }
 
 InstallOpenSRFfromGit () {
-OSRF_REPODIR=$(echo $OSRF_GIT_URL | awk -F/ '{print $NF}' | sed -e 's/.git%//')
-DISTRONAME=ubuntu-xenial
+OSRF_REPODIR=$(echo $OSRF_GIT_URL | awk -F/ '{print $NF}' | sed -e 's/.git//')
+DISTRONAME="$(lsb_release -si | tr [:upper:] [:lower:])-$(lsb_release -sc | tr [:upper:] [:lower:])"
 useradd -m -s /bin/bash opensrf
-su - opensrf -c git clone --branch $OSRF_GIT_BRANCH $OSRF_GIT_URL
+su - opensrf -c "git clone $OSRF_GIT_URL"
+su - opensrf -c "git checkout $OSRF_GIT_BRANCH"
 cd /home/opensrf/$OSRF_REPODIR
 make -f src/extras/Makefile.install $DISTRONAME
 su - opensrf -c "cd $OSRF_REPODIR && autoreconf -i && ./configure --prefix=/openils --sysconfdir=/openils/conf && make"
@@ -135,12 +136,13 @@ chown -R opensrf:opensrf /openils
 }
 
 InstallEvergreenfromGit () {
-EG_REPODIR=$(echo $EG_GIT_URL | awk -F/ '{print $NF}' | sed -e 's/.git%//')
-DISTRONAME=ubuntu-xenial
-su - opensrf -c git clone --branch $EG_GIT_BRANCH $EG_GIT_URL
+EG_REPODIR=$(echo $EG_GIT_URL | awk -F/ '{print $NF}' | sed -e 's/.git//')
+DISTRONAME="$(lsb_release -si | tr [:upper:] [:lower:])-$(lsb_release -sc | tr [:upper:] [:lower:])"
+su - opensrf -c "git clone $EG_GIT_URL"
+su - opensrf -c "git checkout $EG_GIT_BRANCH"
 cd /home/opensrf/$EG_REPODIR
-make -f src/extras/Makefile.install $DISTRONAME
-make -f src/extras/Makefile.install ${DISTRONAME}-developer
+make -f Open-ILS/src/extras/Makefile.install $DISTRONAME
+make -f Open-ILS/src/extras/Makefile.install ${DISTRONAME}-developer
 su - opensrf -c "cd $EG_REPODIR/Open-ILS/web/js/ui/default/staff && npm install && npm run build-prod && npm run test" 
 su - opensrf -c "cd $EG_REPODIR/Open-ILS/src/eg2 && npm install && ng build --prod && npm run test" 
 su - opensrf -c "cd $EG_REPODIR && autoreconf -i && ./configure --prefix=/openils --sysconfdir=/openils/conf && make"