File: install

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (181 lines) | stat: -rwxr-xr-x 4,952 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/bin/sh

VERBOSE_INSTALL=yes

set -e

DO_EXIT="no"
for i in $@ ; do
	case "${1}" in
	"--not-interactive")
		NOT_INTERACTIVE=yes
		shift
		;;
	"--centos-init-daemons")
		CENTOS_INIT_DAEMONS=yes
		shift
		;;
	"--mysql-pass")
		if [ -z "${2}" ] ; then echo "Parameter for option --mysql-pass is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
		conf_mysql_pass=${2}
		shift
		shift
		;;
	"--dtcadmin-pass")
		if [ -z "${2}" ] ; then echo "Parameter for option --dtcadmin-pass is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
		conf_adm_pass=${2}
		shift
		shift
		;;
	esac
done
if [ "${NOT_INTERACTIVE}" = "yes" ] ; then
	if [ -z "${conf_mysql_pass}" ] ; then
		echo "No MySQL password. Please use --mysql-pass <ROOT-PASS>" > /dev/stderr
		DO_EXIT="yes"
	fi
	if [ -z "${conf_adm_pass}" ] ; then
		echo "No MySQL password. Please use --dtcadmin-pass <DTC-PASS>" > /dev/stderr
		DO_EXIT="yes"
	fi
fi
if [ "${DO_EXIT}" = "yes" ] ; then
	exit 1
fi

preseed_default_conf_values () {
	gen_pass=`dd if=/dev/random bs=64 count=1 2>|/dev/null | md5sum | cut -d' ' -f1 | awk '{print substr($0,0,16)}'`
	conf_mysqlautoconfig=false
	conf_mysql_host=localhost
	conf_mysql_login=root
	if [ -z "${conf_mysql_pass}" ] ; then
		conf_mysql_pass=${gen_pass}
	fi
	conf_mysql_db=dtc
	conf_mysql_change_root=false
	conf_mta_type=postfix
	conf_use_cyrus=false
	conf_use_sieve=false
	dtc_admin_subdomain=dtc
	main_domain_name=`hostname -d`
	conf_adm_login=dtc
	if [ -z "${conf_adm_pass}" ] ; then
		conf_adm_pass=${gen_pass}
	fi
	if [ -x /sbin/ifconfig ] ; then
		IFCONFIG=/sbin/ifconfig
	else
		IFCONFIG=ifconfig
	fi
	guessed_ip_addr=`${IFCONFIG} | head -n 2 | tail -n 1 | cut -f2 -d":" | cut -f1 -d" "`
	conf_ip_addr=${guessed_ip_addr}
	conf_use_nated_vhosts=false
	conf_nated_vhosts_ip=192.168.2.199
	conf_apache_version=2
	conf_hosting_path=/var/www/sites
	conf_chroot_path=/var/lib/dtc/chroot_template
	conf_eth2monitor=eth0
	conf_recipient_delim="+"
	conf_mx_mail=mx
	conf_dnsbl_list=zen.spamhaus.org
	conf_omit_dev_mknod=false
	conf_gen_ssl_cert=true
	conf_cert_passphrase=${gen_pass}
	conf_cert_countrycode=FR
	conf_cert_locality=Paris
	conf_cert_organization=default-org
	conf_cert_unit=no-unit
	conf_cert_email=changeme@example.org
	conf_cert_challenge_pass=${gen_pass}
	conf_ftp_type=pureftpd
	conf_mta_type=postfix
	conf_postmaster_email="postmaster@${conf_mx_mail}.${main_domain_name}"
}


if [ -f /etc/debian_version ] ; then
	/usr/share/dtc/admin/install/uninstall
	. /usr/share/dtc/admin/install/debian_config
	. ${DTC_SAVED_INSTALL_CONFIG}
	if [ ""$conf_apache_version = "2" ] ; then
		PATH_HTTPD_CONF=/etc/apache2/apache2.conf
	else
		PATH_HTTPD_CONF=/etc/apache/httpd.conf
	fi
	. /usr/share/dtc/admin/install/functions
	DTCsetupDaemons
fi

if [ -f /etc/redhat-release ] ; then
	# Prepare everything
	. /usr/share/dtc/admin/install/redhat_config
	. /usr/share/dtc/admin/install/functions
	. /usr/share/dtc/admin/install/interactive_installer
	if [ "${CENTOS_INIT_DAEMONS}" = "yes" ] ; then
		ALL_DAEMONS="httpd crond postfix clamd amavisd rsyslog mysqld courier-authlib courier-imap dkimproxy pure-ftpd spamassassin saslauthd"
		for i in ${ALL_DAEMONS} ; do
			if [ -x /etc/rc.d/init.d/$i ] ; then
				service $i start
				chkconfig $i on
			fi
		done
		/usr/bin/mysqladmin -u root password ${conf_mysql_pass}
	fi
	if [ "${NOT_INTERACTIVE}" = "yes" ] ; then
		preseed_default_conf_values
		saveConfig
	else
		interactiveInstaller
	fi
	DTCinstallPackage
	/usr/share/dtc/admin/install/uninstall
	. ${DTC_SAVED_INSTALL_CONFIG}
	# Then call the installer!
	DTCsetupDaemons
elif [ -f SuSE-release ] ; then
	# Prepare everything
	. /usr/share/dtc/admin/install/suse_config
	. /usr/share/dtc/admin/install/functions
	. /usr/share/dtc/admin/install/interactive_installer
	interactiveInstaller
	DTCinstallPackage
	/usr/share/dtc/admin/install/uninstall
	. ${DTC_SAVED_INSTALL_CONFIG}
	/usr/share/dtc/admin/install/functions
	# Then call the installer!
	DTCsetupDaemons
fi

UNAME_MINUS_S=`uname -s`
if [ "${UNAME_MINUS_S}" = "Darwin" ] ; then
	. /usr/share/dtc/admin/install/osx_config
	. /usr/share/dtc/admin/install/functions
	. /usr/share/dtc/admin/install/interactive_installer
	interactiveInstaller
	DTCinstallPackage
	/usr/share/dtc/admin/install/uninstall
	DTCsetupDaemons
fi

if [ ${UNAME_MINUS_S} = "FreeBSD" ] ; then
	echo "FreeBSD detected"
        . /usr/local/www/dtc/admin/install/bsd_config
	. /usr/local/www/dtc/admin/install/functions
        . /usr/local/www/dtc/admin/install/interactive_installer
        interactiveInstaller
        DTCinstallPackage
        DTCsetupDaemons
fi

if [ -e /etc/gentoo-release ] ; then
	echo "Gentoo detected"
	. /usr/share/dtc/admin/install/gentoo_config
	. /usr/share/dtc/admin/install/functions
	. /usr/share/dtc/admin/install/interactive_installer
	interactiveInstaller
	DTCinstallPackage
	/usr/share/dtc/admin/install/uninstall
	. ${DTC_SAVED_INSTALL_CONFIG}
	/usr/share/dtc/admin/install/functions
	DTCsetupDaemons
fi