From 03a4f6f5c9a43baf1dd7d5e9b44e5113b90ba35b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 4 Dec 2012 15:43:33 -0600
Subject: foldingathome: updated client to v7 refs #872

---
 abs/extra/foldingathome/PKGBUILD                   | 56 +++++++++++++++-------
 abs/extra/foldingathome/foldingathome-v7.install   | 12 +++++
 abs/extra/foldingathome/foldingathome-v7.rc.d      | 46 ++++++++++++++++++
 abs/extra/foldingathome/foldingathome-v7.service   | 12 +++++
 abs/extra/foldingathome/foldingathome-v7/PKGBUILD  | 45 +++++++++++++++++
 .../foldingathome-v7/foldingathome-v7.install      | 12 +++++
 .../foldingathome-v7/foldingathome-v7.rc.d         | 46 ++++++++++++++++++
 .../foldingathome-v7/foldingathome-v7.service      | 12 +++++
 abs/extra/foldingathome/foldingathome.install      | 47 ------------------
 abs/extra/foldingathome/run                        | 26 ----------
 10 files changed, 223 insertions(+), 91 deletions(-)
 create mode 100644 abs/extra/foldingathome/foldingathome-v7.install
 create mode 100644 abs/extra/foldingathome/foldingathome-v7.rc.d
 create mode 100644 abs/extra/foldingathome/foldingathome-v7.service
 create mode 100644 abs/extra/foldingathome/foldingathome-v7/PKGBUILD
 create mode 100644 abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.install
 create mode 100644 abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.rc.d
 create mode 100644 abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.service
 delete mode 100644 abs/extra/foldingathome/foldingathome.install
 delete mode 100644 abs/extra/foldingathome/run

diff --git a/abs/extra/foldingathome/PKGBUILD b/abs/extra/foldingathome/PKGBUILD
index c78cb93..89f1eca 100644
--- a/abs/extra/foldingathome/PKGBUILD
+++ b/abs/extra/foldingathome/PKGBUILD
@@ -1,28 +1,48 @@
-# Contributor: Jason Taylor <jftaylor21@gmail.com>
-# Contributor: seratne
-# Contributor: Nick B <Shirakawasuna at gmail _dot_com>
+# Contributor: paul2lv [at] gmail dot com
+# Maintainer: 
 
 pkgname=foldingathome
-pkgver=6.02
-pkgrel=7
+pkgver=7.2.9
+pkgrel=1
 pkgdesc="Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases."
 arch=('i686' 'x86_64')
 url="http://folding.stanford.edu/"
-license=('custom')
-depends=('bash')
-backup=('etc/conf.d/foldingathome')
-install=foldingathome.install
-source=(http://www.stanford.edu/group/pandegroup/folding/release/FAH$pkgver-Linux.tgz
-	run)
+license=('CUSTOM')
+depends=('glibc')
+install=foldingathome-v7.install
+
+# Moronic server
+DLAGENTS=("https::/usr/bin/curl -k -o %o %u")
+
+[ "$CARCH" = "i686" ] &&_source_arch="32bit"
+[ "$CARCH" = "x86_64" ] && _source_arch="64bit"
+
+if [ "$CARCH" = "i686" ]; then
+    source=(https://fah-web.stanford.edu/file-releases/public/release/fahclient/debian-testing-32bit/v7.2/fahclient_7.2.9-32bit-release.tar.bz2 foldingathome-v7.rc.d foldingathome-v7.service)
+    md5sums=('f8a0b43bfc4110f2200b689d8d788962' '50481b4e31edb24519e855d770955eda' 'fe7c7652443e72830cf6d641846c07f6')
+     
+elif [ "$CARCH" = "x86_64" ]; then
+    source=(https://fah-web.stanford.edu/file-releases/public/release/fahclient/debian-testing-64bit/v7.2/fahclient_7.2.9-64bit-release.tar.bz2 foldingathome-v7.rc.d foldingathome-v7.service)
+    md5sums=('d8d93d3436e5ebb52876c73cf375c9ac' '50481b4e31edb24519e855d770955eda' 'fe7c7652443e72830cf6d641846c07f6')
+fi
+
 
 build() {
-  cd $startdir/src/
+  cd ${srcdir}
 
-  tar zxf FAH${pkgver}-Linux.tgz
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/FAHClient ${pkgdir}/opt/fah-v7/FAHClient
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/FAHCoreWrapper ${pkgdir}/opt/fah-v7/FAHCoreWrapper
+  install -D -c -m755 ${srcdir}/foldingathome-v7.rc.d ${pkgdir}/etc/rc.d/foldingathome-v7
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/sample-config.xml ${pkgdir}/opt/fah-v7/sample-config.xml
 
-  # At this stage, the mpiexec is not included because it requires x86_64.
-  install -D -c -m755 fah6 $startdir/pkg/usr/bin/fah6 || return 1
-  install -D -m755 run $startdir/pkg/etc/sv/fah/run
+  chmod 755 ${pkgdir}/opt/fah-v7/FAHClient
+  chmod 755 ${pkgdir}/opt/fah-v7/FAHCoreWrapper
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/copyright ${pkgdir}/usr/share/licenses/${pkgname}/copyright
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/README ${pkgdir}/opt/fah-v7/README
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/ChangeLog ${pkgdir}/opt/fah-v7/ChangeLog
+  install -D -m644 ${srcdir}/foldingathome-v7.service ${pkgdir}/etc/systemd/system/foldingathome-v7.service
 }
-md5sums=('112b3d66909050f1bb990993a1464cb9'
-         'cefaf5ba2f3e2fe81533b5ee4795dc78')
+
+md5sums=('d8d93d3436e5ebb52876c73cf375c9ac'
+         '50481b4e31edb24519e855d770955eda'
+         'fe7c7652443e72830cf6d641846c07f6')
diff --git a/abs/extra/foldingathome/foldingathome-v7.install b/abs/extra/foldingathome/foldingathome-v7.install
new file mode 100644
index 0000000..6899bba
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7.install
@@ -0,0 +1,12 @@
+post_install() {
+  cat << 'EOM'
+  --> Please cd to /opt/fah-v7/ and execute ./FAHClient --configure
+  --> as root to configure your settings. If you are using systemd, 
+  --> then run "systemctl enable foldingathome-v7.service" to enable
+  --> the folding service. If you are using initscripts, then add
+  --> "foldingathome-v7" to the list of daemons in /etc/rc.conf.
+  --> If you would like join the Arch Linux team, use team number 
+  --> 45032.  
+EOM
+}
+
diff --git a/abs/extra/foldingathome/foldingathome-v7.rc.d b/abs/extra/foldingathome/foldingathome-v7.rc.d
new file mode 100644
index 0000000..91a395a
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7.rc.d
@@ -0,0 +1,46 @@
+#!/bin/bash
+#/etc/rc.d/foldingathome-v7
+#
+# Starts the Folding@Home-v7 client in the background
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON=foldingathome-v7
+#ARGS=
+
+#[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
+
+PID=$(pidof -x -o %PPID /opt/fah-v7/FAHClient)
+case "${1}" in
+ start)
+   stat_busy "Starting $DAEMON"
+   [ -z "${PID}" ] && /opt/fah-v7/FAHClient --config /opt/fah-v7/config.xml --exec-directory=/opt/fah-v7 --data-directory=/opt/fah-v7 &> /dev/null &
+    add_daemon $DAEMON
+    if [ ! -z "$PID" -o $? -gt 0 ]; then
+     stat_fail
+     exit 1
+   else
+     stat_done
+     exit 1
+   fi
+   ;;
+ stop)
+   stat_busy "Stopping $DAEMON"
+   [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
+   if [ $? -gt 0 ]; then
+     stat_fail
+   else
+     rm_daemon $DAEMON
+     stat_done
+     exit 1
+   fi
+   ;;
+ restart)
+   $0 stop
+   sleep 1
+   $0 start
+   ;;
+ *)
+   echo "usage: $0 {start|stop|restart}"  
+esac
diff --git a/abs/extra/foldingathome/foldingathome-v7.service b/abs/extra/foldingathome/foldingathome-v7.service
new file mode 100644
index 0000000..4634582
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Folding@home V7 distributed computing client
+After=network.target
+
+[Service]
+Type=simple
+WorkingDirectory=/opt/fah-v7
+ExecStart=/opt/fah-v7/FAHClient --config /opt/fah-v7/config.xml --exec-directory=/opt/fah-v7 --data-directory=/opt/fah-v7
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/abs/extra/foldingathome/foldingathome-v7/PKGBUILD b/abs/extra/foldingathome/foldingathome-v7/PKGBUILD
new file mode 100644
index 0000000..c98ef7c
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7/PKGBUILD
@@ -0,0 +1,45 @@
+# Contributor: paul2lv [at] gmail dot com
+# Maintainer: 
+
+pkgname=foldingathome-v7
+pkgver=7.2.9
+pkgrel=1
+pkgdesc="Folding@Home is a distributed computing project which studies protein folding, misfolding, aggregation, and related diseases."
+arch=('i686' 'x86_64')
+url="http://folding.stanford.edu/"
+license=('CUSTOM')
+depends=('glibc')
+install=foldingathome-v7.install
+
+# Moronic server
+DLAGENTS=("https::/usr/bin/curl -k -o %o %u")
+
+[ "$CARCH" = "i686" ] &&_source_arch="32bit"
+[ "$CARCH" = "x86_64" ] && _source_arch="64bit"
+
+if [ "$CARCH" = "i686" ]; then
+    source=(https://fah-web.stanford.edu/file-releases/public/release/fahclient/debian-testing-32bit/v7.2/fahclient_7.2.9-32bit-release.tar.bz2 foldingathome-v7.rc.d foldingathome-v7.service)
+    md5sums=('f8a0b43bfc4110f2200b689d8d788962' '50481b4e31edb24519e855d770955eda' 'fe7c7652443e72830cf6d641846c07f6')
+     
+elif [ "$CARCH" = "x86_64" ]; then
+    source=(https://fah-web.stanford.edu/file-releases/public/release/fahclient/debian-testing-64bit/v7.2/fahclient_7.2.9-64bit-release.tar.bz2 foldingathome-v7.rc.d foldingathome-v7.service)
+    md5sums=('d8d93d3436e5ebb52876c73cf375c9ac' '50481b4e31edb24519e855d770955eda' 'fe7c7652443e72830cf6d641846c07f6')
+fi
+
+
+build() {
+  cd ${srcdir}
+
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/FAHClient ${pkgdir}/opt/fah-v7/FAHClient
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/FAHCoreWrapper ${pkgdir}/opt/fah-v7/FAHCoreWrapper
+  install -D -c -m755 ${srcdir}/foldingathome-v7.rc.d ${pkgdir}/etc/rc.d/foldingathome-v7
+  install -D -c -m755 fahclient_${pkgver}-${_source_arch}-release/sample-config.xml ${pkgdir}/opt/fah-v7/sample-config.xml
+
+  chmod 755 ${pkgdir}/opt/fah-v7/FAHClient
+  chmod 755 ${pkgdir}/opt/fah-v7/FAHCoreWrapper
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/copyright ${pkgdir}/usr/share/licenses/${pkgname}/copyright
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/README ${pkgdir}/opt/fah-v7/README
+  install -D -m644 fahclient_${pkgver}-${_source_arch}-release/ChangeLog ${pkgdir}/opt/fah-v7/ChangeLog
+  install -D -m644 ${srcdir}/foldingathome-v7.service ${pkgdir}/etc/systemd/system/foldingathome-v7.service
+}
+
diff --git a/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.install b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.install
new file mode 100644
index 0000000..6899bba
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.install
@@ -0,0 +1,12 @@
+post_install() {
+  cat << 'EOM'
+  --> Please cd to /opt/fah-v7/ and execute ./FAHClient --configure
+  --> as root to configure your settings. If you are using systemd, 
+  --> then run "systemctl enable foldingathome-v7.service" to enable
+  --> the folding service. If you are using initscripts, then add
+  --> "foldingathome-v7" to the list of daemons in /etc/rc.conf.
+  --> If you would like join the Arch Linux team, use team number 
+  --> 45032.  
+EOM
+}
+
diff --git a/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.rc.d b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.rc.d
new file mode 100644
index 0000000..91a395a
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.rc.d
@@ -0,0 +1,46 @@
+#!/bin/bash
+#/etc/rc.d/foldingathome-v7
+#
+# Starts the Folding@Home-v7 client in the background
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON=foldingathome-v7
+#ARGS=
+
+#[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
+
+PID=$(pidof -x -o %PPID /opt/fah-v7/FAHClient)
+case "${1}" in
+ start)
+   stat_busy "Starting $DAEMON"
+   [ -z "${PID}" ] && /opt/fah-v7/FAHClient --config /opt/fah-v7/config.xml --exec-directory=/opt/fah-v7 --data-directory=/opt/fah-v7 &> /dev/null &
+    add_daemon $DAEMON
+    if [ ! -z "$PID" -o $? -gt 0 ]; then
+     stat_fail
+     exit 1
+   else
+     stat_done
+     exit 1
+   fi
+   ;;
+ stop)
+   stat_busy "Stopping $DAEMON"
+   [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
+   if [ $? -gt 0 ]; then
+     stat_fail
+   else
+     rm_daemon $DAEMON
+     stat_done
+     exit 1
+   fi
+   ;;
+ restart)
+   $0 stop
+   sleep 1
+   $0 start
+   ;;
+ *)
+   echo "usage: $0 {start|stop|restart}"  
+esac
diff --git a/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.service b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.service
new file mode 100644
index 0000000..4634582
--- /dev/null
+++ b/abs/extra/foldingathome/foldingathome-v7/foldingathome-v7.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Folding@home V7 distributed computing client
+After=network.target
+
+[Service]
+Type=simple
+WorkingDirectory=/opt/fah-v7
+ExecStart=/opt/fah-v7/FAHClient --config /opt/fah-v7/config.xml --exec-directory=/opt/fah-v7 --data-directory=/opt/fah-v7
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/abs/extra/foldingathome/foldingathome.install b/abs/extra/foldingathome/foldingathome.install
deleted file mode 100644
index 20e48d1..0000000
--- a/abs/extra/foldingathome/foldingathome.install
+++ /dev/null
@@ -1,47 +0,0 @@
-post_install() {
-  # Check for an R5.5 fah installation.
-  r5_fah_dir=/myth/folding@home
-  r6_fah_dir=/myth/foldingathome/$(hostname)
-  if [ -d "$r5_fah_dir" ] ; then
-    if [ -d "$r6_fah_dir" ] ; then
-      cat << 'EOM'
-  --> You have an R5.5 and an R6 folding directory at the same time!
-  --> you should manually delete the R5.5 directory:
-  -->    $r5_fah_dir
-  --> The directroy used on R6 will be:
-  -->    $r6_fah_dir
-EOM
-    else
-      mkdir -p /myth/foldingathome
-      mv $r5_fah_dir $r6_fah_dir
-    fi
-  else
-    if [ ! -d "$r6_fah_dir" ] ; then
-      mkdir -p $r6_fah_dir
-      cat > $r6_fah_dir/client.cfg << 'EOM'
-[settings]
-username=LinHES
-team=50975
-passkey=
-asknet=no
-bigpackets=normal
-machineid=1
-
-[http]
-active=no
-host=localhost
-port=8080
-EOM
-    fi
-  fi
-  rm -fr $r6_fah_dir/index.html
-  ln -s $r6_fah_dir/MyFolding.html $r6_fah_dir/index.html
-  ln -s $r6_fah_dir /data/srv/httpd/htdocs/foldingathome
-  /sbin/add_service.sh fah
-}
-
-pre_remove() {
-  sv stop fah
-  /sbin/remove_service.sh fah
-}
-
diff --git a/abs/extra/foldingathome/run b/abs/extra/foldingathome/run
deleted file mode 100644
index cd4a072..0000000
--- a/abs/extra/foldingathome/run
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-export TERM=linux
-. /etc/rc.conf
-. /etc/rc.d/functions
-stat_runit "Starting folding@home"
-
-FOLDING_DIR=/myth/foldingathome/$(hostname)
-
-if [ -d $FOLDING_DIR ] ; then
-  cd $FOLDING_DIR
-  # Ensure that the client configuration file has the same details as /etc/systemconfig
-
-  source /etc/systemconfig
-
-  if [ -n "$foldingusername" ] ; then
-    sed -i 's/username=.*$/username='$foldingusername'/g' $FOLDING_DIR/client.cfg
-  fi
-
-  if [ -n "$foldingworksize" ] ; then
-    sed -i 's/bigpackets=.*$/bigpackets='$foldingworksize'/g' $FOLDING_DIR/client.cfg
-  fi
-
-  # No need to direct output to a log file becase a log file
-  # will automatically be placed in $FOLDING_DIR
-  exec /usr/bin/fah6 &> /dev/null < /dev/null
-fi
-- 
cgit v0.12