[Usbmount-commit] r51 - usbmount/trunk

Rogério Brito rbrito-guest at alioth.debian.org
Fri Jul 31 18:15:14 UTC 2009


Author: rbrito-guest
Date: 2009-07-31 18:15:14 +0000 (Fri, 31 Jul 2009)
New Revision: 51

Modified:
   usbmount/trunk/usbmount
Log:
Create what can be a future rewrite of usbmount.


Modified: usbmount/trunk/usbmount
===================================================================
--- usbmount/trunk/usbmount	2009-07-31 16:33:30 UTC (rev 50)
+++ usbmount/trunk/usbmount	2009-07-31 18:15:14 UTC (rev 51)
@@ -16,8 +16,13 @@
 set -e
 exec > /dev/null 2>&1
 
+######################################################################
+# Auxiliary functions 
 
 # Log a string via the syslog facility.
+# Parameters:
+#  * the level of the message.
+#  * the message.
 log()
 {
     if test $1 != debug || expr "$VERBOSE" : "[yY]" > /dev/null; then
@@ -25,7 +30,6 @@
     fi
 }
 
-
 # Test if the first parameter is in the list given by the second
 # parameter.
 in_list()
@@ -36,10 +40,48 @@
     return 1
 }
 
+# # Check if usbmount should be run.
+# check_if_usbmount_is_enabled()
+# {
+#     if [ "${ENABLED:-1}" -eq "0" ]; then
+# 	log info "usbmount is disabled, see /etc/usbmount/usbmount.conf"
+# 	exit 0
+#     fi
+# }
 
-# Test if /lib/udev/vol_id is executable.
-test -x /lib/udev/vol_id || { log err "cannot execute /lib/udev/vol_id"; exit 1; }
+# # Test if /lib/udev/vol_id is executable.
+# check_if_vol_id_is_usable()
+# {
+#     if [ ! -x /lib/udev/vol_id ]; then
+# 	log err "cannot execute /lib/udev/vol_id"
+# 	exit 1
+#     fi
+# }
 
+# # Read configuration file.
+# read_configuration_file()
+# {
+#     if [ -r /etc/usbmount/usbmount.conf ]; then
+# 	. /etc/usbmount/usbmount.conf
+# 	log debug "loaded usbmount configurations"
+#     fi
+# }
+
+# # Create /var/run/usbmount.
+# # Per Debian Policy 9.3.2, directories under /var/run/usbmount have
+# # to be checked after every reboot.
+# create_var_run_usbmount()
+# {
+#     if [ ! -e /var/run/usbmount ]; then
+# 	mkdir -p /var/run/usbmount
+# 	log debug "creating /var/run/usbmount directory"
+#     fi
+# }
+
+
+######################################################################
+# Main program
+
 # Default values for configuration variables.
 ENABLED=1
 MOUNTPOINTS=""
@@ -48,21 +90,33 @@
 FS_MOUNTOPTIONS=""
 VERBOSE="no"
 
-# Read configuration file.
-if test -r /etc/usbmount/usbmount.conf; then
+if [ -r /etc/usbmount/usbmount.conf ]; then
     . /etc/usbmount/usbmount.conf
+    log debug "loaded usbmount configurations"
 fi
 
-# Check if usbmount should be run.
 if [ "${ENABLED:-1}" -eq "0" ]; then
     log info "usbmount is disabled, see /etc/usbmount/usbmount.conf"
     exit 0
 fi
 
-# Per Policy 9.3.2, directories under /var/run/usbmount have to be checked
-# after every reboot.
-test -e /var/run/usbmount || mkdir /var/run/usbmount
+if [ ! -x /lib/udev/vol_id ]; then
+    log err "cannot execute /lib/udev/vol_id"
+    exit 1
+fi
 
+if [ ! -e /var/run/usbmount ]; then
+    mkdir -p /var/run/usbmount
+    log debug "creating /var/run/usbmount directory"
+fi
+
+
+#read_configuration_file
+#check_if_enabled
+#check_if_vol_id_is_usable
+#create_var_run_usbmount
+#log debug "finishing usbmount configuration"
+
 umask 022
 
 if test "$1" = add; then




More information about the Usbmount-commit mailing list