diff options
author | Tomas Chvatal <scarabeus@gentoo.org> | 2009-07-24 10:58:33 +0000 |
---|---|---|
committer | Tomas Chvatal <scarabeus@gentoo.org> | 2009-07-24 10:58:33 +0000 |
commit | 310116244714a4a2c7dc99d66aaa47f5bfd29ea1 (patch) | |
tree | 76ebb1ea39ef1873d0a2783e9889b3071924f576 | |
parent | Fix LICENSE to public-domain wrt #278634. (diff) | |
download | gentoo-2-310116244714a4a2c7dc99d66aaa47f5bfd29ea1.tar.gz gentoo-2-310116244714a4a2c7dc99d66aaa47f5bfd29ea1.tar.bz2 gentoo-2-310116244714a4a2c7dc99d66aaa47f5bfd29ea1.zip |
Remove bashism in initscript. Per bug #278811. Thanks to Michał Górny for the patch.
(Portage version: 2.2_rc33/cvs/Linux x86_64)
-rw-r--r-- | sci-misc/boinc/ChangeLog | 6 | ||||
-rw-r--r-- | sci-misc/boinc/files/boinc.init | 65 |
2 files changed, 37 insertions, 34 deletions
diff --git a/sci-misc/boinc/ChangeLog b/sci-misc/boinc/ChangeLog index 412100467e41..14f3c0cd38e6 100644 --- a/sci-misc/boinc/ChangeLog +++ b/sci-misc/boinc/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sci-misc/boinc # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sci-misc/boinc/ChangeLog,v 1.66 2009/07/08 09:00:31 scarabeus Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-misc/boinc/ChangeLog,v 1.67 2009/07/24 10:58:33 scarabeus Exp $ + + 24 Jul 2009; Tomáš Chvátal <scarabeus@gentoo.org> files/boinc.init: + Remove bashism in initscript. Per bug #278811. Thanks to Michał Górny + for the patch. 08 Jul 2009; Tomáš Chvátal <scarabeus@gentoo.org> files/boinc.init: Use pidfile in initscript. Per bug #276271. diff --git a/sci-misc/boinc/files/boinc.init b/sci-misc/boinc/files/boinc.init index fb2aa40707ba..efa7355f10c3 100644 --- a/sci-misc/boinc/files/boinc.init +++ b/sci-misc/boinc/files/boinc.init @@ -9,31 +9,31 @@ depend() { } create_work_directory() { - if [[ ! -d ${RUNTIMEDIR} ]]; then + if [ ! -d "${RUNTIMEDIR}" ]; then einfo "Directory ${RUNTIMEDIR} not existing, creating now." - mkdir ${RUNTIMEDIR} - chown ${USER}:${GROUP} ${RUNTIMEDIR} - if [[ ! -d ${RUNTIMEDIR} ]]; then + mkdir "${RUNTIMEDIR}" + chown "${USER}:${GROUP}" "${RUNTIMEDIR}" + if [ ! -d "${RUNTIMEDIR}" ]; then eeror "Directory ${RUNTIMEDIR} could not be created!" return 1 fi - ln -s /etc/ssl/certs/ca-certificates.crt ${RUNTIMEDIR}/ca-bundle.crt + ln -s /etc/ssl/certs/ca-certificates.crt "${RUNTIMEDIR}"/ca-bundle.crt fi } generate_logs() { - if [[ ! -f ${LOGFILE} ]]; then + if [ ! -f "${LOGFILE}" ]; then einfo "No ${LOGFILE} around. Creating new..." einfo "For good log rotation is great tool app-admin/logrotate" - touch ${LOGFILE} - chown ${USER}:${GROUP} ${LOGFILE} + touch "${LOGFILE}" + chown "${USER}:${GROUP}" "${LOGFILE}" fi } cuda_check() { - if [[ -f /opt/cuda/lib/libcudart.so ]]; then + if [ -f /opt/cuda/lib/libcudart.so ]; then # symlink wont harm :] - ln -snf /opt/cuda/lib/libcudart.so ${RUNTIMEDIR}/libcudart.so + ln -snf /opt/cuda/lib/libcudart.so "${RUNTIMEDIR}"/libcudart.so fi } @@ -43,9 +43,9 @@ start() { create_work_directory cuda_check - pushd ${RUNTIMEDIR} > /dev/null + cd "${RUNTIMEDIR}" - if [[ ! -f lockfile ]]; then + if [ ! -f lockfile ]; then einfo "File $RUNTIMEDIR/lockfile does not exist, assuming first run." einfo "You need to setup an account on the BOINC project homepage beforehand!" einfo "Go to http://boinc.berkeley.edu/ and locate your project." @@ -58,36 +58,36 @@ start() { generate_logs - if [[ ${ALLOW_REMOTE_RPC} = "yes" ]]; then + if [ "${ALLOW_REMOTE_RPC}" = "yes" ]; then ARGS="${ARGS} -allow_remote_gui_rpc" fi - + # sys-apps/util-linux CHRT="/usr/bin/chrt ${SCHED_PARAM}" # check for baselayout version - if [[ -n "${RC_UNAME}" ]]; then - PARAMS="--background --stdout ${LOGFILE} --stderr ${LOGFILE} -- ${ARGS}" + if [ -n "${RC_UNAME}" ]; then + PARAMS="--background --stdout '${LOGFILE}' --stderr '${LOGFILE}' -- ${ARGS}" else - PARAMS="-- ${ARGS} >> ${LOGFILE} 2>&1 &" + PARAMS="-- ${ARGS} >> '${LOGFILE}' 2>&1 &" fi eval ${CHRT} start-stop-daemon \ - --quiet --start --chdir ${RUNTIMEDIR} \ - --pidfile ${PIDFILE} \ + --quiet --start --chdir "${RUNTIMEDIR}" \ + --pidfile "${PIDFILE}" \ --make-pidfile \ - --exec ${BOINCBIN} --chuid ${USER}:${GROUP} \ - --nicelevel ${NICELEVEL} \ + --exec "${BOINCBIN}" --chuid "${USER}:${GROUP}" \ + --nicelevel "${NICELEVEL}" \ ${PARAMS} RESULT=$? - if [ "${CPU_SHARE}" -a -d /sys/kernel/uids ]; then - BUID=`id -u ${USER}` + if [ "${CPU_SHARE}" ] && [ -d /sys/kernel/uids ]; then + BUID="$(id -u "${USER}")" # It might take a moment for start-stop-daemon to chuid - [[ -d /sys/kernel/uids/${BUID} ]] || sleep 5 # 5 was working always here - if [[ -w /sys/kernel/uids/${BUID}/cpu_share ]]; then - echo ${CPU_SHARE} > /sys/kernel/uids/${BUID}/cpu_share + [ -d /sys/kernel/uids/"${BUID}" ] || sleep 5 # 5 was working always here + if [ -w /sys/kernel/uids/"${BUID}"/cpu_share ]; then + echo "${CPU_SHARE}" > /sys/kernel/uids/"${BUID}"/cpu_share fi fi @@ -101,25 +101,24 @@ attach() { read key RC_QUIET_STDOUT="yes" svc_status - if [[ $? = 1 ]]; then + if [ $? = 1 ]; then svc_start fi ebegin "Attaching to project" # we have to work in runtime directory - pushd ${RUNTIMEDIR} > /dev/null + cd "${RUNTIMEDIR}" # boinc does not return 1 when it fails currently - ${BOINCBIN} --chuid ${USER}:${GROUP} --attach_project ${url} ${key} &> /dev/null - popd > /dev/null + "${BOINCBIN}" --chuid "${USER}:${GROUP}" --attach_project "${url}" "${key}" &> /dev/null eend $? sleep 10 - tail ${LOGFILE} + tail "${LOGFILE}" } stop() { ebegin "Stopping BOINC" - start-stop-daemon --stop --retry 3 --quiet --exec ${BOINCBIN} - rm -f ${PIDFILE} + start-stop-daemon --stop --retry 3 --quiet --exec "${BOINCBIN}" + rm -f "${PIDFILE}" eend $? } |