diff options
author | Hans de Graaff <graaff@gentoo.org> | 2013-07-16 10:14:36 +0000 |
---|---|---|
committer | Hans de Graaff <graaff@gentoo.org> | 2013-07-16 10:14:36 +0000 |
commit | 770ebadd46e3fd3d60867f2b9de23a87f9cc18dc (patch) | |
tree | b948ec31c8cd305cdc1d1c3b8c0b8347dd09b732 /www-servers/thin | |
parent | Cleanup. (diff) | |
download | historical-770ebadd46e3fd3d60867f2b9de23a87f9cc18dc.tar.gz historical-770ebadd46e3fd3d60867f2b9de23a87f9cc18dc.tar.bz2 historical-770ebadd46e3fd3d60867f2b9de23a87f9cc18dc.zip |
Add support for running thin as a different user and group than root. Thanks to Thomas D. in bug 473280.
Package-Manager: portage-2.1.12.2/cvs/Linux x86_64
Manifest-Sign-Key: 0x8883FA56A308A8D7!
Diffstat (limited to 'www-servers/thin')
-rw-r--r-- | www-servers/thin/ChangeLog | 9 | ||||
-rw-r--r-- | www-servers/thin/Manifest | 11 | ||||
-rw-r--r-- | www-servers/thin/files/thin.confd-1 | 32 | ||||
-rw-r--r-- | www-servers/thin/files/thin.initd-1 | 70 | ||||
-rw-r--r-- | www-servers/thin/thin-1.5.1-r2.ebuild | 83 |
5 files changed, 200 insertions, 5 deletions
diff --git a/www-servers/thin/ChangeLog b/www-servers/thin/ChangeLog index 06aa9b6a2b56..be6e3bbcc262 100644 --- a/www-servers/thin/ChangeLog +++ b/www-servers/thin/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for www-servers/thin # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/thin/ChangeLog,v 1.24 2013/07/16 10:08:03 graaff Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/thin/ChangeLog,v 1.25 2013/07/16 10:14:35 graaff Exp $ + +*thin-1.5.1-r2 (16 Jul 2013) + + 16 Jul 2013; Hans de Graaff <graaff@gentoo.org> +files/thin.confd-1, + +files/thin.initd-1, +thin-1.5.1-r2.ebuild: + Add support for running thin as a different user and group than root. Thanks + to Thomas D. in bug 473280. 16 Jul 2013; Hans de Graaff <graaff@gentoo.org> -files/thin-1.2.5-tests.patch: diff --git a/www-servers/thin/Manifest b/www-servers/thin/Manifest index 4e7582fd0d1e..5a8dc1303dc2 100644 --- a/www-servers/thin/Manifest +++ b/www-servers/thin/Manifest @@ -2,15 +2,18 @@ Hash: SHA256 AUX thin.confd 772 SHA256 0c6d12deb82208da1acb5ee1f55ed9a5df159ea0f31db9a99b416ca3956a1772 SHA512 f7c1a9fdafb34b9587c10ed058e4b3094042b55c08715230f22a23e3bc5b383a80970848c0d1b2936b33f29fb6c460d834b38e6bfec59b36d2cfe8c3115840cd WHIRLPOOL b7ebe2b567545331f0969f8dd2e4afaac89b1216a351d8c38c73fab8aaa875a4c478a781ea0455a7c8de0d7bfd67042210927cea4bd375936c0e7a659c4e666d +AUX thin.confd-1 1106 SHA256 8da66b4cd3c51b7d811c9505bf306fa90ccc400569d4b77086a456f19edf7547 SHA512 7fa42fcafdc1a25eecdafd96b2fbf8555fa4f757a111fdb1927d92f19c320c915d3212cdb3edaf526b74e76cbcc246c417ec194ae1e1fc1b85c82eb62a1d5c76 WHIRLPOOL 1420d82903804c0106b633a0e0bf157b0c9e4d0f0ff2ca2f51072ca0263f1ade848d9030b4a9c872783e481e263c4bc46cc29d4085d60de9954c33271dd4649d AUX thin.initd 1591 SHA256 09f7be62b2231a9461b3aafcfddb95fe9ffadbfba1bb5b3044f27f72efe65fea SHA512 4dd33726d824aae7efea53de8065aaa6cc47785eebb5067e648c4f18632ae750ca51341943d7da5ab00cd06f5acfe6f7f30c7172ba70e7210e4bd299a41b85eb WHIRLPOOL f6548938215962b07ae82743dd505fad132927211e6b9d0c0414db896bf0fdd914f4af92fede07041420bebd6253b1f560eae8701f1f8844656fd69b320caeb2 +AUX thin.initd-1 1792 SHA256 38f5faf3b383908535d5adfd1c525d655953351bbd9835850cb8883f3c50a192 SHA512 c29b78babb82069deffe8b03eef9ae20be93fda29acfbd429148647feea7a95ab53cc584731f398b41e142e74c2cf033f7a6fc61fd8fbf03f14f76e61cb8ae8f WHIRLPOOL 85c9f180a2744de1d3df6d1cfe253a26e3f204f4f3c5c1f51260d7fb22c7135f9d3fbe34b9ca1164f40a01b52396fc6478f808ce751d2cadb0685f00faedf97a DIST thin-1.5.1.tar.gz 176614 SHA256 523eb77709cc3427279df658f566a1c4eeaf85825ba2747f599eabf1fcb83bb3 SHA512 f691569eab296f4bcc11599da8c5a0715ce3b681dd616b09a9e245e67953e4f34e7a0a9a66d85b6cdef27ce3e9d569b09f21039802ccfeaf8d02c649b39356d8 WHIRLPOOL ee832d8a3ff3c1bbbc9d3dab414a1f6798445480e24df92afe39d0fdc14a27034e3dc1c3c12c7101866fdeb1f1b8f80b86c825e2a919593af495e059e7b85f57 EBUILD thin-1.5.1-r1.ebuild 2410 SHA256 aeafd7c9412856de7caa9675be3e26f49b190e1efec700349f0195262cb8b161 SHA512 60e2ca4bb87d503d9fc0d391c776fd97e13407ee25d19aed1e63c63782e4e596d9577fa0e000b6e175dbd341be31783543a5b63ae3f1ca3501c8193c5f0c61f8 WHIRLPOOL 8b0741efc4e5f6d4ab3c4993cc6a77f19c338f71858fe9254f3e20268651ce2703f78bdfbf99aa620b8a54cb2728092f390794d1c884dcf22612531d41731c1f -MISC ChangeLog 3386 SHA256 c9ae835db67a3bfcf6d4cbaf30f8b7d7c22ce7c1c1052ca2043cd642264062a4 SHA512 7f488c903e281aaeeafdc9c7110773a0f77d2332fa9e79ed564a06a509ae3206e46258c93c9a25691782e6a907bdcc40b3ed847a7b2ecdeb58442ae3cd92dc00 WHIRLPOOL 69c1d093eb2d462d2da058ae3c77162880b4d4629791f5cd52586850c36c013d00ae52a637aca6e3ae62eb1e919d5b3acf66c58385726abf5ba48a9d2805f57e +EBUILD thin-1.5.1-r2.ebuild 2414 SHA256 b8e1c6d2d4d7a5cc9d0b89e7815e08889853b5dc9e560b3208c0b454daedfc1f SHA512 6ba93f9b11381b87cddde19d97df4b3455c22ca485990279c8ae71f64ba024e55acc6ce889ca8710d5a9f0d6c5739ccbdb043682ab06c740b6a6fa16a40b9bc9 WHIRLPOOL c5861a61ce1fc69c13d9a6514b8de1d2622da821596b34b7259ed32447ab95376c764a8a7a6e7abe0c40cadd740f8736bcfdea4a93889aa97aeb147a77014205 +MISC ChangeLog 3643 SHA256 9d9827a0ebc96811480f35ea181bf403e6ae92d6194aa6e651aeec390a861471 SHA512 81ae88b35f14b30f7df282f52d959b0e6f7c2506b9e747b74e7f2eeb35f6702baa1db7be4d335cc2acda6c12848ec637f51e56a5a873bbf2828d335a07711db9 WHIRLPOOL 4cdbcae0631f5844bb11568bc4ee5cbf9d28c1bfcf62996cead4086c73d879b99d91f81a09eccc7703f3a85e9c6d6f667ac08ca38392470b59c45a4dbe159a70 MISC metadata.xml 429 SHA256 f96f9c85284589d524a5b3f2ae0ffc9f370d729da95dc0c3e7beb6f32c7eb3cc SHA512 6f2c32a40d0e8ebf04e181459fc32e575a625d4f8c2858af607421b959f1c5d8069fc56a7c42a0e556ee7ca64c30b8524c6a69f4749c74fee5d67bccdf2a312c WHIRLPOOL e13401713e98316419b6557bd6f3d50162d6e1c2856c2397463f1b295f904c14255e4ed270e16c3e3a845c15841b97c9df4c2df404c074c8716d8d363638e1a4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) -iF4EAREIAAYFAlHlG4QACgkQiIP6VqMIqNdrHgD8C25gX/7Csa4XZbir66x8p7A+ -2fXs3MXJXA+UaNOdWlcA/1ee7KJ1dNfT023SnlOZYOp5nV3e/hZb8o91YEdqI4ja -=6LJ5 +iF4EAREIAAYFAlHlHQwACgkQiIP6VqMIqNezOgD/T8GBym8RrviJFO1wd1l1DKuU +tCvb+mEjRUxvoBAYQoQA/j37TZ1gLo3aeqhdgWNT4P1XJh0QNk3D+Gyx24ybK6df +=N8sV -----END PGP SIGNATURE----- diff --git a/www-servers/thin/files/thin.confd-1 b/www-servers/thin/files/thin.confd-1 new file mode 100644 index 000000000000..16eddf2f524c --- /dev/null +++ b/www-servers/thin/files/thin.confd-1 @@ -0,0 +1,32 @@ +# /etc/conf.d/thin: Configuration for /etc/init.d/thin* +# Copy this file to /etc/conf.d/thin.SERVERNAME for server specific options. + +# Set the configuration file location. +# In start-all mode (/etc/init.d/thin), this must point to the directory where +# all the thin configurations are located. +# When starting a specific server (/etc/init.d/thin.SERVER), point to the exact +# location of the .yml configuration file. +# CONFIG="/etc/thin/${SVCNAME#*.}.yml" + +# Disable looking for a configuration file. +# You can use THIN_OPTS instead for setting command line options. +# NOCONFIG=0 + +# Set the Ruby interpreter to use. +# RUBY="/usr/bin/ruby" + +# Set the user for this instance. +# (Should mirror "user" value in /etc/thin/${SVCNAME#*.}.yml) +# THIN_USER= + +# Set the group for this instance. +# (Should mirror "group" value in /etc/thin/${SVCNAME#*.}.yml) +# THIN_GROUP= + +# Set the pidfile for this instance. +# (Should mirror "pid" value in /etc/thin/${SVCNAME#*.}.yml) +# THIN_PID= + +# Set command line options to pass to thin. +# In specific server mode, '--tag SERVER_NAME' is automatically appended. +# THIN_OPTS= diff --git a/www-servers/thin/files/thin.initd-1 b/www-servers/thin/files/thin.initd-1 new file mode 100644 index 000000000000..1a3d7aa9adee --- /dev/null +++ b/www-servers/thin/files/thin.initd-1 @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/thin/files/thin.initd-1,v 1.1 2013/07/16 10:14:35 graaff Exp $ + +SERVER=${SVCNAME#*.} +if [ ${SERVER} != thin ]; then + CONFIG=${CONFIG:-/etc/thin/${SERVER}.yml} +else + CONFIG=${CONFIG:-/etc/thin/} +fi +NOCONFIG=${NOCONFIG:-0} +RUBY=${RUBY:-/usr/bin/ruby} +THIN_USER=${THIN_USER:-root} +THIN_GROUP=${THIN_GROUP:-root} +THIN_PID=${THIN_PID:-/var/run/thin/thin.pid} +THIN_OPTS=${THIN_OPTS:-} + +depend() { + need net localmount +} + +checkconfig() { + [ ${SERVER} = thin -o ${NOCONFIG} != 0 ] && return 0 + + if [ ! -f ${CONFIG} ]; then + eerror "Unable to find the server configuration." + eerror "Please set the CONFIG variable in /etc/conf.d/${SVCNAME} or" + eerror "set NOCONFIG there to 1 to disable looking for a config file." + return 1 + fi +} + +buildargs() { + if [ ${NOCONFIG} = 0 -a ${SERVER} != thin ]; then + echo -n "-C ${CONFIG} " + fi + + echo -n "${THIN_OPTS}" +} + +action() { + checkconfig || return 1 + + if [ ${SERVER} = thin ]; then + ebegin "$2 all thin servers in ${CONFIG}" + ${RUBY} /usr/bin/thin $1 $(buildargs) --all ${CONFIG} + eend $? + else + ebegin "$2 thin server ${SERVER}" + ${RUBY} /usr/bin/thin $(buildargs) --tag ${SERVER} $1 + eend $? + fi +} + +start() { + action start 'Starting' +} + +stop() { + action stop 'Stopping' +} + +restart() { + action restart 'Restarting' +} + +start_pre() { + checkpath -d -m 0775 -o ${THIN_USER}:${THIN_GROUP} $(dirname ${THIN_PID}) +} diff --git a/www-servers/thin/thin-1.5.1-r2.ebuild b/www-servers/thin/thin-1.5.1-r2.ebuild new file mode 100644 index 000000000000..07b76057dc10 --- /dev/null +++ b/www-servers/thin/thin-1.5.1-r2.ebuild @@ -0,0 +1,83 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/thin/thin-1.5.1-r2.ebuild,v 1.1 2013/07/16 10:14:35 graaff Exp $ + +EAPI=5 + +USE_RUBY="ruby18 ruby19" + +RUBY_FAKEGEM_TASK_TEST="spec" + +RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="A fast and very simple Ruby web server" +HOMEPAGE="http://code.macournoyer.com/thin/" +SRC_URI="https://github.com/macournoyer/thin/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Ruby" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" +IUSE="" + +DEPEND="${DEPEND} + dev-util/ragel" +RDEPEND="${RDEPEND}" + +# The runtime dependencies are used at build-time as well since the +# Rakefile loads thin! +mydeps=">=dev-ruby/daemons-1.0.9 + >=dev-ruby/rack-1.0.0 + >=dev-ruby/eventmachine-0.12.6 + virtual/ruby-ssl" + +ruby_add_rdepend "${mydeps}" +ruby_add_bdepend "${mydeps} + dev-ruby/rake-compiler + test? ( dev-ruby/rspec:0 )" + +all_ruby_prepare() { + # Fix Ragel-based parser generation (uses a *very* old syntax that + # is not supported in Gentoo) + sed -i -e 's: | rlgen-cd::' Rakefile || die + + # Fix specs' dependencies so that the extension is not rebuilt + # when running tests + sed -i -e '/:spec =>/s:^:#:' tasks/spec.rake || die + + # Fix rspec version to allow newer 1.x versions + sed -i -e '/gem "rspec"/ s/1.2.9/1.0/' tasks/spec.rake spec/spec_helper.rb || die + + # Avoid CLEAN since it may not be available and we don't need it. + sed -i -e '/CLEAN/ s:^:#:' tasks/*.rake || die + + # Disable a test that is known for freezing the testsuite, + # reported upstream. In thin 1.5.1 this just fails. + sed -i \ + -e '/should force kill process in pid file/,/^ end/ s:^:#:' \ + spec/daemonizing_spec.rb || die + + # nasty but too complex to fix up for now :( + use test || rm tasks/spec.rake +} + +each_ruby_compile() { + ${RUBY} -S rake compile || die "rake compile failed" +} + +all_ruby_install() { + all_fakegem_install + + keepdir /etc/thin + newinitd "${FILESDIR}"/${PN}.initd-1 ${PN} + newconfd "${FILESDIR}"/${PN}.confd-1 ${PN} + + einfo + elog "Thin is now shipped with init scripts." + elog "The default script (/etc/init.d/thin) will start all servers that have" + elog "configuration files in /etc/thin/. You can symlink the init script to" + elog "files of the format 'thin.SERVER' to be able to start individual servers." + elog "See /etc/conf.d/thin for more configuration options." + einfo +} |