The 'preparation to a zsh workshop improves code quality' release. :)
authorMichael Prokop <mika@grml.org>
Fri, 24 Nov 2006 23:52:18 +0000 (00:52 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 24 Nov 2006 23:52:18 +0000 (00:52 +0100)
  * /etc/zsh/zshrc:
    - run "limit core 0" only in live-cd mode
    - support Force-Reload for /etc/init.d/*-action as well
    - move upgrade-function from /etc/skel/.zshrc to this file
  * /etc/skel/.zshrc: some cosmetic cleanups

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

index 0cea8db..b4f29d6 100644 (file)
@@ -1,3 +1,15 @@
+grml-etc-core (0.1-37) unstable; urgency=low
+
+  The 'a zsh workshop improves code quality' release. :)
+
+  * /etc/zsh/zshrc:
+    - run "limit core 0" only in live-cd mode
+    - support Force-Reload for /etc/init.d/*-action as well
+    - move upgrade-function from /etc/skel/.zshrc to this file
+  * /etc/skel/.zshrc: some cosmetic cleanups
+
+ -- Michael Prokop <mika@grml.org>  Sat, 25 Nov 2006 00:06:16 +0100
+
 grml-etc-core (0.1-36) unstable; urgency=low
 
   * /etc/skel/.zshrc:
index ea9f6bd..c3dbaf8 100644 (file)
 
 # console stuff
   alias cmplayer='mplayer -vo fbdev'
-#  alias fbmplayer='mplayer -vo fbdev'
   alias fbmplayer='mplayer -vo fbdev -fs -zoom'
   alias fblinks='links2 -driver fb'
 
   cvsr()    { rcs2log $* | $PAGER }
   cvss()    { cvs status -v $* }
   debbug()  { ${=BROWSER} "http://bugs.debian.org/$*" }
-  debbugm() { bts show --mbox $1 } # provide bugnummer as $1
+  debbugm() { bts show --mbox $1 } # provide bugnummer as "$1"
   disassemble(){ gcc -pipe -S -o - -O -g $* | as -aldh -o /dev/null }
   dmoz()    { ${=BROWSER} http://search.dmoz.org/cgi-bin/search\?search=${1// /_} }
   dwicti()  { ${=BROWSER} http://de.wiktionary.org/wiki/${(C)1// /_} }
   _doc() { _files -W /usr/share/doc -/ }
   compdef _doc doc
 
-# debian upgrade
-  upgrade () {
-    if [ -z $1 ] ; then
-        $SUDO apt-get update
-        $SUDO apt-get -u upgrade
-    else
-        ssh $1 $SUDO apt-get update
-        # ask before the upgrade
-        local dummy
-        ssh $1 $SUDO apt-get --no-act upgrade
-        echo -n "Process the upgrade ?"
-        read -q dummy
-        if [[ $dummy == "y" ]] ; then
-            ssh $1 $SUDO apt-get -u upgrade --yes
-        fi
-    fi
-  }
-
 # make screenshot of current desktop (use 'import' from ImageMagic)
   sshot() {
         [[ ! -d ~/shots  ]] && mkdir ~/shots
         cd ~/shots ; sleep 5; import -window root shot_`date --iso-8601=m`.jpg
   }
 
-
 # list images only
   limg() {
     local -a images
     fi
   }
 
-
 # create pdf file from source code
   makereadable() {
      output=$1
     pcre_compile $1 && \
     pcre_match $2 && echo "regex matches" || echo "regex does not match"
   }
+
 # list files which have been modified within the last x days
   new() { print -l *(m-$1) }
 
         fi
   }
 
+# follow symlinks
   folsym() {
     if [[ -e $1 || -h $1 ]]; then
         file=$1
         done
   }
 
-# $ show_print `cat /etc/passwd`
+# % slow_print `cat /etc/passwd`
   slow_print() {
         for argument in "${@}"
         do
         print ""
   }
 
+# display system state
   status() {
         print ""
         print "Date..: "$(date "+%Y-%m-%d %H:%M:%S")""
         print ""
   }
 
+# Rip an audio CD
   audiorip() {
         mkdir -p ~/ripps
         cd ~/ripps
         fi
   }
 
+# and burn it
   audioburn() {
         cd ~/ripps
         cdrdao write --device $DEVICE --driver generic-mmc audiocd.toc
         fi
   }
 
+# Make an audio CD from all mp3 files
   mkaudiocd() {
         cd ~/ripps
         for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
         for i in *.wav; do sox $i.wav -r 44100 $i.wav resample; done
   }
 
+# Create an ISO image. You are prompted for volume name, filename and directory
   mkiso() {
         echo " * Volume name "
         read volume
         mkisofs -o ~/$iso -A $volume -allow-multidot -J -R -iso-level 3 -V $volume -R $files
   }
 
-# generate thumbnails ;)
+# simple thumbnails generator
   genthumbs () {
     rm -rf thumb-* index.html
     echo "
index ff2fe2c..32c2860 100644 (file)
@@ -176,7 +176,7 @@ fi
   zle -N edit-command-line && \
   bindkey '\ee' edit-command-line
 
-## menu selection: pick item but stay in the menu (press esc-return)
+# menu selection: pick item but stay in the menu (press esc-return)
   is4 && bindkey -M menuselect '\e^M' accept-and-menu-complete
 
 # press "ctrl-e d" to insert the actual date in the form yyyy-mm-dd
@@ -501,6 +501,24 @@ Enjoy your grml system with the zsh!$reset_color"
     alias dbp='dpkg-buildpackage'
     alias ge='grep-excuses'
 
+    # debian upgrade
+    upgrade () {
+      if [ -z "$1" ] ; then
+          $SUDO apt-get update
+          $SUDO apt-get -u upgrade
+      else
+          ssh $1 $SUDO apt-get update
+          # ask before the upgrade
+          local dummy
+          ssh $1 $SUDO apt-get --no-act upgrade
+          echo -n 'Process the upgrade?'
+          read -q dummy
+          if [[ $dummy == "y" ]] ; then
+              ssh $1 $SUDO apt-get -u upgrade --yes
+          fi
+      fi
+    }
+
     isgrmlcd && alias su="sudo su"          # change to user root
     alias tlog="tail -f /var/log/syslog"    # take a look at the syslog
     alias zshskel="source /etc/skel/.zshrc" # source skeleton zshrc
@@ -521,7 +539,7 @@ Please use the wodim binary instead' ; return 1"
 # {{{ Use hard limits, except for a smaller stack and no core dumps
   unlimit
   limit stack 8192
-  limit core 0      # important for a live-cd-system
+  isgrmlcd && limit core 0 # important for a live-cd-system
   limit -s
 # }}}
 
@@ -750,11 +768,11 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
 
 # use it e.g. via 'Restart apache2'
  if [ -d /etc/init.d ] ; then
-  for i in Start Restart Stop Reload ; do
+  for i in Start Restart Stop Force-Reload Reload ; do
     eval "$i() { $SUDO /etc/init.d/\$1 ${i:l} \$2 ; }"
   done
 # now the completion for this:
-  compctl -g "$(echo /etc/init.d/*(:t))" Start Restart Stop Reload
+  compctl -g "$(echo /etc/init.d/*(:t))" Start Restart Stop Force-Reload Reload
  fi
 # }}}