Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for startup on HPUX #2275

Closed
michaelrsweet opened this issue Mar 6, 2007 · 6 comments
Closed

Fixes for startup on HPUX #2275

michaelrsweet opened this issue Mar 6, 2007 · 6 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: krumboeck

Hello!

The boot concept of HPUX is a bit different from the linux (and other *nix) one:

*) boot numbers have 3 digits instead of 2
*) if you start into runlevel 3 all scripts in /sbin/rc1.d, /sbin/rc2.d and /sbin/rc3.d will be started
*) if you start script is in /sbin/rc2.d then your stop script should be in /sbin/rc1.d
*) start scripts should contain the sections start_msg and stop_msg
*) /usr/bin is not in the search path during startup
*) some services use dynamic port reservation beyond 1024, so it is a good idea to start cups before this services (still waiting for an answer from HP)

The patch cups-1.2.8-hpuxstart is not fully tested, because I have no
installed autoconf. (used hard coded value for @ps@ during tests)

best regards!
Bernd

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

OK, we can't accept the patch as-is, mainly because it is a maintenance nightmare.

I'll look into abstracting the run level stuff in the configure script so that the makefile and packaging files can share it.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: krumboeck

Thanks for you efforts! ;)

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

I've attached the changes I've made to support HP-UX (and other OS) run levels and start/stop numbers.

@michaelrsweet
Copy link
Collaborator Author

"cups-1.2.8-hpuxstart.patch":

*** config-scripts/cups-common.m4.old Fri Mar 2 09:15:22 2007
--- config-scripts/cups-common.m4 Fri Mar 2 09:15:37 2007


*** 63,68 ****
--- 63,69 ----
AC_PATH_PROG(RMDIR,rmdir)
AC_PATH_PROG(SED,sed)
AC_PATH_PROG(STRIP,strip)

  • AC_PATH_PROG(PS,ps)

    if test "x$AR" = x; then
    AC_MSG_ERROR([Unable to find required library archive command.])
    *** init/cups.sh.in.old Fri Mar 2 09:16:03 2007
    --- init/cups.sh.in Fri Mar 2 09:16:54 2007


    *** 141,147 ****

    case "uname" in
    HP-UX* | AIX* | SINIX_)
    ! pid=ps -e | awk '{if (match($4, "._/cupsd$") || $4 == "cupsd") print $1}'
    ;;
    IRIX* | SunOS*)
    pid=ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'
    --- 141,147 ----

    case "uname" in
    HP-UX* | AIX* | SINIX_)
    ! pid=@PS@ -e | awk '{if (match($4, "._/cupsd$") || $4 == "cupsd") print $1}'
    ;;
    IRIX* | SunOS*)
    pid=ps -e | nawk '{if (match($4, ".*/cupsd$") || $4 == "cupsd") print $1}'


    *** 166,171 ****
    --- 166,176 ----

    case $1 in

  • start_msg)

  •   echo "Starting CUPS Server"
    
  •   ;;
    
  • start | restart | reload)
    if $IS_ON cups; then
    if test "$pid" != ""; then


    *** 183,188 ****
    --- 188,197 ----
    $ECHO_OK
    $ECHO "cups: ${1}ed scheduler."
    fi

  •   ;;
    
  • stop_msg)

  •   echo "Stopping CUPS Server"
    ;;
    

    stop)

@michaelrsweet
Copy link
Collaborator Author

"cups-1.2.8-runlevel.patch":

*** Makefile.old Fri Mar 2 08:40:33 2007
--- Makefile Fri Mar 2 08:59:26 2007


** 103,116 ****
echo Installing init scripts...;
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d;
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups;
fi
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR);
--- 103,126 ----
echo Installing init scripts...;
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d;
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups;
! case uname in
! HP-UX
)
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc1.d;
! $(LN) $(INITDIR)/init.d/cups $(BUILDROOT)$(INITDIR)/rc1.d/K620cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d;
! $(LN) $(INITDIR)/init.d/cups $(BUILDROOT)$(INITDIR)/rc2.d/S380cups;
! ;;
! *)
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups;
! $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d;
! $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups;
! ;;
! esac
fi
if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then
$(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \

@michaelrsweet
Copy link
Collaborator Author

"str2275.patch":

Index: packaging/cups.list.in

--- packaging/cups.list.in (revision 6330)
+++ packaging/cups.list.in (working copy)
@@ -635,7 +635,7 @@
%subpackage

%system !darwin
-i 0755 root sys cups init/cups.sh
+i 0755 root sys cups init/cups.sh start(@rcstart@) stop(@RCstop) runlevels(@RCLEVELS@)
%subpackage lpd
%if XINETD
f 0644 root sys $XINETD/cups-lpd init/cups-lpd

Index: Makedefs.in

--- Makedefs.in (revision 6330)
+++ Makedefs.in (working copy)
@@ -218,6 +218,9 @@
MANDIR = $(BUILDROOT)@mandir@
MENUDIR = @MENUDIR@
PMANDIR = $(BUILDROOT)@PMANDIR@
+RCLEVELS = @RCLEVELS@
+RCSTART = @rcstart@
+RCSTOP = @RCstop@
REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
SBINDIR = $(BUILDROOT)@sbindir@
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@

Index: config-scripts/cups-directories.m4

--- config-scripts/cups-directories.m4 (revision 6330)
+++ config-scripts/cups-directories.m4 (working copy)
@@ -123,24 +123,24 @@

dnl Setup init.d locations...
AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
+AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
+AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="99")
+AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="00")

+INITDIR=""
+INITDDIR=""
+RCLEVELS="$rclevels"
+RCSTART="$rcstart"
+RCSTOP="$rcstop"
+
if test x$rcdir = x; then
case "$uname" in

  •   FreeBSD\* | OpenBSD\* | MirBsD\* | ekkoBSD*)
    
  •       # FreeBSD and OpenBSD
    
  •       INITDIR=""
    
  •       INITDDIR=""
    
  •   AIX*)
    
  •       INITDIR="/etc/rc.d"
        ;;
    
  •   NetBSD*)
    
  •       # NetBSD
    
  •       INITDIR=""
    
  •       INITDDIR="/etc/rc.d"
    

- ;;

    Darwin*)
        # Darwin and MacOS X...
  •       INITDIR=""
        if test -x /sbin/launchd; then
            INITDDIR="/System/Library/LaunchDaemons"
        else 
    

    @@ -148,48 +148,75 @@
    fi
    ;;

  •   FreeBSD* | OpenBSD* | MirBsD* | ekkoBSD*)
    
  •       # FreeBSD and OpenBSD
    
  •       ;;
    
  •   HP-UX*)
    
  •       INITDIR="/sbin"
    
  •       RCLEVELS="2"
    
  •       RCSTART="620"
    
  •       RCSTOP="380"
    
  •       ;;
    
  •   IRIX*)
    
  •       # IRIX
    
  •       INITDIR="/etc"
    
  •       RCSTART="60"
    
  •       RCSTOP="25"
    
  •       ;;
    
    • Linux | GNU)
      # Linux/HURD seems to choose an init.d directory at random...
      if test -d /sbin/init.d; then
      # SuSE
      INITDIR="/sbin/init.d"
  •           INITDDIR=".."
        else
            if test -d /etc/init.d; then
                # Others
                INITDIR="/etc"
    
  •               INITDDIR="../init.d"
            else
                # RedHat
                INITDIR="/etc/rc.d"
    
  •               INITDDIR="../init.d"
            fi
        fi
    
  •       RCSTART="81"
    
  •       RCSTOP="36"
        ;;
    
  •   OSF1* | HP-UX*)
    
  •   NetBSD*)
    
  •       # NetBSD
    
  •       INITDDIR="/etc/rc.d"
    
  •       ;;
    
  •   OSF1*)
        INITDIR="/sbin"
    
  •       INITDDIR="../init.d"
        ;;
    
  •   AIX*)
    
  •       INITDIR="/etc/rc.d"
    
  •       INITDDIR=".."
    
  •   SunOS*)
    
  •       # Solaris
    
  •       INITDIR="/etc"
    
  •       RCSTART="81"
        ;;
    
    *)
        INITDIR="/etc"
    
  •       INITDDIR="../init.d"
        ;;
    

    esac
    else

  • INITDIR=""

  • INITDDIR="$rcdir"

  • if test "x$rclevels" = x; then

  •   INITDDIR="$rcdir"
    
  • else

  •   INITDIR="$rcdir"
    
  • fi
    fi

AC_SUBST(INITDIR)
AC_SUBST(INITDDIR)
+AC_SUBST(RCLEVELS)
+AC_SUBST(RCSTART)
+AC_SUBST(RCSTOP)

dnl Xinetd support...
AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],XINETD="$withval",XINETD="")

Index: Makefile

--- Makefile (revision 6330)
+++ Makefile (working copy)
@@ -104,14 +104,17 @@
echo Installing init scripts...;
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d;
$(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \

  •   for level in $(RCLEVELS); do \
    
  •       $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
    
  •       $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
    
  •       if test `uname` = HP-UX; then \
    
  •           level=`expr $$level - 1`; \
    
  •           $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
    
  •       fi; \
    
  •       $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
    
  •   done; \
    $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
    
  •   $(INSTALL_SCRIPT) init/cups.sh  $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \
    
  •   $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc2.d; \
    
  •   $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \
    
  •   $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc3.d; \
    
  •   $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \
    
  •   $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc5.d; \
    
  •   $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \
    
  •   $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
    

    fi
    if test "x$(INITDIR)" = x -a "x$(INITDDIR)" != x; then
    $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \

    Index: init/cups.sh.in

    --- init/cups.sh.in (revision 6330)
    +++ init/cups.sh.in (working copy)
    @@ -4,7 +4,7 @@

    Startup/shutdown script for the Common UNIX Printing System (CUPS).

    -# Copyright 1997-2005 by Easy Software Products, all rights reserved.
    +# Copyright 1997-2007 by Easy Software Products, all rights reserved.

    These coded instructions, statements, and computer programs are the

    property of Easy Software Products and are protected by Federal

    @@ -136,6 +136,20 @@

    +# Make sure we have the standard program directories in the path
    +# since some operating systems (this means YOU HP-UX!) don't
    +# provide a standard path on boot-up...
    +#
    +
    +if "x$PATH" = x; then

  • PATH="/bin:/usr/bin:/sbin:/usr/sbin"
    +else

  • PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
    +fi

+export PATH
+
+#

See if the CUPS server (cupsd) is running...

@@ -201,6 +215,16 @@
fi
;;

  • start_msg)
  •   # HP-UX non-standard...
    
  •   echo "Starting CUPS Server"
    
  •   ;;
    
  • stop_msg)
  •   # HP-UX non-standard...
    
  •   echo "Starting CUPS Server"
    
  •   ;;
    
    *)
    echo "Usage: cups {reload|restart|start|status|stop}"
    exit 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant