mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
Mise à jour
This commit is contained in:
parent
82548a52e5
commit
27235c324b
9 changed files with 114 additions and 49 deletions
|
@ -3,7 +3,7 @@ Lutim for YunoHost
|
||||||
|
|
||||||
[Yunohost project](https://yunohost.org/#/)
|
[Yunohost project](https://yunohost.org/#/)
|
||||||
|
|
||||||
...Description...
|
Application d'hébergement et de partage d'images anonyme.
|
||||||
|
|
||||||
https://lut.im
|
https://lut.im
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
# if set to 1, all the images will be encrypted and the encryption option will no be displayed
|
# if set to 1, all the images will be encrypted and the encryption option will no be displayed
|
||||||
# optional, default is 0
|
# optional, default is 0
|
||||||
#always_encrypt => 0,
|
always_encrypt => __ENCRYPT__,
|
||||||
|
|
||||||
# length of the image's delete token
|
# length of the image's delete token
|
||||||
# optional, default is 24
|
# optional, default is 24
|
||||||
|
|
|
@ -17,7 +17,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
DAEMON=script/lutim
|
DAEMON=script/lutim
|
||||||
NAME=lutim
|
NAME=lutim
|
||||||
DESC=lutim
|
DESC=lutim
|
||||||
LUTIM_DIR=__FINALPATH__
|
|
||||||
|
|
||||||
if [ -f "/etc/default/lutim" ]
|
if [ -f "/etc/default/lutim" ]
|
||||||
then
|
then
|
||||||
|
@ -50,7 +49,7 @@ do_start()
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
|
|
||||||
cd $LDIR
|
cd $LDIR
|
||||||
carton exec hypnotoad $DAEMON >> $LUTIM_DIR/log/production.log 2>&1
|
carton exec hypnotoad $DAEMON >> /var/log/lutim/production.log 2>&1
|
||||||
return "$?"
|
return "$?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +62,7 @@ do_stop()
|
||||||
# other if a failure occurred
|
# other if a failure occurred
|
||||||
|
|
||||||
cd $LDIR
|
cd $LDIR
|
||||||
carton exec hypnotoad -s $DAEMON >> $LUTIM_DIR/log/production.log 2>&1
|
carton exec hypnotoad -s $DAEMON >> /var/log/lutim/production.log 2>&1
|
||||||
|
|
||||||
return "$?"
|
return "$?"
|
||||||
}
|
}
|
||||||
|
@ -76,11 +75,14 @@ do_status()
|
||||||
pgrep -lf $DAEMON >/dev/null 2>&1
|
pgrep -lf $DAEMON >/dev/null 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
log_progress_msg "$NAME is running"
|
log_progress_msg "$NAME is running"
|
||||||
|
log_end_msg 0
|
||||||
else
|
else
|
||||||
log_progress_msg "$NAME is NOT running"
|
log_progress_msg "$NAME is NOT running"
|
||||||
|
log_end_msg 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log_progress_msg "$NAME is NOT running"
|
log_progress_msg "$NAME is NOT running"
|
||||||
|
log_end_msg 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
"name": "Lutim",
|
"name": "Lutim",
|
||||||
"id": "lutim",
|
"id": "lutim",
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Images self hosting application",
|
"en": "Self hosting images and sharing anonymous application",
|
||||||
"fr": "Application d'upload d'images"
|
"fr": "Application d'hébergement et de partage d'images anonyme"
|
||||||
},
|
},
|
||||||
"version": "0.6",
|
"version": "0.6",
|
||||||
"url": "https://lut.im",
|
"url": "https://lut.im",
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
"fr": "Choisissez un domaine pour Lutim"
|
"fr": "Choisissez un domaine pour Lutim"
|
||||||
},
|
},
|
||||||
"example": "domain.org",
|
"example": "domain.org",
|
||||||
"default": "crudelis-test.fr"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
@ -39,7 +38,6 @@
|
||||||
"fr": "Choisissez un administrateur Lutim (doit être un utilisateur YunoHost)"
|
"fr": "Choisissez un administrateur Lutim (doit être un utilisateur YunoHost)"
|
||||||
},
|
},
|
||||||
"example": "john",
|
"example": "john",
|
||||||
"default": "mcrudelis"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
@ -49,6 +47,15 @@
|
||||||
},
|
},
|
||||||
"choices": ["Yes", "No"],
|
"choices": ["Yes", "No"],
|
||||||
"default": "No"
|
"default": "No"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "always_encrypt",
|
||||||
|
"ask": {
|
||||||
|
"en": "Force the encryption of images?",
|
||||||
|
"fr": "Forcer le chiffrement des images ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ domain=$1
|
||||||
path=$2
|
path=$2
|
||||||
admin=$3
|
admin=$3
|
||||||
is_public=$4
|
is_public=$4
|
||||||
|
always_encrypt=$5
|
||||||
app=lutim
|
app=lutim
|
||||||
|
|
||||||
# Check if admin exists
|
# Check if admin exists
|
||||||
|
@ -43,6 +44,8 @@ fi
|
||||||
sudo yunohost app setting $app admin -v $admin
|
sudo yunohost app setting $app admin -v $admin
|
||||||
sudo yunohost app setting $app domain -v $domain
|
sudo yunohost app setting $app domain -v $domain
|
||||||
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 port -v $port
|
||||||
|
sudo yunohost app setting $app always_encrypt -v $always_encrypt
|
||||||
|
|
||||||
|
|
||||||
# Copy files to right place
|
# Copy files to right place
|
||||||
|
@ -55,9 +58,9 @@ sudo cp -a ../sources/ajouts/. "$final_path"
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
# Installation du module perl carton
|
# Installation du module perl carton
|
||||||
|
sudo mkdir -p /var/log/$app/
|
||||||
echo "Installation du module perl carton. Attention, étape très longue..."
|
echo "Installation du module perl carton. Attention, étape très longue..."
|
||||||
# yes | sudo cpan Carton | sudo tee $final_path/cpan_setup.log 2>&1 > /dev/null 2>&1 # Debug
|
yes | sudo cpan Carton 2>&1 | sudo tee "/var/log/$app/setup_carton.log" > /dev/null
|
||||||
yes | sudo cpan Carton > "$final_path/log/setup_carton.log" 2>&1
|
|
||||||
|
|
||||||
# Installation de perlmagick, interface perl pour imagemagick
|
# Installation de perlmagick, interface perl pour imagemagick
|
||||||
sudo apt-get install perlmagick -qy
|
sudo apt-get install perlmagick -qy
|
||||||
|
@ -67,13 +70,19 @@ sudo cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
||||||
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lutim.conf"
|
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lutim.conf"
|
||||||
sudo sed -i "s@__PATH__@$path@g" "$final_path/lutim.conf"
|
sudo sed -i "s@__PATH__@$path@g" "$final_path/lutim.conf"
|
||||||
sudo sed -i "s@__PORT__@$port@g" "$final_path/lutim.conf"
|
sudo sed -i "s@__PORT__@$port@g" "$final_path/lutim.conf"
|
||||||
|
if [ "always_encrypt" = "No" ]; then
|
||||||
|
always_encrypt=0
|
||||||
|
else
|
||||||
|
always_encrypt=1
|
||||||
|
fi
|
||||||
|
sudo sed -i "s@__ENCRYPT__@$always_encrypt@g" "$final_path/lutim.conf"
|
||||||
secret=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
secret=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
sudo sed -i "s@__SECRET__@$secret@g" "$final_path/lutim.conf"
|
sudo sed -i "s@__SECRET__@$secret@g" "$final_path/lutim.conf"
|
||||||
|
|
||||||
|
|
||||||
# Mise en place des scripts init
|
# Mise en place des scripts init
|
||||||
sudo cp ../conf/lutim.init /etc/init.d/lutim
|
sudo cp ../conf/lutim.init /etc/init.d/lutim
|
||||||
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/init.d/lutim
|
# sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/init.d/lutim
|
||||||
sudo cp ../conf/lutim.default /etc/default/lutim
|
sudo cp ../conf/lutim.default /etc/default/lutim
|
||||||
sudo chmod +x /etc/init.d/lutim
|
sudo chmod +x /etc/init.d/lutim
|
||||||
sudo chown root:root /etc/init.d/lutim /etc/default/lutim
|
sudo chown root:root /etc/init.d/lutim /etc/default/lutim
|
||||||
|
@ -85,7 +94,7 @@ sudo sed -i "s@__FINALPATH__@$final_path/@g" /etc/cron.d/$app
|
||||||
|
|
||||||
# Installation de lutim via carton
|
# Installation de lutim via carton
|
||||||
cd $final_path
|
cd $final_path
|
||||||
sudo carton install 2>&1 | tee -a "$final_path/log/setup_carton.log"
|
sudo carton install 2>&1 | sudo tee -a "/var/log/$app/setup_carton.log"
|
||||||
|
|
||||||
## Démarrage auto des scripts init
|
## Démarrage auto des scripts init
|
||||||
sudo update-rc.d lutim defaults
|
sudo update-rc.d lutim defaults
|
||||||
|
@ -100,9 +109,14 @@ sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
if [ "$is_public" = "No" ];
|
if [ "$is_public" = "No" ];
|
||||||
then # Si l'app est privée, seul le visionnage des images reste public
|
then # Si l'app est privée, seul le visionnage des images reste public
|
||||||
sudo yunohost app setting $app protected_regex -v "$path/stats$","$path/manifest.webapp$","$path/$","$path/d/.*$","$path/m/.*$"
|
sudo yunohost app setting $app protected_regex -v "$path/stats$","$path/manifest.webapp$","$path/$","$path/d/.*$","$path/m/.*$"
|
||||||
# sudo yunohost app setting $app skipped_regex -v "$domain/$path/[0-9A-Za-z]{8}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Making log symbolic link to /var/log
|
||||||
|
sudo touch /var/log/$app/production.log
|
||||||
|
sudo chown www-data: /var/log/$app/production.log
|
||||||
|
# sudo rm -f /var/www/$app/log/production.log
|
||||||
|
sudo ln -s /var/log/$app/production.log "$final_path/log/production.log"
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
sudo chown -R www-data: $final_path
|
sudo chown -R www-data: $final_path
|
||||||
# Start lutim
|
# Start lutim
|
||||||
|
@ -110,6 +124,9 @@ sudo /etc/init.d/lutim start
|
||||||
# Set right permissions on new files created at first start
|
# Set right permissions on new files created at first start
|
||||||
sudo chown -R www-data: "$final_path"
|
sudo chown -R www-data: "$final_path"
|
||||||
|
|
||||||
|
# Add lutim as a service
|
||||||
|
sudo yunohost service add lutim -l $final_path/log/production.log
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
app=lutim
|
app=lutim
|
||||||
|
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
final_path=$(sudo yunohost app setting $app final_path)
|
|
||||||
|
# Arrêt de lutim
|
||||||
sudo service lutim stop
|
sudo service lutim stop
|
||||||
|
|
||||||
|
# Suppression du dossier
|
||||||
|
sudo rm -rf /var/www/$app
|
||||||
|
|
||||||
|
# Suppression de la configuration nginx
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
# sudo rm -rf $final_path
|
|
||||||
sudo rm -rf /var/www/lutim
|
# Suppression des fichiers init
|
||||||
sudo rm -f /etc/default/lutim
|
sudo rm -f /etc/default/lutim
|
||||||
sudo rm -f /etc/init.d/lutim
|
sudo rm -f /etc/init.d/lutim
|
||||||
|
sudo update-rc.d -f lutim remove
|
||||||
|
|
||||||
|
# Retirer le cron
|
||||||
|
sudo rm -f /etc/cron.d/$app
|
||||||
|
|
||||||
|
# Remove lutim service in ynh panel
|
||||||
|
sudo yunohost service remove lutim
|
||||||
|
|
||||||
|
# Suppression des log
|
||||||
|
sudo rm -r /var/log/$app/
|
||||||
|
|
||||||
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -1,41 +1,62 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
app=lutim
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(sudo yunohost app setting leed domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
path=$(sudo yunohost app setting leed path)
|
path=$(sudo yunohost app setting $app path)
|
||||||
is_public=$(sudo yunohost app setting leed is_public)
|
is_public=$(sudo yunohost app setting $app is_public)
|
||||||
|
port=$(sudo yunohost app setting $app port)
|
||||||
|
always_encrypt=$(sudo yunohost app setting $app always_encrypt)
|
||||||
|
|
||||||
# Copy files to right place
|
# Copy files to right place
|
||||||
final_path=/var/www/leed
|
final_path=/var/www/$app
|
||||||
sudo mkdir -p $final_path
|
# Décompresse la source
|
||||||
sudo cp -a ../sources/* $final_path
|
tar -x -f ../sources/lutim.tar.gz
|
||||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/leed.conf
|
sudo cp -a lutim/. "$final_path"
|
||||||
|
sudo cp -a ../sources/ajouts/. "$final_path"
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
# Change variables in nginx configuration
|
||||||
|
sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
|
## Copie et configuration du fichier de conf.
|
||||||
|
sudo cp ../conf/lutim.conf.template "$final_path/lutim.conf"
|
||||||
|
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lutim.conf"
|
||||||
|
sudo sed -i "s@__PATH__@$path@g" "$final_path/lutim.conf"
|
||||||
|
sudo sed -i "s@__PORT__@$port@g" "$final_path/lutim.conf"
|
||||||
|
if [ "always_encrypt" = "No" ]; then
|
||||||
|
always_encrypt=0
|
||||||
|
else
|
||||||
|
always_encrypt=1
|
||||||
|
fi
|
||||||
|
sudo sed -i "s@__ENCRYPT__@$always_encrypt@g" "$final_path/lutim.conf"
|
||||||
|
|
||||||
|
# Mise en place des scripts init
|
||||||
|
sudo cp ../conf/lutim.init /etc/init.d/lutim
|
||||||
|
sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/init.d/lutim
|
||||||
|
sudo cp ../conf/lutim.default /etc/default/lutim
|
||||||
|
sudo chmod +x /etc/init.d/lutim
|
||||||
|
sudo chown root:root /etc/init.d/lutim /etc/default/lutim
|
||||||
|
sudo sed -i "s@__FINALPATH__@$final_path/@g" /etc/default/lutim
|
||||||
|
|
||||||
|
## Mise en place des crons
|
||||||
|
sudo cp ../conf/cron_lutim /etc/cron.d/$app
|
||||||
|
sudo sed -i "s@__FINALPATH__@$final_path/@g" /etc/cron.d/$app
|
||||||
|
|
||||||
|
# Make app public or private
|
||||||
|
sudo yunohost app setting $app skipped_uris -v "/"
|
||||||
|
if [ "$is_public" = "No" ];
|
||||||
|
then # Si l'app est privée, seul le visionnage des images reste public
|
||||||
|
sudo yunohost app setting $app protected_regex -v "$path/stats$","$path/manifest.webapp$","$path/$","$path/d/.*$","$path/m/.*$"
|
||||||
|
fi
|
||||||
|
|
||||||
# Set right permissions
|
# Set right permissions
|
||||||
sudo chown -R www-data: $final_path
|
sudo chown -R www-data: $final_path
|
||||||
|
# Restart lutim
|
||||||
|
sudo /etc/init.d/lutim restart
|
||||||
|
|
||||||
# Change variables in Leed configuration
|
|
||||||
sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/leed.conf
|
|
||||||
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/leed.conf
|
|
||||||
|
|
||||||
# Files owned by root, www-data can just read
|
|
||||||
sudo find $final_path -type f | xargs sudo chmod 644
|
|
||||||
sudo find $final_path -type d | xargs sudo chmod 755
|
|
||||||
sudo chown -R root: $final_path
|
|
||||||
# www-data can write on plugins and cache
|
|
||||||
sudo chown -R www-data $final_path/cache $final_path/plugins
|
|
||||||
|
|
||||||
# Make app private if necessary
|
|
||||||
sudo yunohost app setting leed is_public -v "$is_public"
|
|
||||||
if [ "$is_public" = "No" ];
|
|
||||||
then
|
|
||||||
# Retire l'autorisation d'accès de la page d'install.
|
|
||||||
sudo yunohost app setting leed unprotected_uris -d
|
|
||||||
# Rend la page d'actualisation accessible pour le script cron.
|
|
||||||
sudo yunohost app setting leed skipped_uris -v "/action.php"
|
|
||||||
else # Si l'app est publique
|
|
||||||
sudo yunohost app setting leed unprotected_uris -v "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
Binary file not shown.
1
version
1
version
|
@ -1 +0,0 @@
|
||||||
Leed 1.6
|
|
Loading…
Add table
Reference in a new issue