1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/framagames_ynh.git synced 2024-09-03 18:36:28 +02:00
This commit is contained in:
polytan02 2015-06-18 22:23:47 +01:00
parent c364a53c5f
commit e2bf8c49c5

View file

@ -1,105 +0,0 @@
#!/bin/bash
# Retrieve arguments
app=webapp_multi_inst
domain=$1
path=$2
user=$3
is_public=$4
# sitename == path without "/"
sitename=$(echo $path | cut -d '/' -f 2)
if [ $path = "/" ]
then
sitename="root"
fi
final_path=/var/www/webapp\_multi/$domain/$sitename
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app
if [[ ! $? -eq 0 ]]; then
exit 1
fi
sudo yunohost app setting $app final_path -v $final_path
sudo yunohost app setting $app domain -v $domain
sudo yunohost app setting $app path -v $path
sudo yunohost app setting $app sitename -v $sitename
# Check user
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
if [[ ! $? -eq 0 ]]; then
echo "Wrong user"
exit 1
fi
sudo yunohost app setting $app user -v $user
#sudo yunohost app setting $app ftp_user -v $user
# Créer le dossier parent des webapp pour l'utilisateur
#if test ! -d $parent_dir
#then # Créer le dossier parent uniquement si il n'existe pas
# Creation of folder
sudo rm -rf $final_path
sudo mkdir -p $final_path
# Base site
sudo cp ../sources/index.html $final_path/
# Set permissions
sudo chmod 775 -R $final_path
sudo chown -hR www-data:www-data $final_path
#else
# echo "Création du dossier $parent_dir ignorée, le dossier existe déjà."
#fi
# Change user ID in configurations
#sed -i "s@FTPUSER@$user@g" ../sources/index_ftp.html
#sed -i "s@HOST@$domain@g" ../sources/index_ftp.html
#sed -i "s@NET2FTP@$netftp_path@g" ../sources/index_ftp.html
# Copy files to the right place
#sudo mkdir $final_path
#sudo cp ../sources/index.html $final_path/
# Vérifie si pure-ftpd est déjà installé
#if test -f /usr/sbin/pure-ftpd-ldap
#then # Si oui, vérifie si net2ftp est également installé.
# if test -d $parent_dir/netftp
# then
# sudo cp ../sources/index_ftp.html $final_path/index.html # Remplace l'index.html par celui intégrant les informations ftp
# fi
#fi
# Set permissions
#sudo chmod 775 -R $final_path
#sudo chown -hR $user:www-data $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$sitename.conf
# Make app public if necessary
sudo yunohost app setting $app is_public -v "$is_public"
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting $app skipped_uris -v "/"
else
sudo yunohost app setting $app protected_uris -v "/"
fi
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app ssowatconf