mirror of
https://github.com/YunoHost-Apps/yacy_ynh.git
synced 2024-09-03 18:05:59 +02:00
Ajout du dossier scripts
This commit is contained in:
parent
d869cc4826
commit
f9a02adb9e
3 changed files with 92 additions and 0 deletions
46
scripts/install
Normal file
46
scripts/install
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
path=$2
|
||||||
|
|
||||||
|
# Check domain/path availability
|
||||||
|
sudo yunohost app checkurl $domain$path -a yacy
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate random DES key & password
|
||||||
|
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
|
||||||
|
# Use 'yacy' as database name and user
|
||||||
|
db_user=yacy
|
||||||
|
|
||||||
|
# Initialize database and store mysql password for upgrade
|
||||||
|
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/SQL/mysql.initial.sql)
|
||||||
|
sudo yunohost app setting yacy mysqlpwd -v $db_pwd
|
||||||
|
|
||||||
|
# Copy files to the right place
|
||||||
|
final_path=/var/www/yacy
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo cp -a ../sources/* $final_path
|
||||||
|
sudo cp ../conf/main.inc.php $final_path/config/
|
||||||
|
sudo cp ../conf/db.inc.php $final_path/config/
|
||||||
|
sudo mv $final_path/plugins/managesieve/config.inc.php.dist $final_path/plugins/managesieve/config.inc.php
|
||||||
|
|
||||||
|
# Change variables in Roundcube configuration
|
||||||
|
sudo sed -i "s/rcmail-ynhDESkeyTOchange/$deskey/g" $final_path/config/main.inc.php
|
||||||
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/db.inc.php
|
||||||
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/db.inc.php
|
||||||
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/db.inc.php
|
||||||
|
|
||||||
|
# Set permissions to yacy directory
|
||||||
|
sudo chown -R 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/yacy.conf
|
||||||
|
|
||||||
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
10
scripts/remove
Normal file
10
scripts/remove
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
db_user=yacy
|
||||||
|
db_name=yacy
|
||||||
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
domain=$(sudo yunohost app setting yacy domain)
|
||||||
|
|
||||||
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user ;"
|
||||||
|
sudo rm -rf /var/www/yacy
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/yacy.conf
|
36
scripts/upgrade
Normal file
36
scripts/upgrade
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
domain=$(sudo yunohost app setting yacy domain)
|
||||||
|
path=$(sudo yunohost app setting yacy path)
|
||||||
|
|
||||||
|
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
db_user=yacy
|
||||||
|
db_pwd=$(sudo yunohost app setting yacy mysqlpwd)
|
||||||
|
db_file=../sources/SQL/mysql/$(ls -tr ../sources/SQL/mysql | head -1)
|
||||||
|
|
||||||
|
mysql -u $db_user -p$db_pwd $db_user < $db_file
|
||||||
|
|
||||||
|
final_path=/var/www/yacy
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo cp -a ../sources/* $final_path
|
||||||
|
sudo cp ../conf/main.inc.php $final_path/config/
|
||||||
|
sudo cp ../conf/db.inc.php $final_path/config/
|
||||||
|
sudo mv $final_path/plugins/managesieve/config.inc.php.dist $final_path/plugins/managesieve/config.inc.php
|
||||||
|
|
||||||
|
sudo sed -i "s/rcmail-ynhDESkeyTOchange/$deskey/g" $final_path/config/main.inc.php
|
||||||
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/db.inc.php
|
||||||
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/db.inc.php
|
||||||
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/db.inc.php
|
||||||
|
|
||||||
|
sudo chown -R www-data: $final_path
|
||||||
|
|
||||||
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
|
if [[ "$path" == "/" ]]; then
|
||||||
|
sed -i "s@ALIASTOCHANGE@root $final_path@g" ../conf/nginx.conf
|
||||||
|
else
|
||||||
|
sed -i "s@ALIASTOCHANGE@alias $final_path@g" ../conf/nginx.conf
|
||||||
|
fi
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/yacy.conf
|
||||||
|
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
Loading…
Add table
Reference in a new issue