2016-09-09 11:07:28 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-09-10 10:15:53 +02:00
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
|
|
|
path=$YNH_APP_ARG_PATH
|
2016-09-09 11:07:28 +02:00
|
|
|
|
|
|
|
# Source YunoHost helpers
|
2017-09-10 10:15:53 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-09-09 11:07:28 +02:00
|
|
|
|
|
|
|
# Check domain/path availability
|
2017-09-10 10:15:53 +02:00
|
|
|
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
|
|
|
|| ynh_die "Path not available: ${domain}${path}"
|
2016-09-09 11:07:28 +02:00
|
|
|
|
|
|
|
# Install dependencies
|
2017-09-10 10:15:53 +02:00
|
|
|
sudo apt-get update
|
2017-09-06 22:58:43 +02:00
|
|
|
sudo apt-get install nodejs-legacy npm python-pip python-dev python-lxml python-imaging -y -qq
|
2017-09-04 20:10:40 +02:00
|
|
|
sudo pip install weboob
|
2017-07-18 05:29:03 +02:00
|
|
|
|
2016-09-09 11:07:28 +02:00
|
|
|
# Build the app
|
2017-09-10 10:15:53 +02:00
|
|
|
src_path=/home/yunohost.app/$app
|
|
|
|
sudo git clone https://framagit.org/bnjbvr/kresus.git $src_path
|
2017-09-10 10:16:20 +02:00
|
|
|
sudo sh -c "cd $src_path && make install"
|
2016-09-09 11:07:28 +02:00
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
2017-09-10 10:15:53 +02:00
|
|
|
nginx_conf=../conf/nginx.conf
|
|
|
|
sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
|
|
|
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2016-09-09 11:07:28 +02:00
|
|
|
|
|
|
|
# Setup service
|
2017-09-10 10:15:53 +02:00
|
|
|
systemd_service=../conf/kresus.service
|
|
|
|
sed -i "s@YNH_HOME@$src_path@g" $systemd_service
|
|
|
|
sudo cp $systemd_service /etc/systemd/system/$app.service
|
|
|
|
systemctl enable $app
|
|
|
|
systemctl start $app
|
2017-07-18 05:29:03 +02:00
|
|
|
|
2016-09-09 11:07:28 +02:00
|
|
|
# Reload services
|
2017-09-10 10:15:53 +02:00
|
|
|
sudo service nginx reload
|