mirror of
https://github.com/YunoHost-Apps/ffsync_ynh.git
synced 2024-09-03 18:26:38 +02:00
Compliance with Yunohost’s package linter for configuration scripts
fixed a forgotten import of the script helper and removed sudo before helpers modified conf scripts for better path management.
This commit is contained in:
parent
1fef425bbd
commit
53f9b3c0d5
4 changed files with 50 additions and 17 deletions
|
@ -1,29 +1,42 @@
|
||||||
{
|
{
|
||||||
"name": "Firefox Sync Server",
|
"name": "Firefox Sync Server",
|
||||||
"id": "ffsync",
|
"id": "ffsync",
|
||||||
|
"url": "https://github.com/abeudin/ffsync_ynh",
|
||||||
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "",
|
"en": "Mozilla’s Sync-Server to host your Firefox account data",
|
||||||
"fr": ""
|
"fr": "Le serveur de synchronisation de Mozilla, pour héberger vos données Firefox"
|
||||||
},
|
},
|
||||||
"developer": {
|
"maintainer": {
|
||||||
"name": "beudbeud",
|
"name": "beudbeud",
|
||||||
"email": "beudbeud@beudibox.fr",
|
"email": "beudbeud@beudibox.fr",
|
||||||
"url": "https://github.com/balu-/FSyncMS"
|
"url": "https://github.com/balu-/FSyncMS"
|
||||||
},
|
},
|
||||||
"multi_instance": "false",
|
"requirements": {
|
||||||
|
"yunohost": ">> 2.4.0"
|
||||||
|
},
|
||||||
|
"license": "free",
|
||||||
|
"services": [
|
||||||
|
"nginx"
|
||||||
|
],
|
||||||
|
"multi_instance": false,
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for Firefox-Sync Server"
|
"en": "Choose a domain for Firefox-Sync Server",
|
||||||
|
"fr": "Choisissez un domaine pour Firefox-Sync"
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a path for Firefox-Sync Server"
|
"en": "Choose a path for Firefox-Sync Server",
|
||||||
|
"fr": "Choisissez un chemin pour Firefox-Sync"
|
||||||
},
|
},
|
||||||
"example": "/ffsync",
|
"example": "/ffsync",
|
||||||
"default": "/ffsync"
|
"default": "/ffsync"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
|
@ -7,7 +10,7 @@ path=$2
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a ffsync
|
sudo yunohost app checkurl $domain$path -a ffsync
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
ynh_die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate random password
|
# Generate random password
|
||||||
|
@ -18,11 +21,11 @@ db_user=ffsync
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
sudo yunohost app initdb $db_user -p $db_pwd
|
sudo yunohost app initdb $db_user -p $db_pwd
|
||||||
sudo yunohost app setting ffsync mysqlpwd -v $db_pwd
|
ynh_app_setting_set ffsync mysqlpwd $db_pwd
|
||||||
|
|
||||||
# Generate random password and save
|
# Generate random password and save
|
||||||
secret=$(head -c 20 /dev/urandom | sha1sum | cut -d " " -f1)
|
secret=$(head -c 20 /dev/urandom | sha1sum | cut -d " " -f1)
|
||||||
sudo yunohost app setting ffsync secret -v $secret
|
ynh_app_setting_set ffsync secret $secret
|
||||||
|
|
||||||
# Check depends installation
|
# Check depends installation
|
||||||
sudo apt-get install make python-dev python-virtualenv -y
|
sudo apt-get install make python-dev python-virtualenv -y
|
||||||
|
@ -44,6 +47,10 @@ then
|
||||||
sudo swapon $tmp_swap_file
|
sudo swapon $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Modify assets to take path into account
|
||||||
|
sudo find ../sources/syncserver/page/sync_files/ -type f -exec sed -i -e "s@media\/img@$path\/media\/img@g" {} \;
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
final_path=/opt/yunohost/ffsync
|
final_path=/opt/yunohost/ffsync
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
|
@ -67,6 +74,8 @@ sudo sed -i -e "s@changesecret@$secret@g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunouser/$db_user/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunobase/$db_user/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/syncserver.ini
|
||||||
|
sudo sed -i -e "s@media\/img@$path\/media\/img@g" $final_path/syncserver/page/sync_files/firefox_sync-bundle.css
|
||||||
|
sudo sed -i -e "s@media\/img@$path\/media\/img@g" $final_path/syncserver/page/sync_files/responsive-bundle.css
|
||||||
|
|
||||||
# Init virtualenv
|
# Init virtualenv
|
||||||
cd $final_path && sudo make build && sudo ./local/bin/easy_install gunicorn
|
cd $final_path && sudo make build && sudo ./local/bin/easy_install gunicorn
|
||||||
|
@ -93,4 +102,4 @@ sudo service ffsync restart
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
sudo service nginx restart
|
sudo service nginx restart
|
||||||
sudo yunohost service add ffsync -l /var/log/ffsync.log
|
sudo yunohost service add ffsync -l /var/log/ffsync.log
|
||||||
sudo yunohost app setting ffsync skipped_uris -v "/"
|
ynh_app_setting_set ffsync skipped_uris "/"
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
db_user=ffsync
|
db_user=ffsync
|
||||||
db_name=ffsync
|
db_name=ffsync
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
domain=$(sudo yunohost app setting ffsync domain)
|
domain=$(ynh_app_setting_get ffsync domain)
|
||||||
|
|
||||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
sudo rm -rf /opt/yunohost/ffsync
|
sudo rm -rf /opt/yunohost/ffsync
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting ffsync domain)
|
domain=$(ynh_app_setting_get ffsync domain)
|
||||||
path=$(sudo yunohost app setting ffsync path)
|
path=$(ynh_app_setting_get ffsync path)
|
||||||
db_pwd=$(sudo yunohost app setting ffsync mysqlpwd)
|
db_pwd=$(ynh_app_setting_get ffsync mysqlpwd)
|
||||||
db_user=ffsync
|
db_user=ffsync
|
||||||
final_path=/opt/yunohost/ffsync
|
final_path=/opt/yunohost/ffsync
|
||||||
|
|
||||||
# Get secret variable
|
# Get secret variable
|
||||||
secret=$(sudo yunohost app setting ffsync secret)
|
secret=$(ynh_app_setting_get ffsync secret)
|
||||||
# Get from conf file if not defined
|
# Get from conf file if not defined
|
||||||
if [[ -z $secret ]]
|
if [[ -z $secret ]]
|
||||||
then
|
then
|
||||||
secret=$(sudo grep "secret =" $final_path/syncserver.ini | cut -d" " -f3)
|
secret=$(sudo grep "secret =" $final_path/syncserver.ini | cut -d" " -f3)
|
||||||
sudo yunohost app setting ffsync secret -v $secret
|
ynh_app_setting_set ffsync secret $secret
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check Swap
|
# Check Swap
|
||||||
|
@ -33,6 +36,9 @@ then
|
||||||
sudo swapon $tmp_swap_file
|
sudo swapon $tmp_swap_file
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Modify assets to take path into account
|
||||||
|
sudo find ../sources/syncserver/page/sync_files/ -type f -exec sed -i -e "s@media\/img@$path\/media\/img@g" {} \;
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo cp -a ../sources/* $final_path
|
sudo cp -a ../sources/* $final_path
|
||||||
|
@ -53,6 +59,8 @@ sudo sed -i -e "s@changesecret@$secret@g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunouser/$db_user/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/syncserver.ini
|
||||||
sudo sed -i "s/yunobase/$db_user/g" $final_path/syncserver.ini
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/syncserver.ini
|
||||||
|
sudo sed -i -e "s@media\/img@$path\/media\/img@g" $final_path/syncserver/page/sync_files/firefox_sync-bundle.css
|
||||||
|
sudo sed -i -e "s@media\/img@$path\/media\/img@g" $final_path/syncserver/page/sync_files/responsive-bundle.css
|
||||||
|
|
||||||
# stop service before upgrade
|
# stop service before upgrade
|
||||||
sudo service ffsync stop
|
sudo service ffsync stop
|
||||||
|
@ -81,5 +89,5 @@ sudo service ffsync restart
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app setting ffsync skipped_uris -v "/"
|
ynh_app_setting_set ffsync skipped_uris "/"
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue