zshrc: add a check for ZSH_VERSION >= 3.1.7
authorFrank Terbeck <ft@grml.org>
Fri, 1 Feb 2008 01:13:09 +0000 (02:13 +0100)
committerFrank Terbeck <ft@grml.org>
Fri, 1 Feb 2008 01:13:09 +0000 (02:13 +0100)
See <http://bts.grml.org/grml/issue389>.

This commit quietly sets the required version of zsh to 3.1.7.
If that test fails, we complain loudly.

debian/changelog
etc/skel/.zshrc
etc/zsh/zshrc

index ce3d187..7e918c7 100644 (file)
@@ -4,7 +4,10 @@ grml-etc-core (0.3.48) unstable; urgency=low
   * use $PAGER in dchange(), uchange() and dnews() [Closes: issue386]
   * adding whatwhen() for history queries [Closes: issue380]
 
- -- Frank Terbeck <ft@grml.org>  Thu, 31 Jan 2008 10:46:20 +0100
+  [ Frank Terbeck ]
+  * zshrc: add a check for ZSH_VERSION >= 3.1.7 [Closes: issue389]
+
+ -- Frank Terbeck <ft@grml.org>  Fri, 01 Feb 2008 02:11:31 +0100
 
 grml-etc-core (0.3.47) unstable; urgency=low
 
index 247e271..830df2f 100644 (file)
@@ -24,6 +24,9 @@
 if [[ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ]] ; then
     print 'Warning: global zsh config has not been read.' >&2
     print '         prepare for possible errors!'         >&2
+    print '' >&2
+    print 'See our refcard for info on how to get the complete configuration:' >&2
+    print '    <http://grml.org/zsh/grml-zsh-refcard.pdf>' >&2
 fi
 # }}}
 
index f9017c0..08940c6 100644 (file)
@@ -331,6 +331,33 @@ isgrml && checkhome() {
         cd
     fi
 }
+
+# check for zsh v3.1.7+
+
+if ! [[ ${ZSH_VERSION} == 3.1.<7->*      \
+     || ${ZSH_VERSION} == 3.<2->.<->*    \
+     || ${ZSH_VERSION} == <4->.<->*   ]] ; then
+
+    printf '-!-\n'
+    printf '-!- In this configuration we try to make use of features, that only\n'
+    printf '-!- require version 3.1.7 of the shell; That way this setup can be\n'
+    printf '-!- used with a wide range of zsh versions, while using fairly\n'
+    printf '-!- advanced features in all supported versions.\n'
+    printf '-!-\n'
+    printf '-!- However, you are running zsh version %s.\n' "$ZSH_VERSION"
+    printf '-!-\n'
+    printf '-!- While this *may* work, it might as well fail.\n'
+    printf '-!- Please consider updating to at least version 3.1.7 of zsh.\n'
+    printf '-!-\n'
+    printf '-!- DO NOT EXPECT THIS TO WORK FLAWLESSLY!\n'
+    printf '-!- If it does today, you'\''ve been lucky.\n'
+    printf '-!-\n'
+    printf '-!- Ye been warned!\n'
+    printf '-!-\n'
+
+    function zstyle() { : }
+fi
+
 # }}}
 
 # {{{ set some variables