mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
scripts: rename smtp_user
to mattermost_user
This commit is contained in:
parent
256cafcb07
commit
3c9e53fe57
4 changed files with 34 additions and 34 deletions
|
@ -101,10 +101,10 @@ ynh_app_setting_set "$app" mysqlpwd "$db_password"
|
|||
# CREATE USER FOR EMAIL NOTIFICATIONS
|
||||
#=================================================
|
||||
|
||||
smtp_user="$app"
|
||||
smtp_password=$(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 useradd -M --shell /bin/false -p $(openssl passwd -1 "$smtp_password") "$smtp_user"
|
||||
ynh_app_setting_set "$app" smtppwd "$smtp_password"
|
||||
mattermost_user="$app"
|
||||
mattermost_user_password=$(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 useradd -M --shell /bin/false -p $(openssl passwd -1 "$mattermost_user_password") "$mattermost_user"
|
||||
ynh_app_setting_set "$app" smtppwd "$mattermost_user_password"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -132,8 +132,8 @@ sudo sed -i "s|\"Directory\": \"./data/\"|\"Directory\": \"${data_path}/\"|g"
|
|||
sudo sed -i "s|\"SendEmailNotifications\": false|\"SendEmailNotifications\": true|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"FeedbackName\": \"\"|\"FeedbackName\": \"Mattermost notification\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"FeedbackEmail\": \"\"|\"FeedbackEmail\": \"no-reply@${domain}\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPUsername\": \"\"|\"SMTPUsername\": \"${smtp_user}\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPPassword\": \"\"|\"SMTPPassword\": \"${smtp_password}\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPUsername\": \"\"|\"SMTPUsername\": \"${mattermost_user}\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPPassword\": \"\"|\"SMTPPassword\": \"${mattermost_user_password}\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPServer\": \"\"|\"SMTPServer\": \"localhost\"|g" $final_path/config/config.json
|
||||
sudo sed -i "s|\"SMTPPort\": \"\"|\"SMTPPort\": \"25\"|g" $final_path/config/config.json
|
||||
# Disable Mattermost debug console by default
|
||||
|
@ -150,9 +150,9 @@ ynh_app_setting_set "$app" analytics "$analytics"
|
|||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
sudo chown -R "$smtp_user:www-data" "$final_path"
|
||||
sudo chown -R "$smtp_user:www-data" "$data_path"
|
||||
sudo chown -R "$smtp_user:adm" "$logs_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$final_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$data_path"
|
||||
sudo chown -R "$mattermost_user:adm" "$logs_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
|
|
@ -17,7 +17,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get $app domain)
|
||||
db_name="$app"
|
||||
db_user="mmuser"
|
||||
smtp_user="$app"
|
||||
mattermost_user="$app"
|
||||
final_path="/var/www/$app"
|
||||
data_path="/home/yunohost.app/$app"
|
||||
logs_path="/var/log/$app"
|
||||
|
@ -77,4 +77,4 @@ sudo rm -rf "$logs_path"
|
|||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_system_user_delete "$smtp_user"
|
||||
ynh_system_user_delete "$mattermost_user"
|
||||
|
|
|
@ -27,7 +27,7 @@ data_path="/home/yunohost.app/$app"
|
|||
logs_path="/var/log/$app"
|
||||
db_name="$app"
|
||||
db_user="mmuser"
|
||||
smtp_user="$app"
|
||||
mattermost_user="$app"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -71,10 +71,10 @@ ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./db.sql
|
|||
#=================================================
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
smtp_user="$app"
|
||||
if ! ynh_system_user_exists "$smtp_user"; then
|
||||
smtp_password=$(ynh_app_setting_get $app smtppwd)
|
||||
useradd -M --shell /bin/false -p $(openssl passwd -1 "$smtp_password") "$smtp_user"
|
||||
mattermost_user="$app"
|
||||
if ! ynh_system_user_exists "$mattermost_user"; then
|
||||
mattermost_user_password=$(ynh_app_setting_get $app smtppwd)
|
||||
useradd -M --shell /bin/false -p $(openssl passwd -1 "$mattermost_user_password") "$mattermost_user"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -82,13 +82,13 @@ fi
|
|||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
sudo chown -R "$smtp_user:www-data" "$final_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$final_path"
|
||||
|
||||
mkdir -p "$data_path"
|
||||
sudo chown -R "$smtp_user:www-data" "$data_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$data_path"
|
||||
|
||||
mkdir -p "$logs_path"
|
||||
sudo chown -R "$smtp_user:adm" "$logs_path"
|
||||
sudo chown -R "$mattermost_user:adm" "$logs_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SSOWAT
|
||||
|
|
|
@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get $app domain)
|
||||
is_public=$(ynh_app_setting_get $app is_public)
|
||||
port=$(ynh_app_setting_get $app port)
|
||||
smtp_user="$app"
|
||||
mattermost_user="$app"
|
||||
|
||||
root_path="$(pwd)/.."
|
||||
final_path="/var/www/$app"
|
||||
|
@ -144,9 +144,9 @@ fi
|
|||
# RESTORE FILE PERMISSIONS
|
||||
#=================================================
|
||||
|
||||
sudo chown -R "$smtp_user:www-data" "$final_path"
|
||||
sudo chown -R "$smtp_user:www-data" "$data_path"
|
||||
sudo chown -R "$smtp_user:adm" "$logs_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$final_path"
|
||||
sudo chown -R "$mattermost_user:www-data" "$data_path"
|
||||
sudo chown -R "$mattermost_user:adm" "$logs_path"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue