forked from milos85vasic/Mail-Server-Factory
-
Notifications
You must be signed in to change notification settings - Fork 1
/
installer.sh
executable file
·53 lines (37 loc) · 950 Bytes
/
installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
defaultFactoryPath="$(dirname ~)/$(basename ~)/Mail-Server-Factory"
if [ -z "$1" ]
then
factoryPath="$defaultFactoryPath"
else
factoryPath="$1"
fi
if ! test -e "$factoryPath"; then
if mkdir -p "$factoryPath"; then
echo "$factoryPath: has been created"
else
echo "$factoryPath: has not been created"
exit 1
fi
fi
mail_factory_full_path="$factoryPath/mail_factory_path.sh"
if test -e "$mail_factory_full_path"; then
rm -f "$mail_factory_full_path"
fi
echo """
#!/bin/sh
echo $factoryPath
""" > "$mail_factory_full_path" && chmod 700 "$mail_factory_full_path"
installerScript=Core/Utils/factory_installer.sh
if test -e "$installerScript"; then
if "$installerScript" "mail" "$factoryPath"; then
cp -f Core/Utils/factory.sh "$factoryPath" &&
cp -f mail_factory "$factoryPath"
else
echo "Installation failed"
exit 1
fi
else
echo "No $installerScript found at: $(pwd)"
exit 1
fi