mirror of
https://github.com/YunoHost-Apps/emailpoubelle_ynh.git
synced 2024-09-03 18:26:29 +02:00
mise à jour ynh helpers
This commit is contained in:
parent
8aa4ff2e3f
commit
e5955e8748
1 changed files with 26 additions and 16 deletions
|
@ -7,9 +7,8 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
app=emailpoubelle
|
ynh_abort_if_errors
|
||||||
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"
|
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
|
@ -17,19 +16,25 @@ path=$2
|
||||||
admin=$3
|
admin=$3
|
||||||
is_public=$4
|
is_public=$4
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
|
app=emailpoubelle
|
||||||
|
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"
|
||||||
|
cronline="0 */2 * * * www-data cd $final_path/www/; /usr/bin/php index.php > /dev/null 2>&1"
|
||||||
postfix=/etc/postfix/main.cf
|
postfix=/etc/postfix/main.cf
|
||||||
|
|
||||||
cronline="0 */2 * * * www-data cd $final_path/www/; /usr/bin/php index.php > /dev/null 2>&1"
|
#=================================================
|
||||||
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
final_path=/var/www/$app
|
||||||
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
# Normalize the url path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
# Check web path availability
|
# Check web path availability
|
||||||
ynh_webpath_available $domain $path
|
ynh_webpath_available $domain $path_url
|
||||||
#sudo yunohost app checkurl $domain$path -a $app
|
|
||||||
if [[ ! $? -eq 0 ]]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
# Check user
|
# Check user
|
||||||
ynh_user_exists "$admin"
|
ynh_user_exists "$admin"
|
||||||
|
@ -37,10 +42,15 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
echo "Wrong user"
|
echo "Wrong user"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
#=================================================
|
||||||
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Save app settings
|
ynh_app_setting_set $app domain $domain
|
||||||
sudo yunohost app setting $app admin -v "$admin"
|
ynh_app_setting_set $app path $path_url
|
||||||
sudo yunohost app setting $app is_public -v "$is_public"
|
ynh_app_setting_set $app admin $admin
|
||||||
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
#sudo yunohost app setting $app is_public -v "$is_public"
|
||||||
|
|
||||||
#install dependency
|
#install dependency
|
||||||
ynh_package_is_installed 'php-geoip'
|
ynh_package_is_installed 'php-geoip'
|
||||||
|
@ -70,7 +80,6 @@ sudo cp ../conf/index_source.php $final_path/www/index.php
|
||||||
ln -s $final_path/lang/fr $final_path/lang/fr_FR
|
ln -s $final_path/lang/fr $final_path/lang/fr_FR
|
||||||
ln -s $final_path/lang/it $final_path/lang/it_IT
|
ln -s $final_path/lang/it $final_path/lang/it_IT
|
||||||
|
|
||||||
|
|
||||||
#configuring with given settings
|
#configuring with given settings
|
||||||
sudo cp $final_path/conf-dist.php $final_path/conf.php
|
sudo cp $final_path/conf-dist.php $final_path/conf.php
|
||||||
sudo chown -R www-data:www-data $final_path
|
sudo chown -R www-data:www-data $final_path
|
||||||
|
@ -82,7 +91,8 @@ db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]'
|
||||||
db_user=emailPoubelle
|
db_user=emailPoubelle
|
||||||
|
|
||||||
#write password to the conf file
|
#write password to the conf file
|
||||||
sudo sed -i "s@motdepassedefou@$db_pwd@g" $final_path/conf.php
|
ynh_replace_string "motdepassedefou" "$db_pwd" $final_path/conf.php
|
||||||
|
#sudo sed -i "s@motdepassedefou@$db_pwd@g" $final_path/conf.php
|
||||||
|
|
||||||
#setting conf file not world-readable (dude, there is a plain-text password !)
|
#setting conf file not world-readable (dude, there is a plain-text password !)
|
||||||
sudo chmod o-r $final_path/conf.php
|
sudo chmod o-r $final_path/conf.php
|
||||||
|
|
Loading…
Add table
Reference in a new issue