This repository has been archived by the owner on Mar 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreposado_margarita_install.sh
110 lines (89 loc) · 3.56 KB
/
reposado_margarita_install.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
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
#!/bin/bash
# Configures reposado with no LocalCatalogURLBase
# Reposado on port 8080, Margarita on 8086
# Intended for use on Ubuntu server 14.04.3/15.10, ymmv!
# Change the password below. Used to access Margarita web interface.
MARGARITA_USERNAME="susadmin"
MARGARITA_PASSWORD="apple123"
# install reposado and margarita dependecies
apt-get -y install apache2-utils libapache2-mod-wsgi git python-setuptools python curl python-pip apache2
easy_install flask
# make directory for storing reposado + margarita as well as catalogs and packages
mkdir /usr/local/sus /usr/local/sus/www /usr/local/sus/meta
# download reposado and margarita
git clone https://github.com/wdas/reposado.git /usr/local/sus/reposado
git clone https://github.com/jessepeterson/margarita.git /usr/local/sus/margarita
# Write reposado config file
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LocalCatalogURLBase</key>
<string></string>
<key>UpdatesMetadataDir</key>
<string>/usr/local/sus/meta</string>
<key>UpdatesRootDir</key>
<string>/usr/local/sus/www</string>
</dict>
</plist>' > /usr/local/sus/reposado/code/preferences.plist
# Link reposado data so margarita can access it
ln -s /usr/local/sus/reposado/code/reposadolib /usr/local/sus/margarita/reposadolib
ln -s /usr/local/sus/reposado/code/preferences.plist /usr/local/sus/margarita/preferences.plist
# Write wsgi script for auto-starting margarita with apache
echo 'import sys
EXTRA_DIR = "/usr/local/sus/margarita"
if EXTRA_DIR not in sys.path:
sys.path.append(EXTRA_DIR)
from margarita import app as application' > /usr/local/sus/margarita/margarita.wsgi
# Write apache sites configuration
echo '# /etc/apache2/sites-enabled/000-default.conf
# SUS/Reposado at 8080
Listen 8080
# Margarita at 8086
Listen 8086' > /etc/apache2/ports.conf
echo '<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /usr/local/sus/www
Alias /content /usr/local/sus/www/content
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
# Logging
ErrorLog ${APACHE_LOG_DIR}/sus-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/sus-access.log combined
</VirtualHost>' > /etc/apache2/sites-enabled/reposado.conf
echo '<VirtualHost *:8086>
ServerAdmin webmaster@localhost
DocumentRoot /usr/local/sus/www
# Base cofiguration
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# Margarita
Alias /static /usr/local/sus/margarita/static
WSGIDaemonProcess margarita home=/usr/local/sus/margarita user=www-data group=www-data threads=5
WSGIScriptAlias / /usr/local/sus/margarita/margarita.wsgi
<Directory />
WSGIProcessGroup margarita
WSGIApplicationGroup %{GLOBAL}
AuthType Basic
AuthName "Margarita (SUS Configurator)"
AuthUserFile /usr/local/sus/margarita/.htpasswd
Require valid-user
</Directory>
# Logging
ErrorLog ${APACHE_LOG_DIR}/sus-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/sus-access.log combined
</VirtualHost>' > /etc/apache2/sites-enabled/margarita.conf
htpasswd -cb /usr/local/sus/margarita/.htpasswd "$MARGARITA_USERNAME" "$MARGARITA_PASSWORD"
# correct folder permissions
chown -R www-data:www-data /usr/local/sus
chmod -R g+r /usr/local/sus
apache2ctl graceful
# Kickoff reposado SUS sync
# /usr/local/sus/reposado/code/./repo_sync