[Pkg-dkms-maint] [PATCH 4/4] Adding some quoting to postinst/prerm shell variables

Frédéric Brière fbriere at fbriere.net
Wed Feb 17 21:14:12 UTC 2010


---
I'm guessing none of this is necessary at all (version numbers cannot start
with "~", can they?), but better safe than sorry.  I didn't go so far as to
quote filenames, however.  Apply or reject at your leisure.

 debian/scripts/postinst-dkms |    8 ++++----
 debian/scripts/prerm-dkms    |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/debian/scripts/postinst-dkms b/debian/scripts/postinst-dkms
index ac36471..84a676b 100644
--- a/debian/scripts/postinst-dkms
+++ b/debian/scripts/postinst-dkms
@@ -1,9 +1,9 @@
 # The original file can be found in template-dkms-mkdeb/debian/postinst
 # in the DKMS tarball, check it for copyright notices.
 
-DKMS_NAME=#MODULE_NAME#
-DKMS_PACKAGE_NAME=#DEB_PACKAGE#
-DKMS_VERSION=#MODULE_VERSION#
+DKMS_NAME="#MODULE_NAME#"
+DKMS_PACKAGE_NAME="#DEB_PACKAGE#"
+DKMS_VERSION="#MODULE_VERSION#"
 
 postinst_found=0
 
@@ -11,7 +11,7 @@ case "$1" in
 	configure)
 		for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/$DKMS_PACKAGE_NAME/postinst; do
 			if [ -f $DKMS_POSTINST ]; then
-				$DKMS_POSTINST $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_PACKAGE_NAME "" $2
+				$DKMS_POSTINST "$DKMS_NAME" "$DKMS_VERSION" /usr/share/$DKMS_PACKAGE_NAME "" "$2"
 				postinst_found=1
 				break
 			fi
diff --git a/debian/scripts/prerm-dkms b/debian/scripts/prerm-dkms
index 6e93a1b..7959ab7 100644
--- a/debian/scripts/prerm-dkms
+++ b/debian/scripts/prerm-dkms
@@ -1,10 +1,10 @@
-DKMS_NAME=#MODULE_NAME#
-DKMS_VERSION=#MODULE_VERSION#
+DKMS_NAME="#MODULE_NAME#"
+DKMS_VERSION="#MODULE_VERSION#"
 
 case "$1" in
     remove|upgrade|deconfigure)
-      if [  "$(dkms status -m $DKMS_NAME -v $DKMS_VERSION)" ]; then
-         dkms remove -m $DKMS_NAME -v $DKMS_VERSION --all
+      if [  "$(dkms status -m "$DKMS_NAME" -v "$DKMS_VERSION")" ]; then
+         dkms remove -m "$DKMS_NAME" -v "$DKMS_VERSION" --all
       fi
     ;;
 esac
-- 
1.7.0




More information about the Pkg-dkms-maint mailing list