-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from wazo-communication/update-script
Update script
- Loading branch information
Showing
6 changed files
with
197 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This is the official list of Wazo authors for copyright purposes. | ||
|
||
# Names should be added to this file as one of | ||
# Organization's name | ||
# Individual's name <email address> | ||
|
||
# Please keep the list sorted. | ||
|
||
Wazo Communication Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
# Wazo modify Mail configuration | ||
If you want modify the SMTP origin parameter (default : exemple.wazo.community) to your personal parameter <br> | ||
Or Domain, relayHost / fallback relayHost and Canical.<br> | ||
Autogenered edited file /etc/xivo/common.conf<br> | ||
Genered file /etc/mailname<br> | ||
and insert to database.<br> | ||
|
||
If you want modify the SMTP origin parameter (default : exemple.wazo.community) to your personal parameter or Domain, relayHost/fallback relayHost and Canical. | ||
|
||
This script do: | ||
|
||
* Auto-generated edited file /etc/xivo/common.conf | ||
* Generated file /etc/mailname | ||
* And insert to database. | ||
|
||
# Wazo version | ||
Wazo version >= 19.12<br> | ||
|
||
# Installation | ||
Wazo version >= 19.12 | ||
|
||
# Installation | ||
|
||
Connect to your stack and get the root. | ||
|
||
apt install wazo-plugind-cli | ||
wazo-plugind-cli -c "install git https://github.com/wazo-communication/wazo-update-smtp-origin" | ||
|
||
# Usage | ||
|
||
```console | ||
foo@bar:~$ cd /tmp/ | ||
foo@bar:/tmp$ wget https://raw.githubusercontent.com/fouille/wazo_update_smtp_origin/master/update_smtp_origin.sh | ||
foo@bar:/tmp$ chmod +x update_smtp_origin.sh | ||
foo@bar:/tmp$ ./update_smtp_origin.sh | ||
``` | ||
wazo-update-smtp-origin | ||
|
||
Read instruction into dialog box |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#!/bin/bash | ||
# Copyright 2021 The Wazo Authors (see the AUTHORS file) | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
|
||
bye() { | ||
whiptail --title "Hello Wazo HELP / Modify SMTP Origin" --msgbox "Your SMTP origin has been modified\nHave a nice day :-) Wazo Support." 10 60 | ||
} | ||
|
||
update_smtp_origin() { | ||
SMTP_Origin=$(whiptail --title "Hello Wazo HELP / Modify SMTP Origin" --inputbox "Please write your new SMTP Origin Domain (ex.: domain.tld):" 13 60 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n0\nAdd in DB, Please Wait... \nXXX" | ||
sudo -u postgres psql asterisk -c "UPDATE mail SET origin='$SMTP_Origin';"; | ||
|
||
echo -e "XXX\n50\nAdd $SMTP_Origin in DB... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
|
||
fi | ||
|
||
update_domain | ||
|
||
} | ||
|
||
update_domain() { | ||
domain=$(whiptail --title "Hello Wazo HELP / Modify Domain" \ | ||
--inputbox "Please write your Domain (ex.: domain.tdl):" 13 60 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n0\nAdd in DB, Please Wait... \nXXX" | ||
sudo -u postgres psql asterisk -c "UPDATE mail SET mydomain='$domain';"; | ||
|
||
echo -e "XXX\n50\nAdd in DB... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
fi | ||
|
||
update_canonical | ||
|
||
} | ||
|
||
update_canonical() { | ||
Canonical=$(whiptail --title "Hello Wazo HELP / Modify Canonical" \ | ||
--inputbox "Please write user part from your mail for Canonical (mail user part ex.: noreply):" 13 60 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n0\nAdd in DB, Please Wait... \nXXX" | ||
sudo -u postgres psql asterisk -c "UPDATE mail SET canonical='root $Canonical\nasterisk $Canonical\nwazo-agid $Canonical\nwazo-auth $Canonical\nwazo-amid $Canonical\nmunin $Canonical\nwazo $Canonical';"; | ||
|
||
echo -e "XXX\n50\nAdd in DB... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
fi | ||
|
||
update_relayhost | ||
|
||
} | ||
|
||
update_relayhost() { | ||
Relayhost=$(whiptail --title "Hello Wazo HELP / Modify relayhost" \ | ||
--inputbox "Please write Relay Host (ex.: smtp.domain.tld | no relay? leave empty):" 13 60 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n0\nAdd in DB, Please Wait... \nXXX" | ||
sudo -u postgres psql asterisk -c "UPDATE mail SET relayhost='$Relayhost';"; | ||
|
||
echo -e "XXX\n50\nAdd in DB... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
fi | ||
|
||
update_fallback_relayhost | ||
|
||
} | ||
|
||
update_fallback_relayhost() { | ||
fallback_relayhost=$(whiptail --title "Hello Wazo HELP / Modify fallback_relayhost" \ | ||
--inputbox "Please write fallback relay host (ex.: smtp2.domain.tld | no fallback relay? leave empty):" 13 60 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n0\nAdd in DB, Please Wait... \nXXX" | ||
sudo -u postgres psql asterisk -c "UPDATE mail SET fallback_relayhost='$fallback_relayhost';"; | ||
|
||
echo -e "XXX\n50\nAdd in DB... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
fi | ||
|
||
final_step | ||
|
||
} | ||
|
||
final_step() { | ||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
{ | ||
echo -e "XXX\n50\nCreate new config... \nXXX" | ||
xivo-create-config | ||
|
||
echo -e "XXX\n100\nCreate Config... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
echo -e "XXX\n50\nUpdate new config... \nXXX" | ||
xivo-update-config | ||
|
||
echo -e "XXX\n100\nUpdate Config... Done.\nXXX" | ||
sleep 0.5 | ||
|
||
} | whiptail --gauge "Wait Please" 6 60 0 | ||
|
||
bye | ||
|
||
fi | ||
} | ||
|
||
# Main | ||
update_smtp_origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: wazo-smtp-configuration | ||
namespace: official | ||
version: 1.0.0 | ||
author: Wazo Support | ||
display_name: SMTP configuration | ||
min_wazo_version: 20.01 | ||
tags: | ||
- support | ||
homepage: http://support.wazo.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-3.0+ | ||
|
||
|
||
case "$1" in | ||
build) | ||
;; | ||
|
||
package) | ||
chmod +x wazo-update-smtp-origin | ||
mkdir -p ${pkgdir}/usr/local/bin | ||
cp wazo-update-smtp-origin ${pkgdir}/usr/local/bin/ | ||
;; | ||
|
||
install) | ||
;; | ||
|
||
uninstall) | ||
;; | ||
|
||
*) | ||
echo "$0 called with unknown argument '$1'" >&2 | ||
exit 1 | ||
;; | ||
esac |