mirror of
https://github.com/YunoHost-Apps/ofbiz_ynh.git
synced 2024-09-03 19:46:33 +02:00
69 lines
1.6 KiB
Bash
Executable file
69 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
||
app=ofbiz
|
||
|
||
# Retrieve arguments
|
||
domain=$1
|
||
path=$2
|
||
admin=$3
|
||
is_public=$4
|
||
|
||
# Check user parameter
|
||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||
if [[ ! $? -eq 0 ]]; then
|
||
echo "Wrong admin user"
|
||
exit 1
|
||
fi
|
||
|
||
# Save app settings
|
||
yunohost app setting $app admin -v "$admin"
|
||
#yunohost app setting $app is_public -v "$is_public"
|
||
sudo apt-get install openjdk-7-jdk -y
|
||
sudo apt-get install ant -y
|
||
#apt-get install postgre -y
|
||
|
||
# Check domain/path availability
|
||
sudo yunohost app checkurl $domain$path -a ofbiz
|
||
if [[ ! $? -eq 0 ]]; then
|
||
echo "application path already exist"
|
||
exit 1
|
||
fi
|
||
|
||
# Copy source files
|
||
final_path=/var/www/$app
|
||
app_path=/opt/ofbiz
|
||
uri_path=/catalog/control/main
|
||
sudo mkdir -p $final_path
|
||
sudo mkdir -p $app_path
|
||
sudo cp -a ../sources/* $app_path
|
||
sudo cd /opt/ofbiz
|
||
sudo ant
|
||
|
||
# Remove following line
|
||
sudo ant load-demo
|
||
# Remove previous line
|
||
|
||
sudo useradd ofbiz
|
||
sudo chown -R ofbiz /opt/ofbiz
|
||
sudo chmod -R 700 /opt/ofbiz
|
||
|
||
# Modify ofbiz deamon script configuration
|
||
sudo cp ../conf/rc.ofbiz.for.debian /etc/init.d/ofbiz
|
||
sudo chown ofbiz /etc/init.d/ofbiz
|
||
sudo chmod 700 /etc/init.d/ofbiz
|
||
sudo update-rc.d ofbiz defaults 90
|
||
|
||
echo "Nginx configuration (sso disabled)..."
|
||
sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf
|
||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||
sudo yunohost app setting $app skipped_uris -v "/"
|
||
|
||
# If app is public, add url to SSOWat conf as skipped_uris
|
||
#if [ "$is_public" != "No" ];
|
||
#then
|
||
# yunohost app setting $app skipped_uris -v "/"
|
||
#fi
|
||
|
||
# Restart services
|
||
sudo service nginx reload
|
||
sudo yunohost app ssowatconf
|
||
sudo /etc/init.d/ofbiz start
|