mirror of https://gitlab.com/pamhyr/pamhyr2
pamhyr: Add setup.sh install script (not functionnal).
parent
1eec6ffc85
commit
e87db62dce
|
|
@ -0,0 +1,61 @@
|
|||
#! /usr/bin/env bash
|
||||
# setup.sh -- Pamhyr
|
||||
# Copyright (C) 2024 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
function perr() {
|
||||
>&2 echo $1
|
||||
}
|
||||
|
||||
function try() {
|
||||
echo "run: $1"
|
||||
res=$($1)
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
perr "Command failed with exit value $?: '$1'"
|
||||
perr " $res"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -ne 1 ];
|
||||
then
|
||||
perr "usage: $0 <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$1
|
||||
|
||||
# Download last version
|
||||
try "curl https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/archive/$version/pamhyr-$version.tar.gz -o pamhyr-$version.tar.gz"
|
||||
|
||||
# Setup last version
|
||||
try "tar xf pamhyr-$version.tar.gz"
|
||||
mv pamhyr-$version/ pamhyr/
|
||||
|
||||
OLD_PWD=$PWD
|
||||
cd pamhyr
|
||||
|
||||
try "python3 -m venv .pamhyr-env"
|
||||
try "source .pamhyr-env/bin/activate"
|
||||
try "python3 -m pip install -r requirements.txt"
|
||||
|
||||
echo '#! /usr/bin/env bash' > pamhyr.sh
|
||||
echo 'source .pamhyr-env/bin/activate' >> pamhyr.sh
|
||||
echo 'python3 ./src/pamhyr.py' >> pamhyr.sh
|
||||
|
||||
try "chmod +x pamhyr.sh"
|
||||
|
||||
cd $OLD_PWD
|
||||
Loading…
Reference in New Issue