New ebuild by Anthony G. Basile. Bug #104275
authorAnthony G. Basile <blueness@gentoo.org>
Mon, 19 Jul 2010 14:05:35 +0000 (14:05 +0000)
committerAnthony G. Basile <blueness@gentoo.org>
Mon, 19 Jul 2010 14:05:35 +0000 (14:05 +0000)
Package-Manager: portage-2.1.8.3/cvs/Linux x86_64

www-apps/moodle/ChangeLog [new file with mode: 0644]
www-apps/moodle/Manifest [new file with mode: 0644]
www-apps/moodle/files/config.php [new file with mode: 0644]
www-apps/moodle/files/postinstall-en.txt [new file with mode: 0644]
www-apps/moodle/files/postinstall-nodb-en.txt [new file with mode: 0644]
www-apps/moodle/metadata.xml [new file with mode: 0644]
www-apps/moodle/moodle-1.9.9.ebuild [new file with mode: 0644]

diff --git a/www-apps/moodle/ChangeLog b/www-apps/moodle/ChangeLog
new file mode 100644 (file)
index 0000000..cc9c86e
--- /dev/null
@@ -0,0 +1,11 @@
+# ChangeLog for www-apps/moodle
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/moodle/ChangeLog,v 1.1 2010/07/19 14:05:32 blueness Exp $
+
+*moodle-1.9.9 (19 Jul 2010)
+
+  19 Jul 2010; Anthony G. Basile <blueness@gentoo.org> +moodle-1.9.9.ebuild,
+  +files/config.php, +files/postinstall-en.txt,
+  +files/postinstall-nodb-en.txt, +metadata.xml:
+  New ebuild by Anthony G. Basile. Bug #104275
+
diff --git a/www-apps/moodle/Manifest b/www-apps/moodle/Manifest
new file mode 100644 (file)
index 0000000..9457a60
--- /dev/null
@@ -0,0 +1,7 @@
+AUX config.php 718 RMD160 9e4b97aafca65da8648466d11728c457fff439ab SHA1 d71fc86158e82f706ca2cdfe1efe2e8de62cc607 SHA256 c62a37c0d81043ee4ca7fc4d7610d19dc2df426d556eb3285d7b1fe367a44a8d
+AUX postinstall-en.txt 4855 RMD160 f0c6dd27094e53bdadf21c4f3489b9d7802b68b7 SHA1 7e8be07898d76910b23c7b28cc3a82decfc8ee15 SHA256 e6d7f05a462eb2e23dc2b7d7226bff8c3acfc0624c38b90b5fdb1816b2f09c1d
+AUX postinstall-nodb-en.txt 171 RMD160 88ff71d95c63f1b5d76e398c3566ada75954cdf4 SHA1 26748e5f24207ef5cb145e3668e1f17cdcddf699 SHA256 f39ff660a1cafbbd96ce18c46f056450ace04df5ac401eeccaf16441d54f3b6a
+DIST moodle-1.9.9.tgz 14017622 RMD160 a44406d71829c88d5ad21a3368b62c76c420c7e7 SHA1 936eaa405cef8722c31f6a0a385fee7fa9999919 SHA256 20e16da64c70f61c4c49f08aa359499a4ef500c3f8de477dc70721c07b8ec49d
+EBUILD moodle-1.9.9.ebuild 2993 RMD160 dd854378f05f15183856102ed495fbc99e686555 SHA1 8c628541140278d4a3f17cb1f2a6371d957cfc56 SHA256 7b58684efce0b4cb9fa492e57de3f71b18abc215b226014205ca27e894d6c5fa
+MISC ChangeLog 456 RMD160 380fa2689a6f1159fb97837756451dfe73a91eb0 SHA1 8a3d9b767d850404c5bf1895454e4d6844f37c9c SHA256 b8f894db43c7171b31a4e08ccc1c4cace8a969429b1792542c8997f11df4a3e6
+MISC metadata.xml 256 RMD160 7cd5a16a6eade95f71d40edbb4729baadfbc7649 SHA1 809eeef12d97ae39db024aea151a70c7363475b7 SHA256 8230894d717ea9f2e42f9c7de54671126820f89bf05ca96ec5f03842b12378e1
diff --git a/www-apps/moodle/files/config.php b/www-apps/moodle/files/config.php
new file mode 100644 (file)
index 0000000..c959b4a
--- /dev/null
@@ -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 (file)
index 0000000..5fe772f
--- /dev/null
@@ -0,0 +1,172 @@
+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 1.9.9
+
+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-8.4 reload
+
+   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
+
+   TODO - When the next release is out, I will fill this
+   section in.
+
+=================================================================
+
+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 (file)
index 0000000..9126994
--- /dev/null
@@ -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 (file)
index 0000000..3cf0cd5
--- /dev/null
@@ -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-1.9.9.ebuild b/www-apps/moodle/moodle-1.9.9.ebuild
new file mode 100644 (file)
index 0000000..6fe973e
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/moodle/moodle-1.9.9.ebuild,v 1.1 2010/07/19 14:05:32 blueness Exp $
+
+EAPI="2"
+
+inherit versionator webapp depend.php
+
+AVC=( $(get_version_components) )
+MY_BRANCH="stable${AVC[0]}${AVC[1]}"
+DBTYPES="mysql postgres"
+AUTHMODES="imap ldap odbc radius"
+PHPFLAGS="${DBTYPES} ${AUTHMODES}"
+
+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="~amd64 ~x86"
+#SLOT empty due to webapp
+IUSE="${PHPFLAGS} vhosts"
+
+# No forced dependency on 
+#  mysql? ( virtual/mysql )
+#  postgres? ( dev-db/postgresql-server-7* )
+# which may live on another server
+DEPEND=""
+RDEPEND="virtual/cron"
+
+need_php5_httpd
+
+pkg_setup() {
+       webapp_pkg_setup
+
+       # How many dbs were selected? If one and only one, which one is it?
+       MYDB=""
+       DBCOUNT=0
+       for db in ${DBTYPES}; do
+               if use ${db}; then
+                       MYDB=${db}
+                       DBCOUNT=$(($DBCOUNT+1))
+               fi
+       done
+
+       if [[ ${DBCOUNT} -ne 1 ]]; then
+               MYDB=""
+               ewarn
+               ewarn "\033[1;33m**************************************************\033[1;33m"
+               ewarn "No db, or multiple dbs, selected in your USE flags,"
+               ewarn "You will have to choose your database manually."
+               ewarn "\033[1;33m**************************************************\033[1;33m"
+               ewarn
+       fi
+
+       local flags="ctype curl gd iconv ssl tokenizer xml xmlrpc zlib"
+
+       for flg in ${PHPFLAGS}; do
+               if use ${flg}; then
+                       flags="${flags} ${flg}"
+               fi
+       done
+
+       if ! PHPCHECKNODIE="yes" require_php_with_use ${flags} ; then
+               eerror
+               eerror "\033[1;31m************************************************************\033[1;31m"
+               eerror "Re-install ${PHP_PKG} with the following flags:"
+               eerror "    ${flags}"
+               eerror "\033[1;31m************************************************************\033[1;31m"
+               eerror
+               die
+       fi
+}
+
+src_prepare() {
+       rm COPYING.txt
+       cp "${FILESDIR}"/config.php .
+
+       #
+       # Moodle expect postgres7, not postgres
+       #
+       MYDB=${MYDB/postgres/postgres7}
+       if [[ ${DBCOUNT} -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} || die "Unable to insinto ${MOODLEROOT}"
+       doins -r *
+
+       webapp_configfile "${MOODLEROOT}"/config.php
+
+       if [[ ${DBCOUNT} -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[1;32m"
+       einfo
+       einfo "To see the post install instructions, do"
+       einfo
+       einfo "    webapp-config --show-postinst ${PN} ${PV}"
+       einfo
+       einfo "\033[1;32m**************************************************\033[1;32m"
+       einfo
+}