mirror of
https://github.com/YunoHost-Apps/bozon_ynh.git
synced 2024-09-03 18:16:09 +02:00
update
This commit is contained in:
parent
a68bb52b76
commit
5855b6e1f1
9 changed files with 103 additions and 164 deletions
|
@ -1 +0,0 @@
|
||||||
333eccfc7bae5ff5a55a4de6e373ab9ffb0ba273
|
|
13
conf/bozon-deps.control
Normal file
13
conf/bozon-deps.control
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Homepage: http://bozon.pw
|
||||||
|
Standards-Version: 3.9.2
|
||||||
|
|
||||||
|
Package: bozon-deps
|
||||||
|
Version: 2.16-1
|
||||||
|
Depends: php5-curl, php5-gd
|
||||||
|
Architecture: all
|
||||||
|
Description: meta package for bozon dependencies
|
||||||
|
BoZon is a minimalist drag & drop file sharing application. BoZon is self hostable, free and opensource.
|
||||||
|
.
|
||||||
|
This meta-package is only responsible of installing its dependencies.
|
1
conf/upstream_version
Normal file
1
conf/upstream_version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
11af3638d5555d21178128661f0b2a581eed8f2e
|
|
@ -1,90 +0,0 @@
|
||||||
{
|
|
||||||
"name": "BoZoN",
|
|
||||||
"id": "bozon",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "Minimalist Drag & drop file sharing app",
|
|
||||||
"fr": "Application minimaliste de partage de fichiers"
|
|
||||||
},
|
|
||||||
"url": "http://bozon.pw",
|
|
||||||
"license": "free",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "ewilly",
|
|
||||||
"email": "ewilly@neuf.fr"
|
|
||||||
},
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">> 2.2.1.1"
|
|
||||||
},
|
|
||||||
"multi_instance": "false",
|
|
||||||
"services": [
|
|
||||||
"nginx",
|
|
||||||
"php5-fpm"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install" : [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain for BoZoN",
|
|
||||||
"fr": "Choisissez un domaine pour BoZoN"
|
|
||||||
},
|
|
||||||
"example": "domain.org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for BoZoN",
|
|
||||||
"fr": "Choisissez un chemin pour BoZoN"
|
|
||||||
},
|
|
||||||
"example": "/bozon",
|
|
||||||
"default": "/bozon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"ask": {
|
|
||||||
"en": "Should this application be public ? (if not, sharing file with unregistered users still work)",
|
|
||||||
"fr": "Est-ce que cette application doit être visible publiquement ? (dans le cas contraire, le partage de fichiers avec des utilisateurs externes fonctionnera tout de même)"
|
|
||||||
},
|
|
||||||
"choices": ["Yes", "No"],
|
|
||||||
"default": "No"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "language",
|
|
||||||
"ask": {
|
|
||||||
"en": "Default language",
|
|
||||||
"fr": "Langue par défaut"
|
|
||||||
},
|
|
||||||
"choices": ["de","en","es","fr"],
|
|
||||||
"default": "en"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "filesize",
|
|
||||||
"ask": {
|
|
||||||
"en": "Define the file upload size limit",
|
|
||||||
"fr": "Définissez la taille limite de téléchargement"
|
|
||||||
},
|
|
||||||
"default": "2G"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose an admin user for BoZoN",
|
|
||||||
"fr": "Choisissez un administrateur pour BoZoN"
|
|
||||||
},
|
|
||||||
"example": "homer"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "password",
|
|
||||||
"type": "password",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose an admin password for BoZoN",
|
|
||||||
"fr": "Choisissez un mot de passe administrateur pour BoZoN"
|
|
||||||
},
|
|
||||||
"example": "super_secret_password"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +1,14 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
# causes the shell to exit if you try to use an uninitialised variable
|
|
||||||
set -u
|
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# retrieve arguments
|
# retrieve arguments
|
||||||
if [ $ynh_version = "2.4" ]; then
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
else
|
|
||||||
app=bozon
|
|
||||||
fi
|
|
||||||
save_path=$1
|
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
parent_path=/var/www
|
parent_path=/var/www
|
||||||
|
@ -22,10 +16,10 @@ final_path=$parent_path/$app
|
||||||
data_path=/home/yunohost.app/$app
|
data_path=/home/yunohost.app/$app
|
||||||
|
|
||||||
# backup sources & data
|
# backup sources & data
|
||||||
sudo cp -R $final_path/. $save_path/www/
|
ynh_backup "$final_path" "www"
|
||||||
sudo cp -R $data_path/. $save_path/datas/
|
ynh_backup "$data_path" "data"
|
||||||
|
|
||||||
# backup php-fpm, Nginx and YunoHost parameters
|
# backup Nginx and php-fpm
|
||||||
sudo cp -a /etc/yunohost/apps/$app/. $save_path/yunohost/
|
mkdir ./conf
|
||||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $save_path/nginx.conf
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
|
||||||
sudo cp -a /etc/php5/fpm/pool.d/$app.conf $save_path/php-fpm.conf
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
# causes the shell to exit if you try to use an uninitialised variable
|
|
||||||
set -u
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||||
|
|
||||||
|
@ -17,8 +18,6 @@ if [ $ynh_version = "2.4" ]; then
|
||||||
filesize=$YNH_APP_ARG_FILESIZE
|
filesize=$YNH_APP_ARG_FILESIZE
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
# Source app helpers
|
|
||||||
. /usr/share/yunohost/helpers
|
|
||||||
else
|
else
|
||||||
app=bozon
|
app=bozon
|
||||||
domain=$1
|
domain=$1
|
||||||
|
@ -37,7 +36,7 @@ EXIT_PROPERLY () {
|
||||||
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!"
|
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!"
|
||||||
|
|
||||||
if [ $ynh_version = "2.2" ]; then
|
if [ $ynh_version = "2.2" ]; then
|
||||||
/bin/bash ./remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.
|
/bin/bash ./remove # Appel le script remove. En 2.2, ce comportement n'est pas automatique.s
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -73,25 +72,24 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
touch /force_stop
|
touch /force_stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# retrieve stable version of bozon
|
# add required packages
|
||||||
stable=$(cat ../BoZoN-stable)
|
ynh_package_install_from_equivs ../conf/${app}-deps.control || ynh_die "Unable to install dependencies"
|
||||||
|
|
||||||
|
# retrieve upstream_version version of bozon
|
||||||
|
upstream_version=$(cat ../conf/upstream_version)
|
||||||
|
|
||||||
# save app settings
|
# save app settings
|
||||||
sudo yunohost app setting $app admin_user -v "$admin"
|
sudo yunohost app setting $app admin_user -v "$admin"
|
||||||
sudo yunohost app setting $app is_public -v "$is_public"
|
sudo yunohost app setting $app is_public -v "$is_public"
|
||||||
sudo yunohost app setting $app domain -v "$domain"
|
sudo yunohost app setting $app domain -v "$domain"
|
||||||
sudo yunohost app setting $app path -v "$path"
|
sudo yunohost app setting $app path -v "$path"
|
||||||
sudo yunohost app setting $app version -v "$stable"
|
sudo yunohost app setting $app version -v "$upstream_version"
|
||||||
sudo yunohost app setting $app filesize -v "$filesize"
|
sudo yunohost app setting $app filesize -v "$filesize"
|
||||||
|
|
||||||
# download stable version of bozon
|
# download upstream_version version of bozon
|
||||||
sudo wget https://github.com/broncowdd/BoZoN/archive/$stable.zip -O $parent_path/bozon-$stable.zip
|
wget -nc --quiet https://github.com/broncowdd/BoZoN/archive/$upstream_version.zip -P /tmp
|
||||||
sudo unzip $parent_path/bozon-$stable.zip -d $parent_path/
|
sudo unzip -oq /tmp/$upstream_version.zip -d /tmp
|
||||||
sudo rm $parent_path/bozon-$stable.zip
|
sudo mv /tmp/$upstream_version $parent_path/$app
|
||||||
sudo mv $parent_path/BoZoN-* $parent_path/$app
|
|
||||||
|
|
||||||
# add required packages
|
|
||||||
sudo apt-get install php5-curl php5-gd
|
|
||||||
|
|
||||||
# copy files to final folder and set permissions
|
# copy files to final folder and set permissions
|
||||||
sudo find $final_path -type f -name ".htaccess" | xargs sudo rm
|
sudo find $final_path -type f -name ".htaccess" | xargs sudo rm
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
# causes the shell to exit if you try to use an uninitialised variable
|
|
||||||
set -u
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||||
|
|
||||||
|
@ -34,6 +35,9 @@ if [ -e "/home/yunohost.app/$app" ]; then
|
||||||
sudo rm -rf /home/yunohost.app/$app
|
sudo rm -rf /home/yunohost.app/$app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove app dependencies
|
||||||
|
ynh_package_autoremove "${app}-deps" || true
|
||||||
|
|
||||||
# Restart services
|
# Restart services
|
||||||
sudo service php5-fpm restart || true
|
sudo service php5-fpm restart || true
|
||||||
sudo service nginx restart || true
|
sudo service nginx restart || true
|
||||||
|
|
|
@ -1,30 +1,49 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
# causes the shell to exit if you try to use an uninitialised variable
|
|
||||||
set -u
|
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#retrieve arguments
|
#retrieve arguments
|
||||||
if [ $ynh_version = "2.4" ]; then
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
else
|
|
||||||
app=bozon
|
|
||||||
fi
|
|
||||||
save_path=$1
|
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
|
||||||
|
|
||||||
# definie useful vars
|
# definie useful vars
|
||||||
app=bozon
|
|
||||||
parent_path=/var/www
|
parent_path=/var/www
|
||||||
final_path=$parent_path/$app
|
final_path=$parent_path/$app
|
||||||
data_path=/home/yunohost.app/$app
|
data_path=/home/yunohost.app/$app
|
||||||
|
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
|
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
|
||||||
|
|
||||||
|
# check domain/path availability with app helper
|
||||||
|
sudo yunohost app checkurl $domain$path -a $app \
|
||||||
|
|| ynh_die "The path ${domain}${path} is not available for app installation."
|
||||||
|
|
||||||
|
# check directories availability
|
||||||
|
[[ -d $final_path ]] && ynh_die \
|
||||||
|
"The path '${final_path}' already exists.
|
||||||
|
You should safely delete it before restoring this app."
|
||||||
|
[[ -d $data_path ]] && ynh_die \
|
||||||
|
"The path '${data_path}' already exists.
|
||||||
|
You should safely delete it before restoring this app."
|
||||||
|
|
||||||
|
# check configuration files
|
||||||
|
[[ -f $nginx_conf ]] && ynh_die \
|
||||||
|
"The NGINX configuration already exists at '${nginx_conf}'.
|
||||||
|
You should safely delete it before restoring this app."
|
||||||
|
[[ -f $phpfpm_conf ]] && ynh_die \
|
||||||
|
"The PHP FPM configuration already exists at '${phpfpm_conf}'.
|
||||||
|
You should safely delete it before restoring this app."
|
||||||
|
|
||||||
|
# add required packages
|
||||||
|
ynh_package_install_from_equivs ../conf/${app}-deps.control || ynh_die "Unable to install dependencies"
|
||||||
|
|
||||||
# restore sources & data
|
# restore sources & data
|
||||||
sudo mv $save_path/www/. $final_path/
|
sudo cp -a ./www "$final_path"
|
||||||
sudo mv $save_path/datas/. $data_path/
|
sudo mkdir -p "$data_path"
|
||||||
|
sudo cp -a ./data/. "$data_path"
|
||||||
|
|
||||||
# restore permissions
|
# restore permissions
|
||||||
sudo chown -R root: $final_path
|
sudo chown -R root: $final_path
|
||||||
|
@ -34,10 +53,9 @@ sudo chown -R www-data: $final_path/private
|
||||||
sudo chown -R www-data: $data_path/uploads
|
sudo chown -R www-data: $data_path/uploads
|
||||||
sudo chown -R www-data: $data_path/thumbs
|
sudo chown -R www-data: $data_path/thumbs
|
||||||
|
|
||||||
# restore php-fpm, Nginx and YunoHost parameters
|
# restore Nginx & php-fpm
|
||||||
sudo cp -a $save_path/yunohost/. /etc/yunohost/apps/$app/
|
sudo cp -a ./conf/nginx.conf "$nginx_conf"
|
||||||
sudo cp -a $save_path/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp -a ./conf/php-fpm.conf "$phpfpm_conf"
|
||||||
sudo cp -a $save_path/php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
|
|
||||||
|
|
||||||
# Restart services
|
# Restart services
|
||||||
sudo service php5-fpm restart || true
|
sudo service php5-fpm restart || true
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -e
|
set -eu
|
||||||
# causes the shell to exit if you try to use an uninitialised variable
|
|
||||||
set -u
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ else
|
||||||
app=bozon
|
app=bozon
|
||||||
fi
|
fi
|
||||||
path=$(sudo yunohost app setting $app path)
|
path=$(sudo yunohost app setting $app path)
|
||||||
stable=$(sudo yunohost app setting $app version)
|
upstream_version=$(sudo yunohost app setting $app version)
|
||||||
is_public=$(sudo yunohost app setting $app is_public)
|
is_public=$(sudo yunohost app setting $app is_public)
|
||||||
filesize=$(sudo yunohost app setting $app filesize)
|
filesize=$(sudo yunohost app setting $app filesize)
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
@ -29,18 +30,19 @@ parent_path=/var/www
|
||||||
data_path=/home/yunohost.app/$app
|
data_path=/home/yunohost.app/$app
|
||||||
final_path=$parent_path/$app
|
final_path=$parent_path/$app
|
||||||
|
|
||||||
# retrieve stable version of bozon
|
# add required packages
|
||||||
stable=$(cat ../BoZoN-stable)
|
ynh_package_install_from_equivs ../conf/${app}-deps.control || ynh_die "Unable to install dependencies"
|
||||||
|
|
||||||
|
# retrieve upstream_version version of bozon
|
||||||
|
upstream_version=$(cat ../conf/upstream_version)
|
||||||
|
|
||||||
# save app settings
|
# save app settings
|
||||||
sudo yunohost app setting $app version -v "$stable"
|
sudo yunohost app setting $app version -v "$upstream_version"
|
||||||
|
|
||||||
# download stable version of bozon
|
# download upstream_version version of bozon
|
||||||
sudo wget https://github.com/broncowdd/BoZoN/archive/$stable.zip -O $parent_path/bozon-$stable.zip
|
wget -nc --quiet https://github.com/broncowdd/BoZoN/archive/$upstream_version.zip -P /tmp
|
||||||
sudo unzip $parent_path/bozon-$stable.zip -d $parent_path/
|
sudo unzip -oq /tmp/$upstream_version.zip -d /tmp
|
||||||
sudo rm $parent_path/bozon-$stable.zip
|
sudo rsync -avz --exclude="config.php" --exclude=".htaccess" /tmp/$upstream_version/* $final_path
|
||||||
sudo rsync -avz --exclude="config.php" --exclude=".htaccess" $parent_path/BoZoN-$stable/* $final_path
|
|
||||||
sudo rm -R $parent_path/BoZoN-$stable
|
|
||||||
|
|
||||||
# configure nginx settings
|
# configure nginx settings
|
||||||
## path
|
## path
|
||||||
|
|
Loading…
Reference in a new issue