diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /www-apps/moodle | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'www-apps/moodle')
-rw-r--r-- | www-apps/moodle/Manifest | 3 | ||||
-rw-r--r-- | www-apps/moodle/files/config-r1.php | 36 | ||||
-rw-r--r-- | www-apps/moodle/files/config.php | 29 | ||||
-rw-r--r-- | www-apps/moodle/files/postinstall-en.txt | 220 | ||||
-rw-r--r-- | www-apps/moodle/files/postinstall-nodb-en.txt | 6 | ||||
-rw-r--r-- | www-apps/moodle/metadata.xml | 9 | ||||
-rw-r--r-- | www-apps/moodle/moodle-2.7.9.ebuild | 128 | ||||
-rw-r--r-- | www-apps/moodle/moodle-2.8.7.ebuild | 128 | ||||
-rw-r--r-- | www-apps/moodle/moodle-2.9.1.ebuild | 128 |
9 files changed, 687 insertions, 0 deletions
diff --git a/www-apps/moodle/Manifest b/www-apps/moodle/Manifest new file mode 100644 index 000000000000..82bf15da691e --- /dev/null +++ b/www-apps/moodle/Manifest @@ -0,0 +1,3 @@ +DIST moodle-2.7.9.tgz 34986369 SHA256 d746bfacd44bc7b33ed7cff12b7189bd2021e809a4a64836f124c4ae75d08a7d SHA512 76d74dc0b19959b935c12138d81501f55cf34bdf8b62c82d21ac4f02e4290ceecac2b9f17adb7b07b2ec72f1d39a3f2b5a42b01b03a7fce58a6d242a945ff626 WHIRLPOOL baee4892b49c580a2c9de060b7ccd3e6eb397e24bdf8ac69accb46d2553ac651546af86be7537b28ce36f9378d35eeb75d569fb81acba94cd7bb9a0493ca72c3 +DIST moodle-2.8.7.tgz 35867384 SHA256 cd4cf38bb329cad3575d32e6692c9cdba97b25d7b09d2aaf0b20aa5fac2878f4 SHA512 4c6d71225c825568ab9a4137153274cedb30905ff70b58c35299606c7101b45e8f32c969cdaada6e5fe86d015de94b057389597dea017ac7d8d5122b71e90cab WHIRLPOOL 66bad29da03d0c7f8d2a009efb1b241289a56c193180f13ab1c5bb7953e03c03f326af6e96365a23192443197d9edae0d65980c7c85a97a5634092ab7d1e557f +DIST moodle-2.9.1.tgz 36340544 SHA256 bfc9398904809ed6041e8bcbdb75d7bc1917d5a0ff47fd0069812d783e03c020 SHA512 5875c78bc7f16eca15df5dc052eee8748e26799337e76b344d49a6c7b79c1fc1c3acddf716df37cd38cfb595e3deab24aee88b3198d4b1076ce09ea2316d0456 WHIRLPOOL 2b1ea95ea90baaa92f236ab9a2701bcb330be8b85c3a23d5c4fffb677b899f5e7a1847be4a6c0410300167b41e8bea03b0240e137d3bbdb4bb7475d48ff642d7 diff --git a/www-apps/moodle/files/config-r1.php b/www-apps/moodle/files/config-r1.php new file mode 100644 index 000000000000..7eef454b7dfc --- /dev/null +++ b/www-apps/moodle/files/config-r1.php @@ -0,0 +1,36 @@ +<?php +unset($CFG); // Ignore this line +global $CFG; // This is necessary here for PHPUnit execution +$CFG = new stdClass(); + +$CFG->dbtype = 'mydb'; // 'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci' +$CFG->dblibrary = 'native'; // 'native' only at the moment +$CFG->dbhost = 'localhost'; // eg 'localhost' or 'db.isp.com' or IP +$CFG->dbname = 'moodle'; // database name, eg moodle +$CFG->dbuser = 'username'; // your database username +$CFG->dbpass = 'password'; // your database password +$CFG->prefix = 'mdl_'; // prefix to use for all table names +$CFG->dboptions = array( + 'dbpersist' => false, // should persistent database connections be + // used? set to 'false' for the most stable + // setting, 'true' can improve performance + // sometimes + 'dbsocket' => false, // should connection via UNIX socket be used? + // if you set it to 'true' or custom path + // here set dbhost to 'localhost', + // (please note mysql is always using socket + // if dbhost is 'localhost' - if you need + // local port connection use '127.0.0.1') + 'dbport' => '', // the TCP port number to use when connecting + // to the server. keep empty string for the + // default port +); + +$CFG->wwwroot = 'http://example.com/moodle'; +$CFG->dataroot = '/home/example/moodledata'; +$CFG->directorypermissions = 02777; + +$CFG->admin = 'admin'; + +require_once(dirname(__FILE__) . '/lib/setup.php'); // Do not edit +?> diff --git a/www-apps/moodle/files/config.php b/www-apps/moodle/files/config.php new file mode 100644 index 000000000000..c959b4aa457e --- /dev/null +++ b/www-apps/moodle/files/config.php @@ -0,0 +1,29 @@ +<?PHP +unset($CFG); +$CFG = new stdClass(); + +$CFG->dbtype = 'mydb'; +$CFG->dbhost = 'localhost'; +$CFG->dbname = 'moodle_db'; +$CFG->dbuser = 'moodle_user'; +$CFG->dbpass = 'moodle_pass'; +$CFG->prefix = 'mdl_'; + +$CFG->dbpersist = false; + +$CFG->wwwroot = 'http://localhost/moodle'; +$CFG->dirroot = '/var/www/localhost/htdocs/moodle'; +$CFG->dataroot = '/var/www/localhost/moodle' ; + +$CFG->directorypermissions = 02777; + +$CFG->admin = 'admin'; + +if (file_exists("$CFG->dirroot/lib/setup.php")) { + include_once("$CFG->dirroot/lib/setup.php"); +} else { + echo "<p>Could not find this file: $CFG->dirroot/lib/setup.php</p>"; + echo "<p>Please supply this file or reinstall moodle</p>"; + die; +} +?> diff --git a/www-apps/moodle/files/postinstall-en.txt b/www-apps/moodle/files/postinstall-en.txt new file mode 100644 index 000000000000..6a5b44bac93d --- /dev/null +++ b/www-apps/moodle/files/postinstall-en.txt @@ -0,0 +1,220 @@ +NEW INSTALLS + +0 Check to see if webapp-config automatically installed + moodle for you in /var/www/localhost/htdocs. You should + see a directory in there called moodle. If it didn't + install it manually: + + webapp-config -d moodle -I moodle X.Y.Z + + Replace X.Y.Z with whatever version you just emerged. + +1 Edit the config.php file found at + + /var/www/localhost/htdocs/moodle/config.php + + You should probably change the database password, + $CFG->dbpass = 'moodle_pass' to something more + obscure. Also, if your system has a FQDN, change + the $CFG->wwwroot = 'http://localhost/moodle' + to match the URL of your moodle installation. + + + IF YOU ARE USING MYSQL, do step 2a + IF YOU ARE USING POSTGRESQL, do step 2b + + +2a Create a new mysql database and account with the + appropriate privileges. Make sure the username, + password and database match their values in + config.php from step 1. + + Connect to your mysql server using + + mysql -p -u root + + and at the mysql> prompt issue the following commands + + CREATE DATABASE moodle_db; + GRANT ALL ON moodle_db.* + TO moodle_user@localhost + IDENTIFIED BY 'moodle_pass'; + flush privileges; + +2b Issue the following commands at a shell, making sure + the username, password and database match their values + in config.php from step 1. + + su - postgres + psql -c "create user moodle_user createdb;" template1 + psql -c "alter user moodle_user with encrypted password 'moodle_pass';" template1 + psql -c "create database moodle_db with encoding 'unicode';" -U moodle_user template1 + psql -c "alter user moodle_user nocreatedb;" template1 + su - root + /etc/init.d/postgresql-X.Y reload + + Replace X.Y with your version postgresql. + + NOTE: Moodle docs say that moodle only works with + postgresql-7, but I've used it with 8 no problems. + +3 Direct your browser to the URL in step 1. You should see + the license agreement. Click "Yes" to continue. + +4 You are now about to install. Click the checkbox for + "Unattended operation" and "Continue" to start. Follow + the wizard as you "Setup administrator account" and configure + the "Front Page settings". + +5 You now have a working installation. Before putting it + into production, you'll probably want to check that + everything is sane. In the "Site Administration" block, + click on + + Server -> Environment + + Make sure that you've got the green okay on all the + Server Checks. If you don't, click on the ? icons for + popup help. + +6 Add a cron-job to root's crontab. + + su - root + crontab -e # fcrontab -e if you use fcron + + then add the line + + */30 * * * * root php -q /var/www/localhost/htdocs/moodle/admin/cron.php > /dev/null + +7 For more information on installing moodle, see + + http://docs.moodle.org/en/Installing_Moodle + + For information on working with moodle, see + + http://moodle.org/support/ + +================================================================= + +UPGRADES + +0 Before any upgade you should backup your database in case you have + to roll back. The moodle dirroot directory ($CFG->dirroot in the + config.php file) isn't as critical since you can always reinstall + that with web-apps. The moodle data root ($CFG->dataroot in config.php), + where files are uploaded, will not be touched. But the upgrade will + probably change your db schema, and the new format may not be backward + compatible. For mysql use + + mysqldump -u moodle_user -p -C -Q -e --create-options moodle_db > moodle-backup.sql + + or for postgresql use + + su - postgres + pg_dump moodle_db > moodle-backup.sql + + If you have to fall back, you can do so using + + mysql -p -u moodle_user moodle_db < moodle-backup.sql + + or + + su - postgres + psql moodle_db < moodle-backup.sql + + TEST THIS! PRACTICE THIS! Make sure it will work for you if you + have to fall back. + +1 Emerge the new moodle ebuild. Be prepared to add USE flags for + php and re-emerge it since upgrades may require new functionality + from php. Remember to restart apache after re-emerging php! + +2 If the ebuild didn't do it for you, update using + + webapp-config -d moodle -U moodle X.Y.Z + +3 Aim your browser to the URL in the config.php file defined + by $CFG->wwwroot. You will get a message that you are about + to automatically upgrade your server and cannot go back. + This is why you backed up your db in step 1. You can go back + if you use webapp-config to install the older version AND + drop the new db and restart the old one. You did practice + restoring, right? + +4 Click "Continue" and follow through with the upgrade. + + +================================================================= + +UNINSTALL + +1 Make sure you really want to do this. I mean REALLY! + After step 3 you will be past the point of no return. + +2 If you just want to uninstall the webapp, do the following + and no more! + + emerge --unmerge moodle + + Your data is still in the db and in the moodledata dir. + + + !!!!!!!!! POINT OF NO RETURN !!!!!!!!! + +3 Uninstall the uploaded files + + rm -rf /var/lib/moodledata + + + IF YOU ARE USING MYSQL, do step 4a + IF YOU ARE USING POSTGRESQL, do step 4b + + +4a Connect to your mysql server using 'mysql -p -u root' and + at the mysql> prompt issue the following commands: + + DROP DATABASE moodle_db; + DROP USER moodle_user@localhost ; + +4b Issue the following commands + + su - postgres + psql -c "drop database moodle_db;" template1 + psql -c "drop user moodle_user;" template1 + +5 Remove the root cron-job + + su - root + crontab -e # fcrontab -e if you use fcron + + and delete the line added above. + +================================================================= + +ADDITIONAL PHP REQUIREMENTS + + Moodle allows for many method of authentication. To see + what these are, in the "Site Administration" block, click + on + + Users -> Authentication -> Manage Authentication + + Moodle will try to authenticate by each method in order + until it either succeeds or exhausts the list and fails. + + In order to use some of these methods, you need to make + sure PHP was compiled with the correct support. You will + know that you do not have the correct support compiled in + if authentication by all previous methods fails, and you + encounter a method for which PHP does not have support. + An error will be thrown and reported in the web page. + + Currently, the ebuild has support for the following + + Auth Method USE flag + + IMAP(S) or POP3(S) imap + LDAP or CAS ldap + External database odbc + RADIUS radius + diff --git a/www-apps/moodle/files/postinstall-nodb-en.txt b/www-apps/moodle/files/postinstall-nodb-en.txt new file mode 100644 index 000000000000..91269941d185 --- /dev/null +++ b/www-apps/moodle/files/postinstall-nodb-en.txt @@ -0,0 +1,6 @@ +You have not specified which database you are going to use. +You are on your own! Go to + + http://docs.moodle.org/en/Installing_Moodle + +and follow the instructions there. diff --git a/www-apps/moodle/metadata.xml b/www-apps/moodle/metadata.xml new file mode 100644 index 000000000000..3cf0cd5be0b1 --- /dev/null +++ b/www-apps/moodle/metadata.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>web-apps</herd> +<maintainer> + <email>blueness@gentoo.org</email> + <name>Anthony G. Basile</name> +</maintainer> +</pkgmetadata> diff --git a/www-apps/moodle/moodle-2.7.9.ebuild b/www-apps/moodle/moodle-2.7.9.ebuild new file mode 100644 index 000000000000..969d4d538dab --- /dev/null +++ b/www-apps/moodle/moodle-2.7.9.ebuild @@ -0,0 +1,128 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit versionator webapp + +AVC=( $(get_version_components) ) +MY_BRANCH="stable${AVC[0]}${AVC[1]}" + +DESCRIPTION="The Moodle Course Management System" +HOMEPAGE="http://moodle.org" +SRC_URI="http://download.moodle.org/${MY_BRANCH}/${P}.tgz" +S="${WORKDIR}/${PN}" + +LICENSE="GPL-2" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +#SLOT empty due to webapp + +DB_FLAGS="mysqli?,postgres?" +DB_TYPES=${DB_FLAGS//\?/} +DB_TYPES=${DB_TYPES//,/ } + +AUTHENTICATION_FLAGS="imap?,ldap?,odbc?" +AUTHENTICATION_MODES=${AUTHENTICATION_FLAGS//\?/} +AUTHENTICATION_MODES=${AUTHENTICATION_MODES//,/ } + +PHP_REQUIRED_FLAGS="ctype,curl,iconv,json,session,simplexml,xml,zip" +PHP_OPTIONAL_FLAGS="gd,intl,soap,ssl,tokenizer,xmlrpc" +PHP_FLAGS="${PHP_REQUIRED_FLAGS},${PHP_OPTIONAL_FLAGS}" + +IUSE="${DB_TYPES} ${AUTHENTICATION_MODES} vhosts" +REQUIRED_USE="|| ( ${DB_TYPES} )" + +# No forced dependency on +# mysql? ( virtual/mysql ) +# postgres? ( dev-db/postgresql-server-7* ) +# which may live on another server +DEPEND="" +RDEPEND=" + >=dev-lang/php-5.4.4[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS}] + virtual/httpd-php + virtual/cron" + +pkg_setup() { + webapp_pkg_setup + + # How many dbs were selected? If one and only one, which one is it? + MYDB="" + DB_COUNT=0 + for db in ${DB_TYPES}; do + if use ${db}; then + MYDB=${db} + DB_COUNT=$(($DB_COUNT+1)) + fi + done + + # REQUIRED_USE above guarantees that ${DB_COUNT} cannot be zero + #if [[ ${DB_COUNT} -eq 0 ]]; then + # eerror + # eerror "\033[1;31m**************************************************\033[00m" + # eerror "No database selected in your USE flags," + # eerror "You must select at least one." + # eerror "\033[1;31m**************************************************\033[00m" + # eerror + # die + #fi + + if [[ ${DB_COUNT} -gt 1 ]]; then + MYDB="" + ewarn + ewarn "\033[1;33m**************************************************\033[00m" + ewarn "Multiple databases selected in your USE flags," + ewarn "You will have to choose your database manually." + ewarn "\033[1;33m**************************************************\033[00m" + ewarn + fi +} + +src_prepare() { + rm COPYING.txt + cp "${FILESDIR}"/config.php . + + # Moodle expect postgres7, not postgres + MYDB=${MYDB/postgres/postgres7} + + # Moodle expects mysql, not mysqli + MYDB=${MYDB/mysqli/mysql} + + if [[ ${DB_COUNT} -eq 1 ]] ; then + sed -i -e "s|mydb|${MYDB}|" config.php + fi +} + +src_install() { + webapp_src_preinst + + local MOODLEDATA="${MY_HOSTROOTDIR}"/moodle + dodir ${MOODLEDATA} + webapp_serverowned -R "${MOODLEDATA}" + + local MOODLEROOT="${MY_HTDOCSDIR}" + insinto ${MOODLEROOT} + doins -r * + + webapp_configfile "${MOODLEROOT}"/config.php + + if [[ ${DB_COUNT} -eq 1 ]]; then + webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt + else + webapp_postinst_txt en "${FILESDIR}"/postinstall-nodb-en.txt + fi + + webapp_src_install +} + +pkg_postinst() { + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo + einfo "To see the post install instructions, do" + einfo + einfo " webapp-config --show-postinst ${PN} ${PVR}" + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo +} diff --git a/www-apps/moodle/moodle-2.8.7.ebuild b/www-apps/moodle/moodle-2.8.7.ebuild new file mode 100644 index 000000000000..2ca271047681 --- /dev/null +++ b/www-apps/moodle/moodle-2.8.7.ebuild @@ -0,0 +1,128 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit versionator webapp + +AVC=( $(get_version_components) ) +MY_BRANCH="stable${AVC[0]}${AVC[1]}" + +DESCRIPTION="The Moodle Course Management System" +HOMEPAGE="http://moodle.org" +SRC_URI="http://download.moodle.org/${MY_BRANCH}/${P}.tgz" +S="${WORKDIR}/${PN}" + +LICENSE="GPL-2" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +#SLOT empty due to webapp + +DB_FLAGS="mysqli?,mssql?,postgres?" +DB_TYPES=${DB_FLAGS//\?/} +DB_TYPES=${DB_TYPES//,/ } + +AUTHENTICATION_FLAGS="imap?,ldap?,odbc?" +AUTHENTICATION_MODES=${AUTHENTICATION_FLAGS//\?/} +AUTHENTICATION_MODES=${AUTHENTICATION_MODES//,/ } + +PHP_REQUIRED_FLAGS="ctype,curl,iconv,json,session,simplexml,xml,zip" +PHP_OPTIONAL_FLAGS="gd,intl,soap,ssl,tokenizer,xmlrpc" +PHP_FLAGS="${PHP_REQUIRED_FLAGS},${PHP_OPTIONAL_FLAGS}" + +IUSE="${DB_TYPES} ${AUTHENTICATION_MODES} vhosts" +REQUIRED_USE="|| ( ${DB_TYPES} )" + +# No forced dependency on +# mssql? - lives on a windows server +# mysql? ( virtual/mysql ) +# postgres? ( dev-db/postgresql-server-9* ) +# which may live on another server. These USE flags affect the configuration +# file and the dependency on php. However other dbs are possible. See config.php +# and the moodle documentation for other possibilities. +DEPEND="" +RDEPEND=" + >=dev-lang/php-5.4.4[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS}] + virtual/httpd-php + virtual/cron" + +pkg_setup() { + webapp_pkg_setup + + # How many dbs were selected? If one and only one, which one is it? + MYDB="" + DB_COUNT=0 + for db in ${DB_TYPES}; do + if use ${db}; then + MYDB=${db} + DB_COUNT=$(($DB_COUNT+1)) + fi + done + + # REQUIRED_USE above guarantees that ${DB_COUNT} cannot be zero + #if [[ ${DB_COUNT} -eq 0 ]]; then + # eerror + # eerror "\033[1;31m**************************************************\033[00m" + # eerror "No database selected in your USE flags," + # eerror "You must select at least one." + # eerror "\033[1;31m**************************************************\033[00m" + # eerror + # die + #fi + + if [[ ${DB_COUNT} -gt 1 ]]; then + MYDB="" + ewarn + ewarn "\033[1;33m**************************************************\033[00m" + ewarn "Multiple databases selected in your USE flags," + ewarn "You will have to choose your database manually." + ewarn "\033[1;33m**************************************************\033[00m" + ewarn + fi +} + +src_prepare() { + rm COPYING.txt + cp "${FILESDIR}"/config-r1.php config.php + + # Moodle expect pgsql, not postgres + MYDB=${MYDB/postgres/pgsql} + + if [[ ${DB_COUNT} -eq 1 ]] ; then + sed -i -e "s|mydb|${MYDB}|" config.php + fi +} + +src_install() { + webapp_src_preinst + + local MOODLEDATA="${MY_HOSTROOTDIR}"/moodle + dodir ${MOODLEDATA} + webapp_serverowned -R "${MOODLEDATA}" + + local MOODLEROOT="${MY_HTDOCSDIR}" + insinto ${MOODLEROOT} + doins -r * + + webapp_configfile "${MOODLEROOT}"/config.php + + if [[ ${DB_COUNT} -eq 1 ]]; then + webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt + else + webapp_postinst_txt en "${FILESDIR}"/postinstall-nodb-en.txt + fi + + webapp_src_install +} + +pkg_postinst() { + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo + einfo "To see the post install instructions, do" + einfo + einfo " webapp-config --show-postinst ${PN} ${PVR}" + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo +} diff --git a/www-apps/moodle/moodle-2.9.1.ebuild b/www-apps/moodle/moodle-2.9.1.ebuild new file mode 100644 index 000000000000..2ca271047681 --- /dev/null +++ b/www-apps/moodle/moodle-2.9.1.ebuild @@ -0,0 +1,128 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit versionator webapp + +AVC=( $(get_version_components) ) +MY_BRANCH="stable${AVC[0]}${AVC[1]}" + +DESCRIPTION="The Moodle Course Management System" +HOMEPAGE="http://moodle.org" +SRC_URI="http://download.moodle.org/${MY_BRANCH}/${P}.tgz" +S="${WORKDIR}/${PN}" + +LICENSE="GPL-2" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +#SLOT empty due to webapp + +DB_FLAGS="mysqli?,mssql?,postgres?" +DB_TYPES=${DB_FLAGS//\?/} +DB_TYPES=${DB_TYPES//,/ } + +AUTHENTICATION_FLAGS="imap?,ldap?,odbc?" +AUTHENTICATION_MODES=${AUTHENTICATION_FLAGS//\?/} +AUTHENTICATION_MODES=${AUTHENTICATION_MODES//,/ } + +PHP_REQUIRED_FLAGS="ctype,curl,iconv,json,session,simplexml,xml,zip" +PHP_OPTIONAL_FLAGS="gd,intl,soap,ssl,tokenizer,xmlrpc" +PHP_FLAGS="${PHP_REQUIRED_FLAGS},${PHP_OPTIONAL_FLAGS}" + +IUSE="${DB_TYPES} ${AUTHENTICATION_MODES} vhosts" +REQUIRED_USE="|| ( ${DB_TYPES} )" + +# No forced dependency on +# mssql? - lives on a windows server +# mysql? ( virtual/mysql ) +# postgres? ( dev-db/postgresql-server-9* ) +# which may live on another server. These USE flags affect the configuration +# file and the dependency on php. However other dbs are possible. See config.php +# and the moodle documentation for other possibilities. +DEPEND="" +RDEPEND=" + >=dev-lang/php-5.4.4[${DB_FLAGS},${AUTHENTICATION_FLAGS},${PHP_FLAGS}] + virtual/httpd-php + virtual/cron" + +pkg_setup() { + webapp_pkg_setup + + # How many dbs were selected? If one and only one, which one is it? + MYDB="" + DB_COUNT=0 + for db in ${DB_TYPES}; do + if use ${db}; then + MYDB=${db} + DB_COUNT=$(($DB_COUNT+1)) + fi + done + + # REQUIRED_USE above guarantees that ${DB_COUNT} cannot be zero + #if [[ ${DB_COUNT} -eq 0 ]]; then + # eerror + # eerror "\033[1;31m**************************************************\033[00m" + # eerror "No database selected in your USE flags," + # eerror "You must select at least one." + # eerror "\033[1;31m**************************************************\033[00m" + # eerror + # die + #fi + + if [[ ${DB_COUNT} -gt 1 ]]; then + MYDB="" + ewarn + ewarn "\033[1;33m**************************************************\033[00m" + ewarn "Multiple databases selected in your USE flags," + ewarn "You will have to choose your database manually." + ewarn "\033[1;33m**************************************************\033[00m" + ewarn + fi +} + +src_prepare() { + rm COPYING.txt + cp "${FILESDIR}"/config-r1.php config.php + + # Moodle expect pgsql, not postgres + MYDB=${MYDB/postgres/pgsql} + + if [[ ${DB_COUNT} -eq 1 ]] ; then + sed -i -e "s|mydb|${MYDB}|" config.php + fi +} + +src_install() { + webapp_src_preinst + + local MOODLEDATA="${MY_HOSTROOTDIR}"/moodle + dodir ${MOODLEDATA} + webapp_serverowned -R "${MOODLEDATA}" + + local MOODLEROOT="${MY_HTDOCSDIR}" + insinto ${MOODLEROOT} + doins -r * + + webapp_configfile "${MOODLEROOT}"/config.php + + if [[ ${DB_COUNT} -eq 1 ]]; then + webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt + else + webapp_postinst_txt en "${FILESDIR}"/postinstall-nodb-en.txt + fi + + webapp_src_install +} + +pkg_postinst() { + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo + einfo "To see the post install instructions, do" + einfo + einfo " webapp-config --show-postinst ${PN} ${PVR}" + einfo + einfo "\033[1;32m**************************************************\033[00m" + einfo +} |