# Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ EAPI="2" inherit eutils # for enewgroup DESCRIPTION="Web-based collaborative word processor based on Node.js (instead of Scala for etherpad-1.1)" HOMEPAGE="http://etherpad.org/" SRC_URI="https://github.com/ether/etherpad-lite/archive/release/releases-${PV}.zip -> ${P}.zip" RESTRICT="mirror" # otherwise, won't pass manifest or download anything LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~amd64 ~x86" # IUSE="mysql sqlite postgres abiword" IUSE="mysql sqlite" # find /usr/portage -name gzip -o -name git -o -name curl -o -name libssl -o -name python RDEPEND="dev-lang/python app-arch/gzip >=net-libs/nodejs-0.8 dev-libs/openssl mysql? ( dev-db/mysql ) sqlite? ( dev-db/sqlite )" # some of the above line could go below, I don't know. # RDEPEND should also include: # >=dev-nodejs/async-stacktrace-0.0.2 # >=dev-nodejs/semver-1.0.13 # >=dev-nodejs/tinycon-0.0.1 # >=dev-nodejs/async-0.1.22 # >=dev-nodejs/resolve-0.2.3 # >=dev-nodejs/ejs-0.6.1 # >=dev-nodejs/require-kernel-1.0.5 # >=dev-nodejs/languages4translatewiki-0.1.3 # >=dev-nodejs/unorm-1.0.0 # >=dev-nodejs/formidable-1.0.9 # >=dev-nodejs/slide-1.1.3 # >=dev-nodejs/request-2.9.100 # >=dev-nodejs/underscore-1.3.1 # >=dev-nodejs/yajsml-1.1.6 # >=dev-nodejs/wd-0.0.26 # >=dev-nodejs/graceful-fs-1.1.5 # >=dev-nodejs/uglify-js-1.2.5 # >=dev-nodejs/clean-css-0.3.2 # >=dev-nodejs/log4js-0.5.6 # >=dev-nodejs/npm-registry-client-0.2.10 # >=dev-nodejs/connect-2.4.6 # >=dev-nodejs/jshint-0.9.1 # >=dev-nodejs/express-3.0.6 # >=dev-nodejs/ueberDB-0.1.8 # >=dev-nodejs/npm-1.1.71 # >=dev-nodejs/jsdom-nocontextifiy-0.2.10 # >=dev-nodejs/socket.io-0.9.13 # mysql? ( >=dev-nodejs/sqlite3 >=dev-nodejs/mysql ) # sqlite? ( >=dev-nodejs/sqlite3 ) # but I have not time to create these ebuilds, with further dependencies ... the # package manager npm will be used instead. DEPEND="${RDEPEND} net-misc/curl dev-vcs/git" JAVA_GENTOO_CLASSPATH="commons-beanutils-1.7 commons-lang-2.1 commons-logging" pkg_setup() { enewgroup etherpad 60 || die "problem adding 'etherpad' group" enewuser etherpad 60 -1 /home/etherpad etherpad || die "problem adding 'etherpad' user" # because etherpad installer bin/installDeps.sh uses his home mv /home/etherpad /home/etherpad.moved ; ln -s `pwd`/work /home/etherpad # avec /dev/null au lieu de /home/etherpad, on a l'erreur Error: ENOTDIR, mkdir '/dev/null/.npm' } src_compile() { einfo This ebuild file does not support USE=sqlite, although etherpad-lite does. einfo This ebuild file does not support USE=postgres, although etherpad-lite does. einfo This ebuild file does not support USE=abiword,\ although etherpad-lite supports app-office/abiword export backend, check \ line '"abiword"' of settings.json.template mv etherpad-lite-release-releases-${PV}/* . emake } src_install() { cp settings.json.template settings.json if use mysql; then if [ -z "${MYSQL_USER_PASSWORD}" ]; then eerror 'Please provide a password for the *mysql* user etherpad in the MYSQL_USER_PASSWORD env var.' die "You can provide a fake password, but then please update /usr/share/etherpad-lite/settings.json afterwards." fi { cat << \EOF /"dbType" : "dirty",/s:^:/*: / An Example of MySQL Configuration/s:/\*:: s:$:*/: /"user" : "root",/s:"root":"etherpad": EOF echo '/"password": "",/s:"":"'"$MYSQL_USER_PASSWORD"'":' cat << \EOF /"database": "store"/s:"store":"etherpadlite": /^ *}, *$/s:$:/*: w h q EOF } | ed settings.json ewarn 'Run cd /usr ; bin/mysql_install_db ; bin/mysql_secure_installation ; if mysql is not initialized' ewarn 'Run mysql -u root -p << EOF' ewarn 'CREATE DATABASE etherpadlite;' ewarn "CREATE USER 'etherpad' IDENTIFIED BY '"'$MYSQL_USER_PASSWORD'"' ;" ewarn 'GRANT ALL ON etherpadlite.* TO etherpad IDENTIFIED BY '"'"'$MYSQL_USER_PASSWORD'"' ;" ewarn 'ALTER DATABASE etherpadlite CHARACTER SET utf8 COLLATE utf8_bin;' #ewarn 'USE etherpadlite;' #ewarn 'ALTER TABLE store CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;' ewarn 'EOF' ewarn 'to create database if needed.' else ewarn Databse filename "`grep var/dirty.db settings.json`" '(JSON format)' not \ suitable for' 'production, use 'USE=mysql' instead, \ or patch ${P}.ebuild to add support for' 'postgres or sqlite fi einfo Restricting etherpad-lite to localhost. ed settings.json << \EOF /"ip": "0.0.0.0",/s:0.0.0.0:127.0.0.1: /"loglevel": "INFO",/s:"INFO":"WARN": w h q EOF # marking compabibility with node version 0.9 ed bin/installDeps.sh << \EOF /NODE_V_MINOR = "v0.8"/s:v0.8:v0.9: w h q EOF chown -R etherpad:etherpad . # this installs lastest dependencies :-( env -i su etherpad -l -c bin/installDeps.sh -s /bin/bash # at time of writing, socket.io@0.9.13, jsdom-nocontextifiy@0.2.10, # npm@1.1.71, ueberDB@0.1.8, express@3.0.6, jshint@0.9.1, connect@2.4.6, # npm-registry-client@0.2.10, ... were intalled if use mysql; then # this installs lastest dependency of plugin :-( env -i su etherpad -l -c 'npm install sqlite3 mysql' -s /bin/bash fi chown -R root:root . # because etherpad installer uses his home ewarn type now cd /usr/share/etherpad-lite \; su etherpad -s /bin/bash # information about startup ewarn node node_modules/ep_etherpad-lite/node/server.js ewarn then look at http://127.0.0.1:9001/ # dodoc out/doc/*.html out/doc/*/*.html settings.json.template doconf settings.json dodir usr/share/doc/etherpad-lite/assets mv out/doc/asset/* ${D}/usr/share/doc/etherpad-lite/assets dodir usr/share/etherpad-lite # mv CHANGELOG.md doc Makefile README.md start.bat CONTRIBUTING.md LICENSE mv settings.json node_modules bin tools src ${D}/usr/share/etherpad-lite ln -s /home/etherpad/var ${D}/usr/share/etherpad-lite ln -s /home/etherpad/APIKEY.txt ${D}/usr/share/etherpad-lite # the lines below may not be necessary. ln -s /home/etherpad/.travis.yml ${D}/usr/share/etherpad-lite ln -s /home/etherpad/.gitignore ${D}/usr/share/etherpad-lite } # TODO: tests is a directory, use it ? pkg_preinst() { rm /home/etherpad ; mv /home/etherpad.moved /home/etherpad mkdir /home/etherpad/var touch /home/etherpad/APIKEY.txt /home/etherpad/.travis.yml /home/etherpad/.gitignore chown etherpad:etherpad /home/etherpad/var /home/etherpad/APIKEY.txt chown etherpad:etherpad /home/etherpad/.travis.yml /home/etherpad/.gitignore } # ebuild tested with: cd /usr/local/portage/$USER/www-apps/etherpad-lite-bin/ ; cp /home/$USER/etherpad-lite-bin-1.2.4.ebuild . ; RESTRICT="strip mirror" ebuild etherpad-lite-bin-1.2.4.ebuild manifest ; USE=mysql PORTDIR_OVERLAY=/usr/local/portage/$USER MYSQL_USER_PASSWORD=$MYSQL_USER_PASSWORD emerge -v etherpad-lite-bin