Use mktemp consequently for tmp files
authorMichael Prokop <mika@grml.org>
Thu, 12 Feb 2009 17:12:32 +0000 (18:12 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 12 Feb 2009 17:12:32 +0000 (18:12 +0100)
debian/changelog
grml-x

index faabb4b..e070da8 100644 (file)
@@ -4,11 +4,14 @@ grml-x (0.4.2) unstable; urgency=low
     - use double brackets for the test command
     - make sure the right usage text gets displayed
     - support fallback options
-
+    - improve description of force option
     Thanks to ft and z3ttacht for their work! [Closes: issue398]
   * Use Build-Depends-Indep in debian/control to make lintian happy.
+  * Consequently use mktemp for handling tmp files.
+  * Use fluxbox for all usage examples in grml-x itself (on grml-medium
+    we ship fluxbox only and people might be confused otherwise).
 
- -- Michael Prokop <mika@grml.org>  Thu, 12 Feb 2009 18:04:15 +0100
+ -- Michael Prokop <mika@grml.org>  Thu, 12 Feb 2009 18:10:53 +0100
 
 grml-x (0.4.1) unstable; urgency=low
 
diff --git a/grml-x b/grml-x
index a28a5fb..85ec3f0 100755 (executable)
--- a/grml-x
+++ b/grml-x
@@ -6,13 +6,6 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-# make sure /tmp is writeable {{{
-  if ! [ -w /tmp ] ; then
-     echo 'Fatal: /tmp is not writeable. Can not resume therefore, sorry.' >&2
-     exit 1
-  fi
-# }}}
-
 # debugging {{{
 # usage: DEBUG=1 grml-x ..... 2>/tmp/grml-x-debug.log
   if [[ $DEBUG -gt 0 ]]; then
   [ -n "$XINITRC" ] || XINITRC="$HOME/.xinitrc"
 
   # temporary files
-  HWINFO_TMP="/tmp/hwinfo.$$"
-  MONITORINFO="/tmp/monitorinfo.$$"
-  MOUSEINFO="/tmp/mouse.$$"
+  HWINFO_TMP="$(mktemp)"
+  MONITORINFO="$(mktemp)"
+  MOUSEINFO="$(mktemp)"
+
+  if [ -z "$HWINFO_TMP" ] ; then
+     echo "Fatal: could not create temporary file. Exiting.">&2
+     bailout 1
+  fi
 
   if [ -r /etc/sysconfig/keyboard ] ; then
     source /etc/sysconfig/keyboard
@@ -127,17 +125,16 @@ Usage: $PROGRAMNAME
        $PROGRAMNAME [-options] windowmanager
 
 Usage examples:
-  $PROGRAMNAME wmii
   $PROGRAMNAME fluxbox
-  $PROGRAMNAME openbox
+  $PROGRAMNAME fluxbox
   $PROGRAMNAME -force -nostart fluxbox
   $PROGRAMNAME -nosynaptics fluxbox
   $PROGRAMNAME -nosync fluxbox
-  $PROGRAMNAME -noddc wmii
-  $PROGRAMNAME -xinerama -composite wmii
-  $PROGRAMNAME -module radeon -mode 1024x768 -vsync 60 openbox
-  XINITRC=~/.xinitrc $PROGRAMNAME openbox
-  $PROGRAMNAME -display 8 openbox
+  $PROGRAMNAME -noddc fluxbox
+  $PROGRAMNAME -xinerama -composite fluxbox
+  $PROGRAMNAME -module radeon -mode 1024x768 -vsync 60 fluxbox
+  XINITRC=~/.xinitrc $PROGRAMNAME fluxbox
+  $PROGRAMNAME -display 8 fluxbox
 
 More information on grml-x can be found in the manual page: man grml-x
 
@@ -681,7 +678,7 @@ cat << EOX
 #   /usr/share/doc/xserver-xorg/   and
 #   http://wiki.x.org/wiki/Home    and
 #   http://ftp.x.org/pub/X11R7.0/doc/html/index.html for information on Xorg
-# 
+#
 # Refer to the xorg.conf man page and to
 # http://ftp.x.org/pub/X11R7.0/doc/html/xorg.conf.5.html
 # for details about the format of this file.
@@ -852,7 +849,7 @@ EOX
 
 # writeit {{{
 writeit() {
-    XCONFTMP="/tmp/xconfig.$$"
+    XCONFTMP="$(mktemp)"
     xconfig > $XCONFTMP
     # we do not want to have two CorePointers, deactivate one therefore
     if grep -Eq '^[[:space:]]+InputDevice[ ]+"USB Mouse"[ ]+"CorePointer"' $XCONFTMP ; then