Erich,
        Thanks for reporting the non-compliances in cryptmount's init-script,
and for your helpful patch. I've incorporated your patch and tried to
make the script more LSB compliant in its support for the 'status'
argument and in its return-codes.

        Before I issue a revised version of the cryptmount Debian
package, I'd be very grateful if you had any comments on the attached
version of the script.

        As regards your nautilus/pmount question, I'm afraid I don't use
either of these, so I'm afraid I can't offer you any quick answers there.

                Thanks,
                        Richard

+--   on Tue, Aug 29, 2006 at 03:23:25PM +0200, Erich Schubert wrote:   ---+
> Package: cryptmount
> Version: 1.1-1
> Severity: serious
> Tags: patch
> Justification: Policy 10.4
> 
> /etc/init.d/cryptmount: 16: source: not found
> /etc/init.d/cryptmount: 19: Syntax error: "(" unexpected
> 
> Please use POSIX shell (s/source/./; s/^function //;) or specify
> /bin/bash as interpreter. A patch to fix the init script is attached;
> but I didn't check the other scripts for similar problems.
> 
> Maybe you could make the init-script LSB compliant, too.
> 
> Btw, do you have a hint for me on how to have nautilus/pmount ask for
> the luks passphrase with a graphical prompt?
> 
> -- System Information:
> Debian Release: testing/unstable
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (1, 'experimental')
> Architecture: i386 (i686)
> Shell:  /bin/sh linked to /bin/dash
> Kernel: Linux 2.6.17.7
> Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)
> 
> Versions of packages cryptmount depends on:
> ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
> ii  libdevmapper1.02 [libdevmapp 2:1.02.08-1 The Linux Kernel Device Mapper 
> use
> ii  libssl0.9.8                  0.9.8b-2    SSL shared libraries
> ii  openssl                      0.9.8b-2    Secure Socket Layer (SSL) binary 
> a
> 
> Versions of packages cryptmount recommends:
> ii  dmsetup                      2:1.02.08-1 The Linux Kernel Device Mapper 
> use
> 
> -- no debconf information

> --- /tmp/cryptmount   2006-08-29 15:17:51.000000000 +0200
> +++ /etc/init.d/cryptmount    2006-08-29 15:18:21.000000000 +0200
> @@ -12,11 +12,11 @@
>  
>  test -x "${CM_EXE}" || exit 0
>  if [ -f /etc/default/cryptmount ]; then
> -    source /etc/default/cryptmount
> +    . /etc/default/cryptmount
>  fi
>  
>  
> -function configured() {
> +configured() {
>      # check if any of the targets needed at boot has been configured:
>      for target in ${CM_BOOTDV} ${CM_BOOTFS} ${CM_BOOTSW}; do
>          if [ -b "${DMPATH}/${target}" ]; then
> @@ -28,7 +28,7 @@
>  }
>  
>  
> -function dodevices() {
> +dodevices() {
>      case "$1" in
>          start)  test -z "${CM_BOOTDV}" || ${CM_EXE} --prepare ${CM_BOOTDV}
>              ;;
> @@ -38,7 +38,7 @@
>  }
>  
>  
> -function doswaps() {
> +doswaps() {
>      case "$1" in
>          start)  test -z "${CM_BOOTSW}" || ${CM_EXE} --swapon ${CM_BOOTSW}
>              ;;
> @@ -48,7 +48,7 @@
>  }
>  
>  
> -function dofilesys() {
> +dofilesys() {
>      case "$1" in
>          start)  test -z "${CM_BOOTFS}" || ${CM_EXE} --mount ${CM_BOOTFS}
>              ;;
> @@ -58,7 +58,7 @@
>  }
>  
>  
> -function doALL() {
> +doALL() {
>      case "$1" in
>          start)
>              dodevices start

#!/bin/sh
# boot-time init script for cryptmount
# $Revision: 119 $, $Date: 2006-08-14 17:05:02 +0100 (Mon, 14 Aug 2006) $
# RW Penney, August 2006

CM_EXE=/usr/bin/cryptmount
DMPATH=/dev/mapper

CM_BOOTDV=""
CM_BOOTSW=""
CM_BOOTFS=""

test -x "${CM_EXE}" || exit 5
if [ -f /etc/default/cryptmount ]; then
    . /etc/default/cryptmount
fi


configured() {
    # check if any of the targets needed at boot has been configured:
    for target in ${CM_BOOTDV} ${CM_BOOTFS} ${CM_BOOTSW}; do
        if [ -b "${DMPATH}/${target}" ]; then
            true
            return
        fi
    done
    false
}


dodevices() {
    case "$1" in
        start)  test -z "${CM_BOOTDV}" || ${CM_EXE} --prepare ${CM_BOOTDV}
            ;;
        stop)   test -z "${CM_BOOTDV}" || ${CM_EXE} --release ${CM_BOOTDV}
            ;;
    esac
}


doswaps() {
    case "$1" in
        start)  test -z "${CM_BOOTSW}" || ${CM_EXE} --swapon ${CM_BOOTSW}
            ;;
        stop)   test -z "${CM_BOOTSW}" || ${CM_EXE} --swapoff ${CM_BOOTSW}
            ;;
    esac
}


dofilesys() {
    case "$1" in
        start)  test -z "${CM_BOOTFS}" || ${CM_EXE} --mount ${CM_BOOTFS}
            ;;
        stop)   test -z "${CM_BOOTFS}" || ${CM_EXE} --unmount ${CM_BOOTFS}
            ;;
    esac
}


doALL() {
    case "$1" in
        start)
            dodevices start
            doswaps start
            dofilesys start
            ;;
        stop)
            dofilesys stop
            doswaps stop
            dodevices stop
            ;;
    esac
}


case "$1" in
    start)
        if configured; then
            echo "cryptmount auto-filesystems seem to be already configured"
        else
            echo "Starting cryptmount targets (hit shift/ctrl if short of 
entropy):"
            doALL start
        fi
        ;;
    stop)
        if configured; then
            echo "Stopping cryptmount targets:"
            doALL stop
        fi
        ;;
    restart)
        if configured; then
            doALL stop
        fi
        doALL start
        ;;
    force-reload|reload)
        # nothing to do
        ;;
    status)
        if configured; then
            echo "cryptmount auto-filesystems are in use"
        else
            echo "cryptmount auto-filesystems do not appear to be in use"
            exit 3
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/cryptmount " \
            " {start|stop|restart|reload|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0
Index: initscript
===================================================================
--- initscript  (revision 119)
+++ initscript  (working copy)
@@ -10,13 +10,13 @@
 CM_BOOTSW=""
 CM_BOOTFS=""
 
-test -x "${CM_EXE}" || exit 0
+test -x "${CM_EXE}" || exit 5
 if [ -f /etc/default/cryptmount ]; then
-    source /etc/default/cryptmount
+    . /etc/default/cryptmount
 fi
 
 
-function configured() {
+configured() {
     # check if any of the targets needed at boot has been configured:
     for target in ${CM_BOOTDV} ${CM_BOOTFS} ${CM_BOOTSW}; do
         if [ -b "${DMPATH}/${target}" ]; then
@@ -28,7 +28,7 @@
 }
 
 
-function dodevices() {
+dodevices() {
     case "$1" in
         start)  test -z "${CM_BOOTDV}" || ${CM_EXE} --prepare ${CM_BOOTDV}
             ;;
@@ -38,7 +38,7 @@
 }
 
 
-function doswaps() {
+doswaps() {
     case "$1" in
         start)  test -z "${CM_BOOTSW}" || ${CM_EXE} --swapon ${CM_BOOTSW}
             ;;
@@ -48,7 +48,7 @@
 }
 
 
-function dofilesys() {
+dofilesys() {
     case "$1" in
         start)  test -z "${CM_BOOTFS}" || ${CM_EXE} --mount ${CM_BOOTFS}
             ;;
@@ -58,7 +58,7 @@
 }
 
 
-function doALL() {
+doALL() {
     case "$1" in
         start)
             dodevices start
@@ -77,8 +77,7 @@
 case "$1" in
     start)
         if configured; then
-            echo "cryptmount filing systems seem to be already configured"
-            exit 1
+            echo "cryptmount auto-filesystems seem to be already configured"
         else
             echo "Starting cryptmount targets (hit shift/ctrl if short of 
entropy):"
             doALL start
@@ -99,9 +98,17 @@
     force-reload|reload)
         # nothing to do
         ;;
+    status)
+        if configured; then
+            echo "cryptmount auto-filesystems are in use"
+        else
+            echo "cryptmount auto-filesystems do not appear to be in use"
+            exit 3
+        fi
+        ;;
     *)
         echo "Usage: /etc/init.d/cryptmount " \
-            " {start|stop|restart|reload|force-reload}" >&2
+            " {start|stop|restart|reload|force-reload|status}" >&2
         exit 1
         ;;
 esac

Reply via email to