#!/bin/bash #****************************************************************************** # Initial Author: Pascal J. Bourguignon # Copyright Assigned to the FSF / GNUstep project. # # This script is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #****************************************************************************** # pname=`basename "$0"` pblan=`echo "${pname}"|sed -e 's/./ /g'` export WGET_OPTIONS=(--passive --no-directories --mirror --level=1) export SOURCES=/local/src/gnustep export PREFIX=/local/gnustep export OSDIST=unknown-unknown export logfile=/tmp/gnustep-install.log function log () { echo $@ | tee -a /dev/tty } #log function distribution () { # DOES: Identify the system, distribution and release where we run. # Prints a line with three corresponding keywords. # STATUS: 0 upon success. # # Please send patches for your system/distribution/release # to Pascal Bourguignon . # Sys-V systems have uname. It may also exist as an add-on on other systems. local systeme= local distrib="unknown" local release="unknown" systeme=`uname` || systeme="unknown" case "$systeme" in Linux) if [ -e /etc/mandrake-release ] ; then distrib=mandrake release=`awk '{print $4}' < /etc/mandrake-release` elif [ -e /etc/redhat-release ] ; then distrib=redhat release=`awk '{print $4}' < /etc/redhat-release` elif [ -e /etc/SuSE-release ] ; then distrib=SuSE release="`grep VERSION /etc/SuSE-release|sed -e 's/.*= *//'`" fi ;; NEXTSTEP) # A special case, where a uname has been installed on NeXTSTEP. distrib=NeXT release=`uname -r` ;; unknown) # Mach systems: h=`hostinfo` || h="unknown" case "$h" in Mach*) # Well, this works on NeXTSTEP Mach: distrib=`echo "$h" | awk '{print $4}'` release=`echo "$h" | awk '{print $6}'` ;; *) ;; esac ;; *) ;; esac echo "$systeme" "$distrib" "$release" } #distribution function download () { local checkout_or_update="$1" CVSROOT_GNUSTEP=':pserver:anoncvs@cvs.gnustep.org:/cvsroot/gnustep' CVSPASS_GNUSTEP=':pserver:anoncvs@cvs.gnustep.org:/cvsroot/gnustep Ay=0=h gnustep.rc <<'EOF' #! /bin/sh # # Author: Pascal J. Bourguignon # ### BEGIN INIT INFO # Provides: gnustep # Required-Start: # Required-Stop: # Default-Start: 2 3 5 # Default-Stop: # Description: GNUstep daemons. ### END INIT INFO . /etc/rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START_GNUSTEP=yes test "$START_GNUSTEP" = yes || exit 0 #GNUSTEPSH=`find /GNUstep /usr/local/GNUstep \ # /gnustep /usr/local/gnustep \ # /System /usr/local/System \ # /Makefiles /usr/local/Makefiles \ # -name GNUstep.sh -print 2>/dev/null |head -1` GNUSTEPSH=(*GNUSTEP_SYSTEM_ROOT*)/Makefiles/GNUstep.sh if [ -r "$GNUSTEPSH" ] ; then . "$GNUSTEPSH" GDOMAP=$GNUSTEP_SYSTEM_ROOT/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gdomap GDNC=$GNUSTEP_SYSTEM_ROOT/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gdnc GPBS=$GNUSTEP_SYSTEM_ROOT/Tools/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/gpbs else echo '' fi # The echo return value for success (defined in /etc/rc.config). return=$rc_done case "$1" in start) echo -n "Starting GNUstep services: " echo -n "gdomap " startproc ${GDOMAP} || return=$rc_failed if [ "$return" = "$rc_done" ] ; then sleep 6 echo -n "gdnc " startproc ${GDNC} || return=$rc_failed fi if [ "$return" = "$rc_done" ] ; then echo -n "gpbs " startproc ${GPBS} || return=$rc_failed fi echo -e "$return" ;; stop) echo -n "Shutting down GNUstep services: " echo -n "gpbs " killproc -TERM ${GPBS} || return=$rc_failed echo -n "gdnc " killproc -TERM ${GDNC} || return=$rc_failed echo -n "gdomap " killproc -TERM ${GDOMAP} || return=$rc_failed echo -e "$return" ;; status) echo "Checking for service at deamon: " echo -n "gdomap " checkproc ${GDOMAP} && echo OK || echo No process echo -n "gdnc " checkproc ${GDNC} && echo OK || echo No process echo -n "gpbs " checkproc ${GPBS} && echo OK || echo No process ;; reload) $0 stop && $0 start || return=$rc_failed ;; restart) $0 stop && $0 start || return=$rc_failed ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0 EOF chmod 755 gnustep.rc if [ $UID -eq 0 ] ; then cp gnustep.rc /etc/rc.d/gnustep echo 'START_GNUSTEP="yes"' >> /etc/rc.config /sbin/SuSEconfig ldconfig $GNUSTEP_SYSTEM_ROOT/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/lib* $GNUSTEP_SYSTEM_ROOT/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/* else echo 'Please, run these commands as root:' echo " cp ${SOURCES}/gnustep.rc /etc/rc.d/gnustep" echo " echo 'START_GNUSTEP="yes"' >> /etc/rc.config" echo " /sbin/SuSEconfig" echo " ldconfig $GNUSTEP_SYSTEM_ROOT/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/lib* $GNUSTEP_SYSTEM_ROOT/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO/*" fi ;; *) echo "${pname}: Please, edit this script to add a rc script for your system." exit 1 ;; esac } #boot_script function usage () { echo "${pname} usage:" echo " ${pname} [-h|--help] [-d|--download]" echo " ${pblan} [--log=LOGFILE]" echo " ${pblan} [-c|--compile|--compile-from=STEP]" echo "" echo " Default LOGFILE is /tmp/gnustep-install.log (appended to)." echo " STEP in makefile gnustep-objc ffcall limxml dgs base gnustep-guile" echo " gui libPropList WindowMaker xdps xgps extensions " echo " GWorkspace ProjectCenter Gorm" } #usage # main # for arg ; do case "$arg" in -h|--help) usage exit 0 ;; --log=*) logfile=`echo "$arg"|sed -e 's/.*=//'` ;; -d|--download) echo '############################################################' \ >> ${logfile} date >> ${logfile} if [ -d "${SOURCES}/gnustep" ] ; then download update >> ${logfile} else download checkout >> ${logfile} fi ;; -c|--compile) echo '############################################################' \ >> ${logfile} date >> ${logfile} time compile 0 >> ${logfile} 2>&1 ;; --compile-from=*) case `echo "$arg" | sed -e 's/.*=//'` in makefile) step=1 ;; gnustep-objc|gs-objc|gsobjc|objc) step=2 ;; makefile-2|makefile2) step=3 ;; ffcall) step=4 ;; libxml|xml) step=5 ;; dgs) step=6 ;; fonts) step=7 ;; base) step=8 ;; gnustep-guile|gs-guile|gsguile|guile) step=9 ;; gui) step=10 ;; libPropList|libproplist|proplist) step=11 ;; WindowMaker|windowmaker|wmaker) step=12 ;; xdps) step=13 ;; xgps) step=14 ;; extensions) step=15 ;; GWorkspace|gworkspace|workspace) step=16 ;; gdb|debugger|debug) step=17 ;; ProjectCenter|projectcenter|pb) step=18 ;; Gorm|gorm|ib) step=19 ;; *) echo "${pname}: Invalid step: $arg" usage exit 1 ;; esac echo '############################################################' \ >> ${logfile} date >> ${logfile} time compile $step >> ${logfile} 2>&1 ;; -b|--boot-script|--bootscript|--boot|--script) boot_script ;; *) echo "${pname}: Invalid option: $arg" usage exit 2 ;; esac done exit 0