Skip to content

Commit 5cc9510

Browse files
authored
Add feature for installing Mailpit and disabling Mailhog (#1864)
* feat: finish mailpit feature
1 parent 46a1f92 commit 5cc9510

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

scripts/features/mailpit.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -f ~/.homestead-features/wsl_user_name ]; then
4+
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
5+
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
6+
else
7+
WSL_USER_NAME=vagrant
8+
WSL_USER_GROUP=vagrant
9+
fi
10+
11+
export DEBIAN_FRONTEND=noninteractive
12+
13+
if [ -f /home/$WSL_USER_NAME/.homestead-features/mailpit ]
14+
then
15+
echo "mailpit already installed."
16+
exit 0
17+
fi
18+
19+
touch /home/$WSL_USER_NAME/.homestead-features/mailpit
20+
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
21+
22+
curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh | sh
23+
24+
chown -f $WSL_USER_NAME:$WSL_USER_GROUP /usr/local/bin/mailpit
25+
26+
cat > /etc/systemd/system/mailpit.service << EOF
27+
[Unit]
28+
Description=Mailpit
29+
After=network.target
30+
31+
[Service]
32+
User=vagrant
33+
ExecStart=/usr/bin/env /usr/local/bin/mailpit
34+
35+
[Install]
36+
WantedBy=multi-user.target
37+
EOF
38+
39+
systemctl disable --now mailhog
40+
41+
systemctl enable --now mailpit

0 commit comments

Comments
 (0)