From bb20db8e8760000402af72583770a4683ef79693 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Wed, 10 Jul 2002 23:15:43 +0000 Subject: - SuSE 8 - related changes - RPM - related changes - sisinstall: Correct shutdown of newt if an error occurs. --- etc/.cvsignore | 2 +- etc/plptools.spec.in | 101 +++++++++++++++++++++++++++++++++++++++++++++---- etc/psion.SuSE.in | 40 ++++++++++++++------ etc/psion.SuSE8.in | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++ etc/psion.in | 38 ++++++++++++++----- 5 files changed, 257 insertions(+), 29 deletions(-) create mode 100755 etc/psion.SuSE8.in (limited to 'etc') diff --git a/etc/.cvsignore b/etc/.cvsignore index a7bfa17..7b89311 100644 --- a/etc/.cvsignore +++ b/etc/.cvsignore @@ -1,3 +1,3 @@ psion -psion.SuSE +psion.SuSE* plptools.spec diff --git a/etc/plptools.spec.in b/etc/plptools.spec.in index 05603cb..196f34c 100644 --- a/etc/plptools.spec.in +++ b/etc/plptools.spec.in @@ -1,3 +1,21 @@ +%define srel /etc/SuSE-release +%define rrel /etc/redhat-release +%define isSUSE %(test -f %{srel} && echo 1 || echo 0) +%define isRH %(test -f %{rrel} && echo 1 || echo 0) + +%if "%{isSUSE}" > "0" +%define REL %(grep VERSION %{srel} | sed -e 's/VERSION = //') +%if "%{REL}" >= "8.0" +# Bug in SuSE8.0's rpm setup: _initrddir has wrong value +%_initrddir %{_sysconfdir}/init.d +%else +%_initrddir %{_sysconfdir}/init.d +%endif +%endif +%if "%{isRH}" > "0" +%define REL %(rpm -q --queryformat '%%{version}' redhat-release) +%endif + Summary: Connectivity for psion series 5. Name: plptools %define version @VERSION@ @@ -10,7 +28,7 @@ Source0: http://download.sourceforge.net/plptools/plptools-%{version}.tar.gz Copyright: GPL Group: Networking/Utilities Requires: chkconfig >= 0.9 -Buildrequires: readline-devel kdelibs-devel >= 2.1 qt-devel >= 2.2.4 +Buildrequires: readline-devel newt-devel kdelibs-devel >= 2.1 qt-devel >= 2.2.4 BuildRoot: /tmp/plputils-buildroot %package devel @@ -125,14 +143,48 @@ zwischen Psion und Rechner. %setup -q %build -%configure --enable-kde +%if "%{isSUSE}" > "0" +%if "%{REL}" >= "8.0" +%configure --enable-kde --with-initdir=%{_initrddir} --with-kdedir=/opt/kde3 +%else +%configure --enable-kde --with-initdir=%{_initrddir} --with-kdedir=/opt/kde2 +%endif +%endif +%if "%{isRH}" > "0" +%configure --enable-kde --with-initdir=%{_initrddir} +%endif make %install -mkdir -p $RPM_BUILD_ROOT/usr $RPM_BUILD_ROOT/etc/rc.d/init.d +mkdir -p $RPM_BUILD_ROOT/%{_prefix} $RPM_BUILD_ROOT%{_initrddir} \ # rpm's makeinstall doesn't work here! make DESTDIR=$RPM_BUILD_ROOT install -install -m755 etc/psion $RPM_BUILD_ROOT/etc/rc.d/init.d +%if "%{isSUSE}" > "0" +%if "%{REL}" >= "8.0" +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +cat>$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/psion< "0" +install -m755 etc/psion $RPM_BUILD_ROOT%{_initrddir}/psion +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +cat>$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/psion< "0" /sbin/chkconfig --add psion -/etc/rc.d/init.d/psion condrestart +%endif +%if "%{isSUSE}" > "0" +%if "%{REL}" >= "8.0" +/sbin/chkconfig --add psion +%else +( + grep -v START_PSION /etc/rc.config + echo '# Set START_PSION to yes to start Psion support' + echo 'START_PSION=yes' +) > /etc/rc.config.$$ +cp /etc/rc.config /etc/rc.config.old && mv /etc/rc.config.$$ /etc/rc.config +/sbin/insserv -d psion +%endif +%endif +%{_initrddir}/psion condrestart KONQRC=`kde-config --expandvars --install config`/konquerorrc if grep -q '\[Notification Messages\]' $KONQRC ; then ( @@ -161,20 +228,39 @@ fi %preun if [ "$1" = 0 ] then - /etc/rc.d/init.d/psion stop >&2 + %{_initrddir}/psion stop >/dev/null 2>&1 +%if "%{isSUSE}" > "0" +%if "%{REL}" >= "8.0" + /sbin/chkconfig --del psion +%else + /sbin/insserv -r -d psion +%endif +%endif +%if "%{isRH}" > "0" /sbin/chkconfig --del psion +%endif fi %files %doc COPYING INSTALL CHANGES README* TODO etc/*magic patches %{_bindir}/plpftp %{_bindir}/plpbackup +%{_bindir}/sisinstall %{_sbindir}/* %{_mandir}/*/* %{_libdir}/libplp.so* %{_libdir}/libplp.la %{_datadir}/locale/*/LC_MESSAGES/plptools.mo -%config /etc/rc.d/init.d/psion +%{_datadir}/%{name}/* +%config %{_initrddir}/psion +%if "%{isSUSE}" > "0" +%if "%{REL}" >= "8.0" +%{_sysconfdir}/sysconfig/psion +%endif +%endif +%if "%{isRH}" > "0" +%{_sysconfdir}/sysconfig/psion +%endif %files devel %doc doc/api etc/*.spec @@ -206,6 +292,7 @@ fi %files -n klipsi %{_bindir}/klipsi %{_libdir}/klipsi.* +%{_datadir}/applnk/*/klipsi* %{_datadir}/apps/klipsi/* %{_datadir}/icons/*/*/apps/klipsi* %{_datadir}/icons/*/*/actions/klipsi* diff --git a/etc/psion.SuSE.in b/etc/psion.SuSE.in index 0e7c504..077244d 100755 --- a/etc/psion.SuSE.in +++ b/etc/psion.SuSE.in @@ -32,13 +32,23 @@ start() { exit 0 fi echo -n "Starting Psion support (ncpd): " - /sbin/startproc @prefix@/sbin/ncpd + /sbin/startproc @prefix@/sbin/ncpd $NCPD_ARGS RETVAL=$? - if [ $RETVAL -eq 0 ] ; then - echo -e "$return" - echo -n "Starting Psion support (plpnfsd): " - /sbin/startproc @prefix@/sbin/plpnfsd - RETVAL=$? + if test "$START_PLPNFSD" = "yes" ; then + if [ $RETVAL -eq 0 ] ; then + echo -e "$return" + echo -n "Starting Psion support (plpnfsd): " + /sbin/startproc @prefix@/sbin/plpnfsd $PLPNFSD_ARGS + RETVAL=$? + fi + fi + if test "$START_PLPPRINTD" = "yes" ; then + if [ $RETVAL -eq 0 ] ; then + echo -e "$return" + echo -n "Starting Psion support (plpprintd): " + /sbin/startproc @prefix@/sbin/plpprintd $PLPPRINTD_ARGS + RETVAL=$? + fi fi test $RETVAL -eq 0 || return=$rc_failed echo -e "$return" @@ -47,11 +57,19 @@ start() { stop() { echo -n "Stopping Psion support: " - /bin/killproc -HUP plpnfsd - while true ; do - test -z "`pidof plpnfsd`" && break; - sleep 1 # allow plpnfsd flushing it's cache - done + if test "$START_PLPNFSD" = "yes" ; then + /bin/killproc -HUP plpnfsd + WAIT=5 + while test $WAIT -gt 0 ; do + test -z "`pidof plpnfsd`" && break; + sleep 1 # allow plpnfsd flushing it's cache + WAIT=`expr $WAIT - 1` + done + test -n "`pidof plpnfsd`" && killproc plpnfsd + fi + if test "$START_PLPPRINTD" = "yes" ; then + /sbin/killproc -TERM plpprintd + fi /sbin/killproc -TERM ncpd RETVAL=$? test $RETVAL -eq 0 || return=$rc_failed diff --git a/etc/psion.SuSE8.in b/etc/psion.SuSE8.in new file mode 100755 index 0000000..e3f620e --- /dev/null +++ b/etc/psion.SuSE8.in @@ -0,0 +1,105 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: psion +# Required-Start: $syslog +# Required-Stop: +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Description: Start Psion support +### END INIT INFO + +# Source function library. +. /etc/rc.status + +[ -f @prefix@/sbin/ncpd ] || exit 0 +[ -f @prefix@/sbin/plpnfsd ] || exit 0 +[ -f @prefix@/sbin/plpprintd ] || exit 0 +[ -f /etc/sysconfig/psion ] || exit 0 +. /etc/sysconfig/psion + +MGETTY_HASPLP=false + +if grep -qs ^/PLP/ /etc/mgetty+sendfax/login.config ; then + mrun=`pidofproc mgetty` + test -n "$mrun" && MGETTY_HASPLP=true +fi + +rc_reset + +start() { + if $MGETTY_HASPLP ; then + echo "NOT Starting ncpd because mgetty configured for PLP" + exit 0 + fi + echo -n "Starting Psion support (ncpd): " + startproc -f @prefix@/sbin/ncpd $NCPD_ARGS + if rc_status -v ; then + if [ "$START_PLPNFSD" = "yes" ] ; then + echo -n "Starting Psion support (plpnfsd): " + startproc -f @prefix@/sbin/plpnfsd $PLPNFSD_ARGS + rc_status -v + fi + if [ "$START_PLPPRINTD" = "yes" ] ; then + echo -n "Starting Psion support (plpprintd): " + startproc -f @prefix@/sbin/plpprintd $PLPPRINTD_ARGS + rc_status -v + fi + fi + rc_status && touch /var/lock/subsys/psion +} + +stop() { + echo -n "Stopping Psion support: " + if [ "$START_PLPNFSD" = "yes" ] ; then + killproc -HUP @prefix@/sbin/plpnfsd + WAIT=5 + while test $WAIT -gt 0 ; do + test -z "`pidofproc plpnfsd`" && break; + sleep 1 # allow plpnfsd flushing it's cache + WAIT=`expr $WAIT - 1` + done + test -n "`pidofproc plpnfsd`" && \ + killproc -TERM @prefix@/sbin/plpnfsd + rc_status + fi + if [ "$START_PLPPRINTD" = "yes" ] ; then + killproc -TERM @prefix@/sbin/plpprintd + rc_status + fi + killproc -TERM @prefix@/sbin/ncpd + rc_status -v && rm -f /var/lock/subsys/psion +} + +restart() { + stop + start +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + echo -n "Checking for service psion: " + checkproc @prefix@/sbin/plpnfsd && \ + checkproc @prefix@/sbin/plpprintd && \ + checkproc @prefix@/sbin/ncpd + rc_status -v + ;; + restart|reload) + restart + ;; + condrestart) + test -f /var/lock/subsys/psion && restart || : + ;; + *) + echo "Usage: psion {start|stop|status|restart|reload|condrestart}" + exit 1 +esac + +rc_exit diff --git a/etc/psion.in b/etc/psion.in index 73a6bfb..3c7cf56 100755 --- a/etc/psion.in +++ b/etc/psion.in @@ -10,6 +10,8 @@ [ -f @prefix@/sbin/ncpd ] || exit 0 [ -f @prefix@/sbin/plpnfsd ] || exit 0 +[ -f /etc/sysconfig/psion ] || exit 0 +. /etc/sysconfig/psion MGETTY_HASPLP=false @@ -24,14 +26,22 @@ start() { exit 0 fi echo -n "Starting Psion support (ncpd): " - daemon @prefix@/sbin/ncpd + daemon @prefix@/sbin/ncpd $NCPD_ARGS RETVAL=$? echo if [ $RETVAL -eq 0 ] ; then - echo -n "Starting Psion support (plpnfsd): " - daemon @prefix@/sbin/plpnfsd - RETVAL=$? - echo + if test "$START_PLPNFSD" = "yes" ; then + echo -n "Starting Psion support (plpnfsd): " + daemon @prefix@/sbin/plpnfsd $PLPNFSD_ARGS + RETVAL=$? + echo + fi + if test "$START_PLPPRINTD" = "yes" ; then + echo -n "Starting Psion support (plpprintd): " + daemon @prefix@/sbin/plpprintd $PLPPRINTD_ARGS + RETVAL=$? + echo + fi fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/psion return $RETVAL @@ -39,11 +49,19 @@ start() { stop() { echo -n "Stopping Psion support: " - killproc plpnfsd -HUP - while true ; do - test -z "`pidofproc plpnfsd`" && break; - sleep 1 # allow plpnfsd flushing it's cache - done + if test "$START_PLPNFSD" = "yes" ; then + killproc plpnfsd -HUP + WAIT=5 + while test $WAIT -gt 0 ; do + test -z "`pidofproc plpnfsd`" && break; + sleep 1 # allow plpnfsd flushing it's cache + WAIT=`expr $WAIT - 1` + done + test -n "`pidofproc plpnfsd`" && killproc plpnfsd + fi + if test "$START_PLPPRINTD" = "yes" ; then + killproc plpprintd + fi killproc ncpd RETVAL=$? echo -- cgit v1.2.3