Added "Airport" virtual appliance: see https://bitbucket.org/marduk/airport
This commit is contained in:
parent
976caffd93
commit
c7a56139e2
8
Makefile
8
Makefile
|
@ -34,6 +34,7 @@ M4C = $(M4) $(M4_DEFS)
|
|||
NBD_DEV = /dev/nbd0
|
||||
USEPKG = --usepkg --binpkg-respect-use=y
|
||||
RSYNC_MIRROR = rsync://rsync.gtlib.gatech.edu/gentoo/
|
||||
EMERGE_RSYNC = NO
|
||||
KERNEL = gentoo-sources
|
||||
PACKAGE_FILES = $(wildcard $(APPLIANCE)/package.*)
|
||||
WORLD = $(APPLIANCE)/world
|
||||
|
@ -111,6 +112,9 @@ sync_portage:
|
|||
|
||||
portage: sync_portage stage3
|
||||
tar xjf portage-latest.tar.bz2 -C $(CHROOT)/usr
|
||||
ifeq ($(EMERGE_RSYNC),YES)
|
||||
$(inroot) emerge --sync --quiet
|
||||
endif
|
||||
ifdef PKGDIR
|
||||
mkdir -p $(CHROOT)/var/portage/packages
|
||||
mount -o bind "$(PKGDIR)" $(CHROOT)/var/portage/packages
|
||||
|
@ -275,6 +279,9 @@ image: kernel software device-map grub.shell grub dev.tar.bz2 motd.sh
|
|||
mkdir -p gentoo
|
||||
mount -o bind $(CHROOT) gentoo
|
||||
rsync -ax $(COPY_ARGS) gentoo/ loop/
|
||||
ifeq ($(PRUNE_CRITICAL),YES)
|
||||
rsync -ax gentoo/usr/include/python* loop/usr/include/
|
||||
endif
|
||||
./motd.sh $(EXTERNAL_KERNEL) $(VIRTIO) $(DISK_SIZE) $(SWAP_SIZE) $(UDEV) $(DASH) $(ARCH) > loop/etc/motd
|
||||
ifneq ($(EXTERNAL_KERNEL),YES)
|
||||
loop/sbin/grub --device-map=device-map --no-floppy --batch < grub.shell
|
||||
|
@ -290,6 +297,7 @@ endif
|
|||
umount loop
|
||||
sleep 3
|
||||
rmdir loop
|
||||
e2fsck -fyD $(NBD_DEV)p1 || true
|
||||
qemu-nbd -d $(NBD_DEV)
|
||||
touch image
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
APP_ROOT := /var/airport
|
||||
HG_REPO := https://bitbucket.org/marduk/airport
|
||||
|
||||
preinstall:
|
||||
sed -i '/^APACHE2_/d' $(CHROOT)/etc/make.conf
|
||||
echo 'APACHE2_MPMS="prefork"' >> $(CHROOT)/etc/make.conf
|
||||
echo 'APACHE2_MODULES="auth_basic authz_host env include info"' >> $(CHROOT)/etc/make.conf
|
||||
|
||||
|
||||
postinstall: airport.service settings.py airport.wsgi default_vhost.include firstboot.start issue
|
||||
sed -i 's/^APACHE2_OPTS=.*/APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D WSGI"/' $(CHROOT)/etc/conf.d/apache2
|
||||
$(inroot) rc-update add apache2 default
|
||||
sed -i 's/^PG_INITDB_OPTS.*/PG_INITDB_OPTS="--locale=en_US.UTF-8"/' $(CHROOT)/etc/conf.d/postgresql-9.1
|
||||
$(inroot) eselect postgresql set 9.1
|
||||
rm -rf $(CHROOT)/var/lib/postgresql/9.1
|
||||
#[ -d $(CHROOT)/var/lib/postgresql/9.1/data ] || yes | $(inroot) $(EMERGE) --config postgresql-server:9.1
|
||||
yes | $(inroot) $(EMERGE) --config postgresql-server:9.1
|
||||
$(inroot) rc-update add postgresql-9.1 default
|
||||
$(inroot) chsh -s /bin/sh postgres
|
||||
$(inroot) $(EMERGE) -1n $(USEPKG) dev-python/virtualenv
|
||||
rm -rf $(CHROOT)/$(APP_ROOT)
|
||||
hg clone $(HG_REPO) $(CHROOT)/$(APP_ROOT)
|
||||
echo 'VERSION="'`date +1.%y%m%d.%H%m`'"' > $(CHROOT)/$(APP_ROOT)/djangoproject/airport/__init__.py
|
||||
chroot $(CHROOT) virtualenv --no-site-packages $(APP_ROOT)
|
||||
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install -r $(APP_ROOT)/requirements.txt"
|
||||
$(inroot) bash -c ". $(APP_ROOT)/bin/activate ; pip install psycopg2"
|
||||
mkdir -p $(CHROOT)/$(APP_ROOT)/etc
|
||||
touch $(CHROOT)/$(APP_ROOT)/etc/__init__.py
|
||||
cp settings.py $(CHROOT)/$(APP_ROOT)/etc
|
||||
cp default_vhost.include $(CHROOT)/etc/apache2/vhosts.d
|
||||
cp airport.wsgi $(CHROOT)/var/www/localhost
|
||||
$(inroot) id -u airport >/dev/null || $(inroot) useradd -d $(APP_ROOT) -M -s /bin/false -U -G postgres airport
|
||||
$(inroot) gpasswd -a apache postgres
|
||||
cp firstboot.start $(CHROOT)/etc/local.d
|
||||
cp issue $(CHROOT)/etc/issue
|
||||
ifeq ($(AVAHI),YES)
|
||||
$(inroot) $(EMERGE) -n $(USEPKG) net-dns/avahi
|
||||
$(inroot) rm -f /etc/avahi/services/*
|
||||
cp airport.service $(CHROOT)/etc/avahi/services
|
||||
$(inroot) ln -sf /etc/init.d/avahi-daemon $(rcdefault)/avahi-daemon
|
||||
endif
|
||||
|
||||
|
||||
clean:
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<service-group>
|
||||
<name>Airport</name>
|
||||
<service>
|
||||
<type>_http._tcp</type>
|
||||
<port>80</port>
|
||||
</service>
|
||||
</service-group>
|
|
@ -0,0 +1,16 @@
|
|||
import os
|
||||
import sys
|
||||
sys.stdout = sys.stderr
|
||||
|
||||
import site
|
||||
site.addsitedir('/var/airport/lib/python2.7/site-packages')
|
||||
|
||||
sys.path.append('/var/airport')
|
||||
sys.path.append('/var/airport/djangoproject')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'etc.settings'
|
||||
os.environ['VIRTUAL_ENV'] = '/var/airport/'
|
||||
|
||||
import django.core.handlers.wsgi
|
||||
application = django.core.handlers.wsgi.WSGIHandler()
|
||||
|
||||
# vim: filetype=python
|
|
@ -0,0 +1,37 @@
|
|||
app-editors/nano
|
||||
net-misc/openssh
|
||||
net-misc/rsync
|
||||
net-misc/wget
|
||||
sys-kernel/gentoo-sources
|
||||
sys-kernel/linux-headers
|
||||
sys-devel/gcc
|
||||
sys-devel/automake
|
||||
sys-devel/bison
|
||||
sys-devel/make
|
||||
sys-devel/flex
|
||||
sys-devel/automake-wrapper
|
||||
sys-devel/autoconf-wrapper
|
||||
sys-devel/autoconf
|
||||
sys-devel/m4
|
||||
sys-devel/gcc-config
|
||||
sys-devel/libtool
|
||||
sys-devel/binutils
|
||||
sys-devel/binutils-config
|
||||
sys-devel/patch
|
||||
sys-devel/gnuconfig
|
||||
app-admin/python-updater
|
||||
app-admin/perl-cleaner
|
||||
sys-apps/man-pages
|
||||
sys-apps/man
|
||||
sys-apps/file
|
||||
sys-apps/less
|
||||
sys-apps/texinfo
|
||||
sys-apps/busybox
|
||||
sys-apps/debianutils
|
||||
sys-apps/man-pages-posix
|
||||
sys-apps/sandbox
|
||||
sys-apps/which
|
||||
dev-lang/perl
|
||||
sys-devel/libperl
|
||||
sys-apps/portage
|
||||
dev-lang/python
|
|
@ -0,0 +1,80 @@
|
|||
# ServerAdmin: Your address, where problems with the server should be
|
||||
# e-mailed. This address appears on some server-generated pages, such
|
||||
# as error documents. e.g. admin@your-domain.com
|
||||
ServerAdmin root@localhost
|
||||
|
||||
# DocumentRoot: The directory out of which you will serve your
|
||||
# documents. By default, all requests are taken from this directory, but
|
||||
# symbolic links and aliases may be used to point to other locations.
|
||||
#
|
||||
# If you change this to something that isn't under /var/www then suexec
|
||||
# will no longer work.
|
||||
DocumentRoot "/var/www/localhost/htdocs"
|
||||
|
||||
# This should be changed to whatever you set DocumentRoot to.
|
||||
<Directory "/var/www/localhost/htdocs">
|
||||
# Possible values for the Options directive are "None", "All",
|
||||
# or any combination of:
|
||||
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
|
||||
#
|
||||
# Note that "MultiViews" must be named *explicitly* --- "Options All"
|
||||
# doesn't give it to you.
|
||||
#
|
||||
# The Options directive is both complicated and important. Please see
|
||||
# http://httpd.apache.org/docs/2.2/mod/core.html#options
|
||||
# for more information.
|
||||
Options Indexes FollowSymLinks
|
||||
|
||||
# AllowOverride controls what directives may be placed in .htaccess files.
|
||||
# It can be "All", "None", or any combination of the keywords:
|
||||
# Options FileInfo AuthConfig Limit
|
||||
AllowOverride All
|
||||
|
||||
# Controls who can get stuff from this server.
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
<IfModule alias_module>
|
||||
# Redirect: Allows you to tell clients about documents that used to
|
||||
# exist in your server's namespace, but do not anymore. The client
|
||||
# will make a new request for the document at its new location.
|
||||
# Example:
|
||||
# Redirect permanent /foo http://www.example.com/bar
|
||||
|
||||
# Alias: Maps web paths into filesystem paths and is used to
|
||||
# access content that does not live under the DocumentRoot.
|
||||
# Example:
|
||||
# Alias /webpath /full/filesystem/path
|
||||
#
|
||||
# If you include a trailing / on /webpath then the server will
|
||||
# require it to be present in the URL. You will also likely
|
||||
# need to provide a <Directory> section to allow access to
|
||||
# the filesystem path.
|
||||
|
||||
# ScriptAlias: This controls which directories contain server scripts.
|
||||
# ScriptAliases are essentially the same as Aliases, except that
|
||||
# documents in the target directory are treated as applications and
|
||||
# run by the server when requested rather than as documents sent to the
|
||||
# client. The same rules about trailing "/" apply to ScriptAlias
|
||||
# directives as to Alias.
|
||||
ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"
|
||||
</IfModule>
|
||||
|
||||
# "/var/www/localhost/cgi-bin" should be changed to whatever your ScriptAliased
|
||||
# CGI directory exists, if you have that configured.
|
||||
<Directory "/var/www/localhost/cgi-bin">
|
||||
AllowOverride None
|
||||
Options None
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
WSGIDaemonProcess airport display-name=airport user=airport processes=2 threads=15
|
||||
WSGISCriptAlias / /var/www/localhost/airport.wsgi
|
||||
<Directory />
|
||||
AllowOverride None
|
||||
Order Deny,Allow
|
||||
</Directory>
|
||||
|
||||
# vim: ts=4 filetype=apache
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
echo Creating Airport database...
|
||||
createuser -U postgres -D -l -R -S airport
|
||||
createdb -U postgres -E utf8 -O airport airport
|
||||
|
||||
PYTHONPATH=/var/airport ; export PYTHONPATH
|
||||
cd /var/airport
|
||||
. bin/activate
|
||||
cd djangoproject
|
||||
./manage.py syncdb --settings=etc.settings --noinput
|
||||
|
||||
mv /etc/local.d/firstboot.start /etc/local.d/firstboot.start.disabled
|
|
@ -0,0 +1,15 @@
|
|||
[H[2J
|
||||
|
|
||||
|
|
||||
|
|
||||
_|_
|
||||
/___\\
|
||||
/_____\\
|
||||
/oo oo\\
|
||||
\\___________________________\\ /___________________________/
|
||||
`-----------|------|--------\\_____/--------|------|-----------'
|
||||
( ) ( ) O|OOo|oOO|O ( ) ( )
|
||||
------------------------------------------------------------------------------
|
||||
Airport Console
|
||||
------------------------------------------------------------------------------
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
app-editors/nano ncurses
|
||||
dev-lang/python ssl threads xml
|
||||
net-misc/dhcp client
|
||||
sys-devel/gcc cxx
|
||||
sys-kernel/gentoo-sources symlink
|
||||
sys-libs/ncurses minimal
|
||||
sys-apps/portage python2
|
|
@ -0,0 +1,152 @@
|
|||
# Django settings for djangoproject project.
|
||||
import os
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
ADMINS = (
|
||||
('Your Name', 'your@email.com'),
|
||||
)
|
||||
|
||||
MANAGERS = ADMINS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'airport',
|
||||
'USER': 'airport',
|
||||
'PASSWORD': '',
|
||||
'HOST': '',
|
||||
'PORT': '',
|
||||
}
|
||||
}
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# On Unix systems, a value of None will cause Django to use the same
|
||||
# timezone as the operating system.
|
||||
# If running in a Windows environment this must be set to the same as your
|
||||
# system time zone.
|
||||
TIME_ZONE = 'America/New_York'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
# If you set this to False, Django will make some optimizations so as not
|
||||
# to load the internationalization machinery.
|
||||
USE_I18N = False
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale
|
||||
USE_L10N = True
|
||||
|
||||
# Absolute filesystem path to the directory that will hold user-uploaded files.
|
||||
# Example: "/home/media/media.lawrence.com/media/"
|
||||
MEDIA_ROOT = ''
|
||||
|
||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||
# trailing slash.
|
||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
||||
MEDIA_URL = ''
|
||||
|
||||
# Absolute path to the directory static files should be collected to.
|
||||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/home/media/media.lawrence.com/static/"
|
||||
STATIC_ROOT = ''
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://media.lawrence.com/static/"
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||
# Make sure to use a trailing slash.
|
||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||
ADMIN_MEDIA_PREFIX = '/static/admin/'
|
||||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
# various locations.
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = '5vv-a3_^4a5uk=88m-jow=62*nvo0)0nn)wh)^ea^l=-+o9zuv'
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
# 'django.template.loaders.eggs.Loader',
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'airport.context_processors.externals',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'djangoproject.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
#'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
#'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'airport'
|
||||
)
|
||||
|
||||
# A sample logging configuration. The only tangible logging
|
||||
# performed by this configuration is to send an email to
|
||||
# the site admins on every HTTP 500 error.
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'django.request': {
|
||||
'handlers': ['mail_admins'],
|
||||
'level': 'ERROR',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
AUTH_PROFILE_MODULE = 'airport.UserProfile'
|
|
@ -0,0 +1,3 @@
|
|||
dev-db/postgresql-server:9.1
|
||||
net-misc/dhcp
|
||||
www-apache/mod_wsgi
|
1
fstab
1
fstab
|
@ -1,3 +1,4 @@
|
|||
# <fs> <mountpoint> <type> <opts> <dump/pass>
|
||||
/dev/sda1 / ext4 noatime 1 1
|
||||
none /sys sysfs defaults 0 0
|
||||
/.swap none swap sw 0 0
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
usr/include/*
|
||||
usr/lib/python*/test
|
||||
usr/lib64/python*/test
|
||||
usr/share/gtk-doc
|
||||
var/db/pkg
|
||||
usr/lib/perl*
|
||||
usr/lib64/perl*
|
||||
usr/share/doc/*
|
||||
*.pyc
|
||||
*.pyo
|
||||
|
|
Loading…
Reference in New Issue