Terminé conversion fcron.d pour tous les packages. Enlevé mailman
[hvlinux.git] / functions
index ea18ae2..89230b9 100644 (file)
--- a/functions
+++ b/functions
@@ -496,23 +496,14 @@ hv_groupadd()
 {
     arguments=${*}
 
-    set +e
-
+    # The last argument is the group name
     while [ $# -ne 0 ]; do
-       last_argument=${*}
+       groupname=${*}
        shift
     done
 
-    groupadd ${arguments}
-    error=$?
-
-    set -e
-
-    if [ ${error} -eq 0 -o ${error} -eq 9 ]; then
-        # 9 means the group already exists
-        return ${EXIT_SUCCESS}
-    else
-        exit ${EXIT_FAILURE}
+    if ! cat /etc/group | egrep "^${groupname}:" 1> /dev/null 2>&1; then
+        groupadd ${arguments}    
     fi
 }
 
@@ -522,7 +513,7 @@ hv_useradd()
 {
     arguments="${*}"
 
-    # The last argument is the username
+    # The last argument is the user name
     while [ $# -ne 0 ]; do
        username=${*}
        shift
@@ -753,23 +744,22 @@ ipkg_display_build_infos()
 #   -l     Unique identification label in 'install.log'
 #          (default is package name and version)
 #   -m     Installation mode:
-#            ac   Standard autoconf package, build in separate dir
-#            acnb Standard autoconf package, building in source dir
-#            nb   No autoconf (configure)
+#            ac   Standard autoconf package, build in separate dir (default)
+#            acnb Standard autoconf package, build in source dir
+#            noac No autoconf (configure)
 #            gnome
 #            xorg
 #            pm
-#   -s     Name of script to execute or name of definition file (default is
-#          to source ipkg.def)
+#   -s     Name of script to source (default is from name of package)
 ipkg()
 {
     START_TIME=$(echo `date +%s`)
 
+    unset ALT_SCRIPT_NAME
     export IPKG_MODE="ac"
     export HVLABEL="" # Global variable
-    local SCRIPT=${DEFAULT_IPKG_SCRIPT}
 
-    while getopts "hl:m:" flag ;do
+    while getopts "hl:m:s:" flag ;do
         case ${flag} in
            l)
                 # Alternate label
@@ -789,13 +779,7 @@ ipkg()
                 ;;
            s)
                 # Alternate script name
-                SCRIPT=${OPTARG}
-
-                # Checking if script is valid and executable
-                if [ ! -x ${SCRIPT} ]; then
-                   echo "${FUNCNAME}(): cannot execute script: ${SCRIPT}"
-                   exit ${EXIT_FAILURE}
-                fi
+                ALT_SCRIPT_NAME=${OPTARG}
                ;;
            ?)
                echo "${FUNCNAME}(): Invalid option: ${OPTARG}."
@@ -834,7 +818,7 @@ ipkg()
         1> /dev/null 2>&1; then
        return $EXIT_SUCCESS
     fi
-    
+
     # Displaying label
     MSGSTRING="Installing ${HVLABEL}"
     display_checkbox_msg ${MSGSTRING}
@@ -853,15 +837,10 @@ ipkg()
     # All output from commands in this block sent to file $PACKAGE_LOG.
     exec > ${PACKAGE_LOG} 2>&1
 
-    if [ "x${SCRIPT}" = "x${DEFAULT_IPKG_SCRIPT}" ]; then
-        # Executing standard ac script.
-        source ${SCRDIR}/../functions-ac
-        source ${SCRDIR}/${DEFAULT_IPKG_SCRIPT}
-        ipkg_script
-    else
-        # Executing custom script.
-        ${SCRIPT} ${PACKAGE} ${CONFIGURE_OPTS}
-    fi
+    # Sourcing standard ac script.
+    source ${SCRDIR}/../functions-ipkg
+    source ${SCRDIR}/${DEFAULT_IPKG_SCRIPT}
+    ipkg_script ${ALT_SCRIPT_NAME}
 
     # Make sure we are at a known location
     cd ${SCRDIR}