[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6188-g3b8e7e0
Stephen Gran
steve at lobefin.net
Sat Apr 17 16:45:08 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit a3b27cee33de28bb9f3cd8e2bfb305a81f3e190a
Author: Stephen Gran <steve at lobefin.net>
Date: Sat Apr 17 17:18:50 2010 +0100
introduce common debconf wrapper functions and use the in config scripts
Signed-off-by: Stephen Gran <steve at lobefin.net>
diff --git a/debian/clamav-base.config.in b/debian/clamav-base.config.in
index e8e34b1..11963e5 100644
--- a/debian/clamav-base.config.in
+++ b/debian/clamav-base.config.in
@@ -102,38 +102,6 @@ if [ -n "$BytecodeTimeout" ]; then
db_set clamav-base/BytecodeTimeout "$BytecodeTimeout" || true
fi
-# Functions
-
-isdigit ()
-{
- case $1 in
- [[:digit:]]*)
- ISDIGIT=1
- ;;
- *)
- ISDIGIT=0
- ;;
- esac
-}
-
-inputdigit ()
-{
- ISDIGIT=0
- while [ "$ISDIGIT" = '0' ]; do
- db_input "$1" "$2" || true
- if ! db_go; then
- return 30
- fi
- db_get $2 || true
- isdigit $RET
- if [ "$ISDIGIT" = '0' ]; then
- db_input critical clamav-base/numinfo || true
- db_go
- fi
- done
- return 0
-}
-
# States
StateDebconf()
@@ -162,16 +130,6 @@ StateSocket()
fi
}
-StateUNIX()
-{
- db_input low clamav-base/LocalSocket || true
- if db_go; then
- STATE="LocalSocketGroup"
- else
- STATE="Socket"
- fi
-}
-
StateLocalSocketGroup()
{
db_input low clamav-base/LocalSocketGroup || true
@@ -186,45 +144,6 @@ StateLocalSocketGroup()
fi
}
-StateLocalSocketMode()
-{
- if inputdigit low clamav-base/LocalSocketMode ; then
- STATE="FixStale"
- else
- STATE="LocalSocketGroup"
- fi
-}
-
-StateFixStale()
-{
- db_input low clamav-base/FixStaleSocket || true
- if db_go; then
- STATE="ScanMail"
- else
- STATE="LocalSocketMode"
- fi
-}
-
-
-StateTCP()
-{
- if inputdigit low clamav-base/TCPSocket; then
- STATE="TCPAddr"
- else
- STATE="Socket"
- fi
-}
-
-StateTCPAddr()
-{
- db_input low clamav-base/TCPAddr || true
- if db_go; then
- STATE="ScanMail"
- else
- STATE="TCP"
- fi
-}
-
StateScanMail()
{
db_input medium clamav-base/ScanMail || true
@@ -255,15 +174,6 @@ StateScanArchive()
fi
}
-StateStreamMaxLength()
-{
- if inputdigit low clamav-base/StreamMaxLength; then
- STATE="MaxDirectoryRecursion"
- else
- STATE="ScanArchive"
- fi
-}
-
StateMaxDirectoryRecursion()
{
if inputdigit low clamav-base/MaxDirectoryRecursion; then
@@ -278,16 +188,6 @@ StateMaxDirectoryRecursion()
fi
}
-StateFollowDirectorySymlinks()
-{
- db_input low clamav-base/FollowDirectorySymlinks || true
- if db_go; then
- STATE="FollowFileSymlinks"
- else
- STATE="MaxDirectoryRecursion"
- fi
-}
-
StateFollowFileSymlinks()
{
db_input low clamav-base/FollowFileSymlinks || true
@@ -303,43 +203,6 @@ StateFollowFileSymlinks()
fi
}
-StateReadTimeout()
-{
- if inputdigit low clamav-base/ReadTimeout; then
- STATE="MaxThreads"
- else
- STATE="FollowFileSymlinks"
- fi
-}
-
-StateMaxThreads()
-{
- if inputdigit low clamav-base/MaxThreads; then
- STATE="MaxConnectionQueueLength"
- else
- STATE="ReadTimeout"
- fi
-}
-
-StateMaxConnectionQueueLength()
-{
- if inputdigit low clamav-base/MaxConnectionQueueLength; then
- STATE="LogSyslog"
- else
- STATE="MaxThreads"
- fi
-}
-
-StateLogSyslog()
-{
- db_input medium clamav-base/LogSyslog || true
- if db_go; then
- STATE="LogFile"
- else
- STATE="MaxConnectionQueueLength"
- fi
-}
-
StateLogFile()
{
db_input low clamav-base/LogFile || true
@@ -356,26 +219,6 @@ StateLogFile()
fi
}
-StateLogTime()
-{
- db_input low clamav-base/LogTime || true
- if db_go; then
- STATE="SelfCheck"
- else
- STATE="LogFile"
- fi
-}
-
-StateSelfCheck()
-{
- db_input low clamav-base/SelfCheck || true
- if db_go; then
- STATE="User"
- else
- STATE="LogTime"
- fi
-}
-
StateUser()
{
db_input medium clamav-base/User || true
@@ -390,16 +233,6 @@ StateUser()
fi
}
-StateAddGroups()
-{
- db_input medium clamav-base/AddGroups || true
- if db_go; then
- STATE="Bytecode"
- else
- STATE="User"
- fi
-}
-
StateBytecode()
{
db_input low clamav-base/Bytecode || true
@@ -415,25 +248,6 @@ StateBytecode()
fi
}
-StateBytecodeSecurity()
-{
- db_input low clamav-base/BytecodeSecurity || true
- if db_go; then
- STATE="BytecodeTimeout"
- else
- STATE="Bytecode"
- fi
-}
-
-StateBytecodeTimeout()
-{
- if inputdigit low clamav-base/BytecodeTimeout ; then
- STATE="End"
- else
- STATE="BytecodeSecurity"
- fi
-}
-
# To many options to configure at configure
if [ "$1" = "reconfigure" ]; then
STATE="Init"
@@ -458,23 +272,23 @@ while [ "$STATE" != "End" ]; do
"Socket")
StateSocket
;;
- "FixStale")
- StateFixStale
- ;;
"TCP")
- StateTCP
+ StateGenericDigit low clamav-base/TCPSocket TCPAddr Socket
;;
"TCPAddr")
- StateTCPAddr
+ StateGeneric low clamav-base/TCPAddr ScanMail TCP
;;
"UNIX")
- StateUNIX
+ StateGeneric low clamav-base/LocalSocket LocalSocketGroup Socket
;;
"LocalSocketGroup")
StateLocalSocketGroup
;;
"LocalSocketMode")
- StateLocalSocketMode
+ StateGenericDigit low clamav-base/LocalSocketMode FixStale LocalSocketGroup
+ ;;
+ "FixStale")
+ StateGeneric low clamav-base/FixStaleSocket ScanMail LocalSocketMode
;;
"ScanMail")
StateScanMail
@@ -483,52 +297,52 @@ while [ "$STATE" != "End" ]; do
StateScanArchive
;;
"StreamMaxLength")
- StateStreamMaxLength
+ StateGenericDigit low clamav-base/StreamMaxLength MaxDirectoryRecursion ScanArchive
;;
"MaxDirectoryRecursion")
StateMaxDirectoryRecursion
;;
"FollowDirectorySymlinks")
- StateFollowDirectorySymlinks
+ StateGeneric low clamav-base/FollowDirectorySymlinks FollowFileSymlinks MaxDirectoryRecursion
;;
"FollowFileSymlinks")
StateFollowFileSymlinks
;;
"ReadTimeout")
- StateReadTimeout
+ StateGenericDigit low clamav-base/ReadTimeout MaxThreads FollowFileSymlinks
;;
"MaxThreads")
- StateMaxThreads
+ StateGenericDigit low clamav-base/MaxThreads MaxConnectionQueueLength ReadTimeout
;;
"MaxConnectionQueueLength")
- StateMaxConnectionQueueLength
+ StateGenericDigit low clamav-base/MaxConnectionQueueLength LogSyslog MaxThreads
;;
"LogSyslog")
- StateLogSyslog
+ StateGeneric medium clamav-base/LogSyslog LogFile MaxConnectionQueueLength
;;
"LogFile")
StateLogFile
;;
"LogTime")
- StateLogTime
+ StateGeneric low clamav-base/LogTime SelfCheck LogFile
;;
"SelfCheck")
- StateSelfCheck
+ StateGeneric low clamav-base/SelfCheck User LogTime
+ ;;
+ "User")
+ StateUser
+ ;;
+ "AddGroups")
+ StateGeneric medium clamav-base/AddGroups Bytecode User
;;
"Bytecode")
StateBytecode
;;
"BytecodeSecurity")
- StateBytecodeSecurity
+ StateGeneric low clamav-base/BytecodeSecurity BytecodeTimeout Bytecode
;;
"BytecodeTimeout")
- StateBytecodeTimeout
- ;;
- "User")
- StateUser
- ;;
- "AddGroups")
- StateAddGroups
+ StateGenericDigit low clamav-base/BytecodeTimeout End BytecodeSecurity
;;
esac
done
diff --git a/debian/clamav-freshclam.config.in b/debian/clamav-freshclam.config.in
index 046c50a..5437ef8 100644
--- a/debian/clamav-freshclam.config.in
+++ b/debian/clamav-freshclam.config.in
@@ -74,16 +74,6 @@ Stateautoupdate_freshclam()
fi
}
-Stateinternet_interface()
-{
- db_input high clamav-freshclam/internet_interface || true
- if db_go; then
- STATE="local_mirror"
- else
- STATE="autoupdate_freshclam"
- fi
-}
-
Statelocal_mirror()
{
db_input medium clamav-freshclam/local_mirror || true
@@ -114,16 +104,6 @@ Statehttp_proxy()
fi
}
-Stateproxy_user()
-{
- db_input medium clamav-freshclam/proxy_user || true
- if ! db_go; then
- STATE="http_proxy"
- else
- STATE="update_interval"
- fi
-}
-
Stateupdate_interval()
{
db_input low clamav-freshclam/update_interval || true
@@ -138,16 +118,6 @@ Stateupdate_interval()
fi
}
-Statenotify_daemon()
-{
- db_input medium clamav-freshclam/NotifyClamd || true
- if ! db_go; then
- STATE="update_interval"
- else
- STATE="End"
- fi
-}
-
# This is the statemachine that controls execution. All the 'real' work is
# performed by subfunctions above.
@@ -167,16 +137,16 @@ while [ "$STATE" != "End" ]; do
Statehttp_proxy
;;
proxy_user)
- Stateproxy_user
+ StateGeneric medium clamav-freshclam/proxy_user http_proxy update_interval
;;
internet_interface)
- Stateinternet_interface
+ StateGeneric high clamav-freshclam/internet_interface local_mirror autoupdate_freshclam
;;
update_interval)
Stateupdate_interval
;;
notify_daemon)
- Statenotify_daemon
+ StateGeneric medium clamav-freshclam/NotifyClamd update_interval End
;;
esac
done
diff --git a/debian/clamav-milter.config.in b/debian/clamav-milter.config.in
index 6b0c561..af03e51 100644
--- a/debian/clamav-milter.config.in
+++ b/debian/clamav-milter.config.in
@@ -139,38 +139,6 @@ else
fi
db_set clamav-milter/MaxFileSize "$MaxFileSize" || true
-# Functions
-
-isdigit ()
-{
- case $1 in
- [[:digit:]]*)
- ISDIGIT=1
- ;;
- *)
- ISDIGIT=0
- ;;
- esac
-}
-
-inputdigit ()
-{
- ISDIGIT=0
- while [ "$ISDIGIT" = '0' ]; do
- db_input "$1" "$2" || true
- if ! db_go; then
- return 30
- fi
- db_get $2 || true
- isdigit $RET
- if [ "$ISDIGIT" = '0' ]; then
- db_input critical clamav-base/numinfo || true
- db_go
- fi
- done
- return 0
-}
-
# States
StateDebconf()
@@ -202,26 +170,6 @@ StateUser()
fi
}
-StateAddGroups()
-{
- db_input medium clamav-milter/AddGroups || true
- if db_go; then
- STATE="MilterSocket"
- else
- STATE="User"
- fi
-}
-
-StateMilterSocket()
-{
- db_input low clamav-milter/MilterSocket || true
- if db_go; then
- STATE="MilterSocketGroup"
- else
- STATE="AddGroups"
- fi
-}
-
StateMilterSocketGroup()
{
db_input low clamav-milter/MilterSocketGroup || true
@@ -236,144 +184,6 @@ StateMilterSocketGroup()
fi
}
-StateMilterSocketMode()
-{
- if inputdigit low clamav-milter/MilterSocketMode ; then
- STATE="FixStaleSocket"
- else
- STATE="MilterSocketGroup"
- fi
-}
-
-StateFixStaleSocket()
-{
- db_input low clamav-milter/FixStaleSocket || true
- if db_go; then
- STATE="ReadTimeout"
- else
- STATE="MilterSocketMode"
- fi
-}
-
-StateReadTimeout()
-{
- if inputdigit low clamav-milter/ReadTimeout ; then
- STATE="Foreground"
- else
- STATE="User"
- fi
-}
-
-StateForeground()
-{
- db_input low clamav-milter/Foreground || true
- if db_go; then
- STATE="Chroot"
- else
- STATE="ReadTimeout"
- fi
-}
-
-StateChroot()
-{
- db_input low clamav-milter/Chroot || true
- if db_go; then
- STATE="PidFile"
- else
- STATE="Foreground"
- fi
-}
-
-StatePidFile()
-{
- db_input low clamav-milter/PidFile || true
- if db_go; then
- STATE="TemporaryDirectory"
- else
- STATE="Chroot"
- fi
-}
-
-StateTemporaryDirectory()
-{
- db_input low clamav-milter/TemporaryDirectory || true
- if db_go; then
- STATE="ClamdSocket"
- else
- STATE="PidFile"
- fi
-}
-
-StateClamdSocket()
-{
- db_input low clamav-milter/ClamdSocket || true
- if db_go; then
- STATE="LocalNet"
- else
- STATE="TemporaryDirectory"
- fi
-}
-
-StateLocalNet()
-{
- db_input low clamav-milter/LocalNet || true
- if db_go; then
- STATE="Whitelist"
- else
- STATE="ClamdSocket"
- fi
-}
-
-StateWhitelist()
-{
- db_input low clamav-milter/Whitelist || true
- if db_go; then
- STATE="OnInfected"
- else
- STATE="LocalNet"
- fi
-}
-
-StateOnInfected()
-{
- db_input low clamav-milter/OnInfected || true
- if db_go; then
- STATE="OnFail"
- else
- STATE="Whitelist"
- fi
-}
-
-StateOnFail()
-{
- db_input low clamav-milter/OnFail || true
- if db_go; then
- STATE="RejectMsg"
- else
- STATE="OnInfected"
- fi
-}
-
-StateRejectMsg()
-{
- db_input low clamav-milter/RejectMsg || true
- if db_go; then
- STATE="AddHeader"
- else
- STATE="OnFail"
- fi
-}
-
-StateAddHeader()
-{
- db_input low clamav-milter/AddHeader || true
- if db_go; then
- STATE="LogFile"
- else
- STATE="RejectMsg"
- fi
-}
-
StateLogFile()
{
db_input low clamav-milter/LogFile || true
@@ -393,85 +203,6 @@ StateLogFile()
fi
}
-StateLogFileUnlock()
-{
- db_input low clamav-milter/LogFileUnlock || true
- if db_go; then
- STATE="LogFileMaxSize"
- else
- STATE="LogFile"
- fi
-}
-
-StateLogFileMaxSize()
-{
- if inputdigit low clamav-milter/LogFileMaxSize ; then
- STATE="LogTime"
- else
- STATE="LogFileUnlock"
- fi
-}
-
-StateLogTime()
-{
- db_input low clamav-milter/LogTime || true
- if db_go; then
- STATE="LogSyslog"
- else
- STATE="LogFileMaxSize"
- fi
-}
-
-StateLogSyslog()
-{
- db_input low clamav-milter/LogSyslog || true
- if db_go; then
- STATE="LogFacility"
- else
- STATE="LogTime"
- fi
-}
-
-StateLogFacility()
-{
- db_input low clamav-milter/LogFacility || true
- if db_go; then
- STATE="LogVerbose"
- else
- STATE="LogSyslog"
- fi
-}
-
-StateLogVerbose()
-{
- db_input low clamav-milter/LogVerbose || true
- if db_go; then
- STATE="LogInfected"
- else
- STATE="LogFacility"
- fi
-}
-
-StateLogInfected()
-{
- db_input low clamav-milter/LogInfected || true
- if db_go; then
- STATE="MaxFileSize"
- else
- STATE="LogVerbose"
- fi
-}
-
-StateMaxFileSize()
-{
- if inputdigit low clamav-milter/MaxFileSize ; then
- STATE="End"
- else
- STATE="LogInfected"
- fi
-}
-
-
# To many options to configure at configure
if [ "$1" = "reconfigure" ]; then
STATE="Init"
@@ -493,86 +224,86 @@ while [ "$STATE" != "End" ]; do
"Init")
StateDebconf
;;
- "MilterSocket")
- StateMilterSocket
- ;;
- "FixStaleSocket")
- StateFixStaleSocket
- ;;
"User")
StateUser
;;
"AddGroups")
- StateAddGroups
+ StateGeneric medium clamav-milter/AddGroups MilterSocket User
;;
- "ReadTimeout")
- StateReadTimeout
+ "MilterSocket")
+ StateGeneric low clamav-milter/MilterSocket MilterSocketGroup AddGroups
;;
"MilterSocketGroup")
StateMilterSocketGroup
;;
"MilterSocketMode")
- StateMilterSocketMode
+ StateGenericDigit low clamav-milter/MilterSocketMode FixStaleSocket MilterSocketGroup
+ ;;
+ "FixStaleSocket")
+ StateGeneric low clamav-milter/FixStaleSocket ReadTimeout MilterSocketMode
+ ;;
+ "ReadTimeout")
+ StateGenericDigit low clamav-milter/ReadTimeout Foreground FixStaleSocket
;;
"Foreground")
- StateForeground
+ StateGeneric low clamav-milter/Foreground Chroot ReadTimeout
;;
"Chroot")
- StateChroot
+ StateGeneric low clamav-milter/Chroot PidFile Foreground
;;
"PidFile")
- StatePidFile
+ StateGeneric low clamav-milter/PidFile TemporaryDirectory Chroot
;;
"TemporaryDirectory")
- StateTemporaryDirectory
+ StateGeneric low clamav-milter/TemporaryDirectory ClamdSocket PidFile
;;
"ClamdSocket")
- StateClamdSocket
+ StateGeneric low clamav-milter/ClamdSocket LocalNet TemporaryDirectory
;;
"LocalNet")
- StateLocalNet
+ StateGeneric low clamav-milter/LocalNet Whitelist ClamdSocket
;;
"Whitelist")
- StateWhitelist
+ StateGeneric low clamav-milter/Whitelist OnInfected LocalNet
;;
"OnInfected")
- StateOnInfected
+ StateGeneric low clamav-milter/OnInfected OnFail Whitelist
;;
"OnFail")
- StateOnFail
+ StateGeneric low clamav-milter/OnFail RejectMsg OnInfected
;;
"RejectMsg")
- StateRejectMsg
+ StateGeneric low clamav-milter/RejectMsg AddHeader OnFail
;;
"AddHeader")
- StateAddHeader
+ StateGeneric low clamav-milter/AddHeader LogFile RejectMsg
;;
"LogFile")
StateLogFile
;;
"LogFileUnlock")
- StateLogFileUnlock
+ StateGeneric low clamav-milter/LogFileUnlock LogFileMaxSize LogFile
;;
"LogFileMaxSize")
- StateLogFileMaxSize
+ StateGenericDigit low clamav-milter/LogFileMaxSize LogTime LogFileUnlock
;;
"LogTime")
- StateLogTime
+ StateGeneric low clamav-milter/LogTime LogSyslog LogFileMaxSize
;;
"LogSyslog")
- StateLogSyslog
+ StateGeneric low clamav-milter/LogSyslog LogFacility LogTime
;;
"LogFacility")
- StateLogFacility
+ StateGeneric low clamav-milter/LogFacility LogVerbose LogSyslog
;;
"LogVerbose")
- StateLogVerbose
+ StateGeneric low clamav-milter/LogVerbose LogInfected LogFacility
;;
"LogInfected")
- StateLogInfected
+ StateGeneric low clamav-milter/LogInfected MaxFileSize LogVerbose
;;
"MaxFileSize")
- StateMaxFileSize
+ StateGenericDigit low clamav-milter/MaxFileSize End LogInfected
;;
esac
done
diff --git a/debian/common_functions b/debian/common_functions
index 782d929..c196250 100644
--- a/debian/common_functions
+++ b/debian/common_functions
@@ -149,3 +149,64 @@ make_dir()
chown "$User" "$DIR"
}
+# Debconf Functions
+
+isdigit ()
+{
+ case $1 in
+ [[:digit:]]*)
+ ISDIGIT=1
+ ;;
+ *)
+ ISDIGIT=0
+ ;;
+ esac
+}
+
+inputdigit ()
+{
+ ISDIGIT=0
+ while [ "$ISDIGIT" = '0' ]; do
+ db_input "$1" "$2" || true
+ if ! db_go; then
+ return 30
+ fi
+ db_get $2 || true
+ isdigit $RET
+ if [ "$ISDIGIT" = '0' ]; then
+ db_input critical clamav-base/numinfo || true
+ db_go
+ fi
+ done
+ return 0
+}
+
+StateGeneric()
+{
+ PRIO=$1
+ QUESTION=$2
+ LAST=$3
+ NEXT=$4
+
+ db_input $PRIO $QUESTION || true
+ if db_go; then
+ STATE=$NEXT
+ else
+ STATE=$LAST
+ fi
+}
+
+StateGenericDigit()
+{
+ PRIO=$1
+ QUESTION=$2
+ LAST=$3
+ NEXT=$4
+
+ inputdigit $PRIO $QUESTION || true
+ if db_go; then
+ STATE=$NEXT
+ else
+ STATE=$LAST
+ fi
+}
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list