File: //usr/lib/python3/dist-packages/boto/pyami/installers/ubuntu/__pycache__/trac.cpython-310.pyc
o
ckF[~ � @ s0 d dl mZ d dlZd dlZG dd� de�ZdS )� )� InstallerNc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �Traca6
Install Trac and DAV-SVN
Sets up a Vhost pointing to [Trac]->home
Using the config parameter [Trac]->hostname
Sets up a trac environment for every directory found under [Trac]->data_dir
[Trac]
name = My Foo Server
hostname = trac.foo.com
home = /mnt/sites/trac
data_dir = /mnt/trac
svn_dir = /mnt/subversion
server_admin = root@foo.com
sdb_auth_domain = users
# Optional
SSLCertificateFile = /mnt/ssl/foo.crt
SSLCertificateKeyFile = /mnt/ssl/foo.key
SSLCertificateChainFile = /mnt/ssl/FooCA.crt
c C s` | j dddd� | j dddd� | � d� | � d� | � d� | � d� | � d � | � d
� d S )Nzapt-get -y install tracT)�notify�
exit_on_errorz!apt-get -y install libapache2-svnza2enmod sslza2enmod mod_pythonza2enmod dav_svnza2enmod rewriteztouch /var/log/boto.logzchmod a+w /var/log/boto.log)�run��self� r �C/usr/lib/python3/dist-packages/boto/pyami/installers/ubuntu/trac.py�install0 s
zTrac.installc
C sR t j�dd��� }|�r�|�d�}td|d d�}|�d� t j�dd�r\|�d � |�d
� |�dt j�dd��� � |�d
| � |�d� |�d| � |�d� |�d� n|�d
� |�dt j�dd��� � |�d
| � |�dt j�dd��� � |�dt j�dd��� � |�d� |�d� |�d� |�d� |�d� |�d� |�d� |�dt j�dd� � |�d� |�d� |�d � t j�dd!�}t�|�D ]4}|d dk�r|�d"| � |�d#� |�d$� |�d%� |�d&||f � |�d'| � |�d � q�t j�dd(�}t�|�D ]$}|d dk�r@|�d)| � |�d*� |�d+||f � |�d � �q|�d,� |�d-� |�d.� |�d/� t j�dd�}|�rl|�d0� |�d1| � t j�dd2�}|�r}|�d3| � t j�dd4�} | �r�|�d5| � |�d6� |� � | �
d7|d � | �
d8� d S d S )9Nr �hostname�.z/etc/apache2/sites-available/%sr �wzNameVirtualHost *:80
�SSLCertificateFilezNameVirtualHost *:443
z<VirtualHost *:80>
z ServerAdmin %s
�server_adminz ServerName %s
z RewriteEngine On
z! RewriteRule ^(.*)$ https://%s$1
z</VirtualHost>
z<VirtualHost *:443>
z DocumentRoot %s
�homez <Directory %s>
z, Options FollowSymLinks Indexes MultiViews
z AllowOverride All
z Order allow,deny
z allow from all
z </Directory>
z <Location />
z AuthType Basic
z AuthName "%s"
�namez Require valid-user
z, AuthUserFile /mnt/apache/passwd/passwords
z
</Location>
�data_dirz <Location /trac/%s>
z SetHandler mod_python
z% PythonInterpreter main_interpreter
z, PythonHandler trac.web.modpython_frontend
z PythonOption TracEnv %s/%s
z$ PythonOption TracUriRoot /trac/%s
�svn_dirz <Location /svn/%s>
z
DAV svn
z SVNPath %s/%s
z% ErrorLog /var/log/apache2/error.log
z LogLevel warn
z0 CustomLog /var/log/apache2/access.log combined
z ServerSignature On
z SSLEngine On
z SSLCertificateFile %s
�SSLCertificateKeyFilez SSLCertificateKeyFile %s
�SSLCertificateChainFilez SSLCertificateChainFile %s
z</VirtualHost>
za2ensite %sz /etc/init.d/apache2 force-reload)�boto�config�get�strip�split�open�write�os�listdir�closer )
r �domain�domain_info�cnfr �envr r r r r r r
�setup_vhost<