diff options
author | lioux <lioux@FreeBSD.org> | 2002-10-06 03:36:59 +0800 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2002-10-06 03:36:59 +0800 |
commit | 1bd31dc98e3c8cbbec8c59172f28ee24f0e675b5 (patch) | |
tree | af51512a7655021f61213043ffcaddc12b1a8e98 /misc | |
parent | df7910fb7505459c410abf17e0a6d94c0c1583c4 (diff) | |
download | freebsd-ports-gnome-1bd31dc98e3c8cbbec8c59172f28ee24f0e675b5.tar.gz freebsd-ports-gnome-1bd31dc98e3c8cbbec8c59172f28ee24f0e675b5.tar.zst freebsd-ports-gnome-1bd31dc98e3c8cbbec8c59172f28ee24f0e675b5.zip |
o New port distribfold version 0.1: distribfold.org distributed protein
folding project
o One can start multiple instances of this port. Just install it
using WITH_NCPU
Diffstat (limited to 'misc')
-rw-r--r-- | misc/Makefile | 1 | ||||
-rw-r--r-- | misc/distribfold/Makefile | 116 | ||||
-rw-r--r-- | misc/distribfold/distinfo | 1 | ||||
-rw-r--r-- | misc/distribfold/files/distribfold.sh | 61 | ||||
-rw-r--r-- | misc/distribfold/files/number_of_dirs.sh | 16 | ||||
-rw-r--r-- | misc/distribfold/files/patch-foldit | 16 | ||||
-rw-r--r-- | misc/distribfold/pkg-comment | 1 | ||||
-rw-r--r-- | misc/distribfold/pkg-deinstall | 63 | ||||
-rw-r--r-- | misc/distribfold/pkg-descr | 24 | ||||
-rw-r--r-- | misc/distribfold/pkg-install | 41 | ||||
-rw-r--r-- | misc/distribfold/pkg-message | 13 | ||||
-rw-r--r-- | misc/distribfold/pkg-plist | 22 |
12 files changed, 375 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile index bcacd2887d90..81bb253fd11a 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -54,6 +54,7 @@ SUBDIR += diction SUBDIR += dirtree SUBDIR += display + SUBDIR += distribfold SUBDIR += dnetc SUBDIR += dog SUBDIR += dotfile diff --git a/misc/distribfold/Makefile b/misc/distribfold/Makefile new file mode 100644 index 000000000000..a8b93ba7e881 --- /dev/null +++ b/misc/distribfold/Makefile @@ -0,0 +1,116 @@ +# New ports collection makefile for: folding@home client +# Date created: Sun Sep 29 19:48:01 UTC 2002 +# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= distribfold +PORTVERSION= 0.1 +CATEGORIES= misc net +MASTER_SITES= ftp://ftp.mshri.on.ca/pub/distribfold/download/ +DISTNAME= distribfold-current-FreeBSD + +MAINTAINER= lioux@FreeBSD.org + +ONLY_FOR_ARCHS= i386 +USE_REINPLACE= yes +NO_BUILD= yes + +WRKSRC= ${WRKDIR}/distribfold + +# files to install +SCRIPT_FILES= distrib-update foldit +PROGRAM_FILES= foldtrajlite +# installation dir +DESTINATION_DIR= ${PREFIX}/distribfold + +# default users +DNETFOLD_USER=dnetfold +DNETFOLD_GROUP=dnetfold + +# default number of processors +WITH_NCPU?= 1 + +post-patch: + @${REINPLACE_CMD} -E -e 's|%%DESTINATION_DIR%%|${DESTINATION_DIR}|' \ + ${WRKSRC}/foldit + +pre-install: +# create users + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +do-install: +# remove any patch scrap files +.for ext in bak orig + @${RM} -f ${WRKSRC}/*.${ext} +.endfor +# strip binaries +.for file in ${PROGRAM_FILES} + @${STRIP_CMD} ${WRKSRC}/${file} +.endfor +# install startup script + @${INSTALL_SCRIPT} ${WRKDIR}/distribfold.sh ${PREFIX}/etc/rc.d +# for every cpu directory + @ncpu=`${CAT} ${WRKDIR}/ncpu` ; \ + for dir in `${FILESDIR}/number_of_dirs.sh $${ncpu}` ; do \ + DESTINATION_DIR=${DESTINATION_DIR}/cpu$${dir} ; \ + ${MKDIR} $${DESTINATION_DIR} ; \ + ${INSTALL_DATA} ${WRKSRC}/* $${DESTINATION_DIR} ; \ + ${CHGRP} -R ${DNETFOLD_GROUP} $${DESTINATION_DIR} ; \ + ${CHMOD} g+w $${DESTINATION_DIR} ; \ + ${CHOWN} ${DNETFOLD_USER} $${DESTINATION_DIR}/* ; \ + ${CHMOD} u+w $${DESTINATION_DIR}/* ; \ + for file in ${PROGRAM_FILES} ${SCRIPT_FILES} ; do \ + ${CHMOD} 0755 $${DESTINATION_DIR}/$${file} ; \ + done ; \ + done +# display package message + @${CAT} ${PKGMESSAGE} + +post-install: cook-install-plist + +.include <bsd.port.pre.mk> + +pre-everything:: +.if ${WITH_NCPU} < 1 + @${ECHO_MSG} "===> Number of processors HAS to be at least 1" + @${ECHO_MSG} "===> (${WITH_NCPU}) IS NOT" + @${FALSE} +.endif + @${ECHO_MSG} "=======> ATTENTION <=======" + @${ECHO_MSG} "===> If you want to have multiple copies of this program" + @${ECHO_MSG} "===> running in order to make better use of your SMP" + @${ECHO_MSG} "===> system, set WITH_CPU to the number of cpus" + @${ECHO_MSG} "===> available in your system" + @${ECHO_MSG} "===> For example, 2 cpus. \"make WITH_CPU=2\"" + @${ECHO_MSG} "===> Do not use this variable if you do not have a SMP" + @${ECHO_MSG} "===> system. There is no advantage otherwise." + +do-configure: +# prepare startup script + @${SED} -e 's|%%DNETFOLD_USER%%|${DNETFOLD_USER}|' \ + -e 's|%%DESTINATION_DIR%%|${DESTINATION_DIR}|' \ + -e 's|%%NCPU%%|${WITH_NCPU}|' \ + ${FILESDIR}/distribfold.sh > ${WRKDIR}/distribfold.sh +# record number of cpus + @${ECHO} ${WITH_NCPU} > ${WRKDIR}/ncpu + +cook-install-plist: generate-plist +.if ${WITH_NCPU} > 1 + @${GREP} cpu0 ${TMPPLIST} > ${WRKDIR}/plist + @${TAIL} -n 2 ${TMPPLIST} > ${WRKDIR}/plist.end + @${CP} /dev/null ${WRKDIR}/plistN +# for every cpu directory + @ncpu=`${CAT} ${WRKDIR}/ncpu` ; \ + for dir in `${FILESDIR}/number_of_dirs.sh $${ncpu}` ; do \ + ${SED} -e "s|cpu0|cpu$${dir}|" ${WRKDIR}/plist >> ${WRKDIR}/plistN ; \ + done + @${CP} /dev/null ${TMPPLIST} +.for file in plistN plist.end + @${CAT} ${WRKDIR}/${file} >> ${TMPPLIST} +.endfor +.endif + +.include <bsd.port.post.mk> diff --git a/misc/distribfold/distinfo b/misc/distribfold/distinfo new file mode 100644 index 000000000000..caca45379ff2 --- /dev/null +++ b/misc/distribfold/distinfo @@ -0,0 +1 @@ +MD5 (distribfold-current-FreeBSD.tar.gz) = cd04da97523b2246c551198e564da3b1 diff --git a/misc/distribfold/files/distribfold.sh b/misc/distribfold/files/distribfold.sh new file mode 100644 index 000000000000..fc6c75095c6a --- /dev/null +++ b/misc/distribfold/files/distribfold.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# taken from misc/dnetc by dbaker@distributed.net + +prefix="%%DESTINATION_DIR%%" +ncpu=%%NCPU%% + +case "$1" in +start) + while [ ${ncpu} -gt 0 ]; + do + # update cpu count + ncpu=$((${ncpu} - 1)) + + # dir for current cpu + dir="${prefix}/cpu${ncpu}" + + if [ ! -d $dir ]; then + logger -i "distribfold client directory doesn't exist. ($dir)." + exit + fi + + if [ ! -f $dir/foldtrajlite ]; then + logger -i "distribfold client doesn't exist. ($dir/dfoldtrajlite)." + exit + fi + + if [ ! -f $dir/handle.txt ]; then + logger -i "distribfold client is not configured. 'su -m %%DNETFOLD_USER%% -c $dir/foldit' to configure it." + echo "distribfold client is not configured. 'su -m %%DNETFOLD_USER%% -c $dir/foldit' to configure it." + exit + fi + + # start client for current cpu + su -m %%DNETFOLD_USER%% -c "cd $dir && ./foldit" 2>/dev/null >/dev/null & + done + + echo -n " distribfold" + ;; +stop) + while [ ${ncpu} -gt 0 ]; + do + # update cpu count + ncpu=$((${ncpu} - 1)) + + # dir for current cpu + dir="${prefix}/cpu${ncpu}" + + rm $dir/foldtrajlite.lock + done + + # give clients enough time to shutdown + # 5 seconds minimum + 5 seconds per number of clients + sleep $((5 + $((5 * ${ncpu})))) && echo -n " distribfold" + ;; +*) + echo "Usage: `basename $0` {start|stop}" >&2 + exit 64 + ;; +esac + +exit 0 diff --git a/misc/distribfold/files/number_of_dirs.sh b/misc/distribfold/files/number_of_dirs.sh new file mode 100644 index 000000000000..bdb3b87cc56b --- /dev/null +++ b/misc/distribfold/files/number_of_dirs.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +ncpu=${1} +current_list="" + +while [ ${ncpu} -gt 0 ]; +do + # update cpu count + ncpu=$((${ncpu} - 1)) + + current_list="${current_list} ${ncpu}" +done + +echo ${current_list} + +exit 0 diff --git a/misc/distribfold/files/patch-foldit b/misc/distribfold/files/patch-foldit new file mode 100644 index 000000000000..3543505e05e8 --- /dev/null +++ b/misc/distribfold/files/patch-foldit @@ -0,0 +1,16 @@ +--- foldit.orig Sun Sep 29 16:49:55 2002 ++++ foldit Sun Sep 29 16:50:42 2002 +@@ -1,4 +1,7 @@ + #!/bin/sh ++ ++cd %%DESTINATION_DIR%% ++ + if [ -f donename.dat ] + then + rm -f tmpfoldit.bat +@@ -23,4 +26,4 @@ + fi + fi + fi +-./foldtrajlite -f protein -n native ++exec ./foldtrajlite -f protein -n native diff --git a/misc/distribfold/pkg-comment b/misc/distribfold/pkg-comment new file mode 100644 index 000000000000..594de1538be5 --- /dev/null +++ b/misc/distribfold/pkg-comment @@ -0,0 +1 @@ +distribfold.org distributed protein folding project diff --git a/misc/distribfold/pkg-deinstall b/misc/distribfold/pkg-deinstall new file mode 100644 index 000000000000..52cc5bc4aec5 --- /dev/null +++ b/misc/distribfold/pkg-deinstall @@ -0,0 +1,63 @@ +#! /bin/sh +# +# $FreeBSD$ +# taken from net/cvsup-mirror + +PATH=/bin:/usr/sbin + +DNETFOLD_USER=${DNETFOLD_USER:-dnetfold} +DNETFOLD_GROUP=${DNETFOLD_GROUP:-dnetfold} + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +delete_account() { + local u g home + + u=$1 + g=$2 + if yesno "Do you want me to remove group \"${g}\"" y; then + pw groupdel -n ${g} + echo "Done." + fi + if yesno "Do you want me to remove user \"${u}\"" y; then + eval home=~${u} + pw userdel -n ${u} + echo "Done." + if [ -d "${home}" ]; then + echo "Please remember to remove the home directory \"${home}\"" + fi + fi +} + +if [ x$2 != xDEINSTALL ]; then + exit +fi + +delete_account ${DNETFOLD_USER} ${DNETFOLD_GROUP} diff --git a/misc/distribfold/pkg-descr b/misc/distribfold/pkg-descr new file mode 100644 index 000000000000..b43f2049ac09 --- /dev/null +++ b/misc/distribfold/pkg-descr @@ -0,0 +1,24 @@ +[ excerpt from developer's site ] + +This is the distribfold.org's client. + +It makes protein structures to help sample the enormous size of +protein conformatoinal space. We hope to find a few good samples +and understand how a large computation can help crack the problem +of predicting protein structure - the protein folding problem. + +Proteins have a vast number of folds, larger than we could hope to +compute even with distributed computing. Usually only one fold is +found in nature. The Distributed Folding Project aims to test our +new protein folding algorithm. We want see if it can reproduce +natural protein folds after making extremely large samples of many +different folds. + +With your help, we will create the largest samples of protein folds +ever computed. First we will make 1 Billion (1,000,000,000) folds +for 5 small proteins, then we will try 10 Billion (10,000,000,000) +for another 10 large proteins. By the end of our first phase, we +hope to make over 100 Billion protein folds spanning 15 different +proteins. + +WWW: http://www.distributedfolding.org/ diff --git a/misc/distribfold/pkg-install b/misc/distribfold/pkg-install new file mode 100644 index 000000000000..c7fb6adf745a --- /dev/null +++ b/misc/distribfold/pkg-install @@ -0,0 +1,41 @@ +#! /bin/sh +# +# $FreeBSD$ +# taken from devel/perforce + +PATH=/bin:/usr/sbin + +DNETFOLD_USER=${DNETFOLD_USER:-dnetfold} +DNETFOLD_GROUP=${DNETFOLD_GROUP:-dnetfold} + +case $2 in +POST-INSTALL) + USER=${DNETFOLD_USER} + GROUP=${DNETFOLD_GROUP} + + if pw group show "${GROUP}" 2>/dev/null; then + echo "You already have a group \"${GROUP}\", so I will use it." + else + if pw groupadd ${GROUP} ; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + if pw user show "${USER}" 2>/dev/null; then + echo "You already have a user \"${USER}\", so I will use it." + else + if pw useradd ${USER} -g ${GROUP} -h - \ + -d /nonexistent -c "distribfold Daemon" -s /sbin/nologin + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi + fi + + ;; +esac diff --git a/misc/distribfold/pkg-message b/misc/distribfold/pkg-message new file mode 100644 index 000000000000..b80f0a4e35ca --- /dev/null +++ b/misc/distribfold/pkg-message @@ -0,0 +1,13 @@ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER ! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +You have to run '/usr/local/distribfold/cpu0/foldit' to configure it +BEFORE trying to use distribfold. + +It will ask you questions on how it should work. It will NOT work +if you do not run it and answer these questions. + +Do it now before you forget. diff --git a/misc/distribfold/pkg-plist b/misc/distribfold/pkg-plist new file mode 100644 index 000000000000..69b889f49765 --- /dev/null +++ b/misc/distribfold/pkg-plist @@ -0,0 +1,22 @@ +distribfold/cpu0/blpotential.txt +distribfold/cpu0/bstdt.val +distribfold/cpu0/cbdata +distribfold/cpu0/CompatibilityNotes.txt +distribfold/cpu0/copyright +distribfold/cpu0/native.val +distribfold/cpu0/param19_eef1.inp +distribfold/cpu0/protein.trj +distribfold/cpu0/readme1st.txt +distribfold/cpu0/rotlib.bin.bz2 +distribfold/cpu0/skel.prt +distribfold/cpu0/solvpar.inp +distribfold/cpu0/toph19_eef1.inp +distribfold/cpu0/whatsnew.txt +distribfold/cpu0/zhangatm.txt +distribfold/cpu0/zhangeij.txt +distribfold/cpu0/distrib-update +distribfold/cpu0/foldit +distribfold/cpu0/foldtrajlite +@unexec rmdir %D/distribfold/cpu0 2>/dev/null || true +etc/rc.d/distribfold.sh +@unexec rmdir %D/distribfold 2>/dev/null || echo "If you are permanently removing this port, you should do a ``rm -rf ${PKG_PREFIX}/distribfold`` to remove any binary, configuration and log files left." | fmt |