From fdc8e8a0089fc457478464f8cbe4b89a813b27fc Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 15 Oct 2006 10:36:22 +0000 Subject: [PATCH] initial checkin --- debian/changelog | 144 ++++++ debian/compat | 1 + debian/conffiles | 0 debian/control | 17 + debian/copyright | 27 ++ debian/dirs | 2 + debian/postrm | 45 ++ debian/preinst | 50 +++ debian/rules | 54 +++ etc/apt/sources.list.grml | 243 ++++++++++ etc/grml/lsb-functions | 789 ++++++++++++++++++++++++++++++++ etc/grml/screen_multisession | 12 + etc/grml/screenrc | 149 ++++++ etc/grml/screenrc_acpi | 144 ++++++ etc/grml/sysexits-sh | 53 +++ etc/grml_colors | 27 ++ etc/grml_nocolors | 32 ++ etc/network/interfaces.examples | 106 +++++ etc/skel/.vim/klammerpaare.vim | 62 +++ etc/skel/.vim/spellfile.add | 0 etc/skel/.vimrc | 144 ++++++ etc/skel/.zshrc | 874 ++++++++++++++++++++++++++++++++++++ etc/vim/vimrc | 97 ++++ etc/zsh/completion.d/debian_rules | 2 + etc/zsh/completion.d/fbset | 3 + etc/zsh/completion.d/grml-lang | 2 + etc/zsh/completion.d/grml-wallpaper | 7 + etc/zsh/completion.d/iwconfig | 88 ++++ etc/zsh/keephack | 88 ++++ etc/zsh/zlogin | 17 + etc/zsh/zlogout | 9 + etc/zsh/zprofile | 15 + etc/zsh/zshenv | 76 ++++ etc/zsh/zshrc | 705 +++++++++++++++++++++++++++++ 34 files changed, 4084 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/conffiles create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100755 debian/postrm create mode 100755 debian/preinst create mode 100755 debian/rules create mode 100644 etc/apt/sources.list.grml create mode 100644 etc/grml/lsb-functions create mode 100644 etc/grml/screen_multisession create mode 100644 etc/grml/screenrc create mode 100644 etc/grml/screenrc_acpi create mode 100644 etc/grml/sysexits-sh create mode 100644 etc/grml_colors create mode 100644 etc/grml_nocolors create mode 100644 etc/network/interfaces.examples create mode 100644 etc/skel/.vim/klammerpaare.vim create mode 100644 etc/skel/.vim/spellfile.add create mode 100644 etc/skel/.vimrc create mode 100644 etc/skel/.zshrc create mode 100644 etc/vim/vimrc create mode 100644 etc/zsh/completion.d/debian_rules create mode 100644 etc/zsh/completion.d/fbset create mode 100644 etc/zsh/completion.d/grml-lang create mode 100644 etc/zsh/completion.d/grml-wallpaper create mode 100644 etc/zsh/completion.d/iwconfig create mode 100644 etc/zsh/keephack create mode 100644 etc/zsh/zlogin create mode 100644 etc/zsh/zlogout create mode 100644 etc/zsh/zprofile create mode 100644 etc/zsh/zshenv create mode 100644 etc/zsh/zshrc diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9637f0e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,144 @@ +grml-etc-core (0.1-19) unstable; urgency=low + + * /etc/grml/screenrc: activated + termcapinfo xterm|xterms|xs|rxvt ti@:te@ + for "more usual" buffer handling in xterm & CO. + + -- Michael Prokop Sat, 14 Oct 2006 22:56:23 +0200 + +grml-etc-core (0.1-18) unstable; urgency=low + + * /etc/skel/.zshrc: update function getskype (new upstream release + which does not require s/libqt3c102-mt/libqt3-mt/ workaround anymore. + + -- Michael Prokop Mon, 9 Oct 2006 14:48:22 +0200 + +grml-etc-core (0.1-17) unstable; urgency=low + + * /etc/zsh/zshrc: don't check whether we can read xorg.conf but if it + exists. Check for /usr/X11R6/bin/startx if /usr/bin/startx does not exist + and check for /usr/X11R6/bin/xinit if /usr/bin/xinit is not present. + + -- Michael Prokop Sun, 8 Oct 2006 01:43:24 +0200 + +grml-etc-core (0.1-16) unstable; urgency=low + + * /etc/zsh/zshrc: don't use colors on dumb terminals (like emacs) + * Move debian/postinst to debian/preinst, some minor fixes in + preinst and postrm. + + -- Michael Prokop Mon, 2 Oct 2006 23:46:55 +0200 + +grml-etc-core (0.1-15) unstable; urgency=low + + * Set debian related functions + aliases only if /etc/debian_version + is present. Check for uid and set $SUDO according so normal + user can use functions + aliases as well. + + -- Michael Prokop Fri, 29 Sep 2006 14:35:32 +0200 + +grml-etc-core (0.1-14) unstable; urgency=low + + * /etc/zsh/zshrc: instead of our predict-function use ctrl-z + to put job into foreground (thanks, wuehlmaus). + + -- Michael Prokop Fri, 29 Sep 2006 14:09:30 +0200 + +grml-etc-core (0.1-13) unstable; urgency=low + + * /etc/zsh/zshrc: added alias truec - thanks, Mark! + + -- Michael Prokop Thu, 28 Sep 2006 23:06:41 +0200 + +grml-etc-core (0.1-12) unstable; urgency=low + + * Cleanup and update of /etc/apt/sources.list.grml. + * /etc/zsh/zshrc: add functions dchange (Debian's changelog of specified + package) and uchange (view upstream's changelog of specified package). + + -- Michael Prokop Thu, 28 Sep 2006 15:42:43 +0200 + +grml-etc-core (0.1-11) unstable; urgency=low + + * /etc/zsh/zshenv: don't set $LC_ALL anymore if it isn't set + in environment files. + + -- Michael Prokop Sat, 23 Sep 2006 14:20:42 +0200 + +grml-etc-core (0.1-10) unstable; urgency=low + + * /etc/zsh/zshrc: improved startx + xinit alias, thanks to + Worf for idea! + * /etc/skel/.zshrc: set browser to firefox if $DISPLAY is set + + -- Michael Prokop Sat, 23 Sep 2006 12:21:32 +0200 + +grml-etc-core (0.1-9) unstable; urgency=low + + * /etc/zsh/zshenv: add /cdrom/addons/ to $PATH if the directory + is present. + * /etc/zsh/zshrc: "complete 'cd - Thu, 21 Sep 2006 19:29:02 +0200 + +grml-etc-core (0.1-8) unstable; urgency=low + + * Depend on 'vim | nvi' so we can use grml-etc-core on grml-small + as well. + + -- Michael Prokop Mon, 18 Sep 2006 19:42:16 +0200 + +grml-etc-core (0.1-7) unstable; urgency=low + + * /etc/skel/.zshrc: added function getair (get AIR - Automated Image and + Restore). + + -- Michael Prokop Mon, 18 Sep 2006 18:55:01 +0200 + +grml-etc-core (0.1-6) unstable; urgency=low + + * Remove /etc/grml/script-functions, ship it with package grml-scripts. + + -- Michael Prokop Mon, 18 Sep 2006 00:46:00 +0200 + +grml-etc-core (0.1-5) unstable; urgency=low + + * /etc/zsh/zshrc: + - press "ctrl-e d" to insert the actual date in the form + yyyy-mm-dd (found in schulas zsh config :)) + - complete manual pages by their section (hello schula, + again ;-)) + + -- Michael Prokop Sun, 17 Sep 2006 16:46:44 +0200 + +grml-etc-core (0.1-4) unstable; urgency=low + + * /etc/zsh/zshrc: support 'BATTERY=1 zsh' (display battery + status on right side of prompt. + + -- Michael Prokop Sun, 17 Sep 2006 14:19:09 +0200 + +grml-etc-core (0.1-3) unstable; urgency=low + + * /etc/zsh/zshrc: added alias ll (ls -hAl --color=auto'), thanks + for suggestion, Mark! + * /etc/apt/sources.list.grml: added entry for xfce sources, thanks + Mark! + * Added /etc/grml/script-functions meant for usage inside shell + scripts. + + -- Michael Prokop Sat, 16 Sep 2006 10:39:52 +0200 + +grml-etc-core (0.1-2) unstable; urgency=low + + * /etc/skel/.zshrc: updated function wodeb(), thanks wuehlmaus! + + -- Michael Prokop Fri, 15 Sep 2006 17:53:35 +0200 + +grml-etc-core (0.1) unstable; urgency=low + + * Initial Release. + + -- Michael Prokop Tue, 12 Sep 2006 15:45:23 +0200 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/conffiles b/debian/conffiles new file mode 100644 index 0000000..e69de29 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..3d9ef60 --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: grml-etc-core +Section: grml +Priority: optional +Maintainer: Michael Prokop +Build-Depends: debhelper (>= 4.0.0) +Standards-Version: 3.6.2 + +Package: grml-etc-core +Architecture: all +Conflicts: grml-etc (<< 0.8-11), grml-autoconfig (<< 0.5-7) +Depends: vim | nvi, zsh +Description: core ecetera files for the grml system + This package includes some /etc files for the + grml system. Whereas the main grml-etc package is + meant for use on grml systems this package can be + used on plain Debian (stable/testing/unstable) + systems as well. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..06c4d91 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Michael Prokop on +Tue, 12 Sep 2006 15:45:23 +0200. + +It was downloaded from http://grml.org/ + +Copyright Holder: Michael Prokop + +Copyright: + + This software is copyright (c) 2004-2006 by Michael Prokop. + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301, USA. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..7c9906d --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +etc/skel +etc/zsh diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..fdd5d18 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,45 @@ +#!/bin/sh +# Filename: postrm +# Purpose: postrm script for package grml-etc-core +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fre Sep 15 13:17:19 CEST 2006 [mika] +################################################################################ + +set -e + +TO_UNDIVERT1="zlogin zlogout zprofile zshenv zshrc" +TO_UNDIVERT2=".zshrc" +TO_UNDIVERT3="vimrc" + +undivert_gen() { + if [ -f "$2/$1" -o "$2/$1".original ] ; then + DEXT=${3:-original} + dpkg-divert --remove --rename --package grml-etc-core \ + --divert $2/$1.$DEXT $2/$1 #> /dev/null + fi +} + +case "$1" in + purge) + for cmd in $TO_UNDIVERT1; do + undivert_gen $cmd /etc/zsh + done + for cmd in $TO_UNDIVERT2; do + undivert_gen $cmd /etc/skel + done + for cmd in $TO_UNDIVERT3; do + undivert_gen $cmd /etc/vim + done + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + *) + echo "postrm called with unknown argument $1" >&2 + exit 1 +esac + +exit 0 + +## END OF FILE ################################################################# diff --git a/debian/preinst b/debian/preinst new file mode 100755 index 0000000..fa84a38 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,50 @@ +#!/bin/sh +# Filename: preinst +# Purpose: preinst script for package grml-etc-core +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Die Okt 03 20:33:19 CEST 2006 [mika] +################################################################################ + +set -e + +# check for files from rm_conffile() in debian/preinst of grml-etc +# make sure we don't lose any files... +divert_conffile() { + CONFFILE="$1" + + if [ -e "$CONFFILE.dpkg-bak" ]; then + cp -f "$CONFFILE" "$CONFFILE".original + else + [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".grml-etc-core + [ -e "$CONFFILE" ] && cp -f "$CONFFILE" "$CONFFILE".original + fi +} + +case "$1" in + install|upgrade|configure) + # move files from package grml-etc to grml-etc-core, make sure + # we don't lose any files... + for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \ + /etc/zsh/zlogout /etc/skel/.zshrc /etc/vim/vimrc; do + divert_conffile $file && \ + [ -f "$file" ] && rm $file && \ + dpkg-divert --quiet --add --rename --package grml-etc-core --divert "$file".original $file && \ + [ -f "$file".dpkg-bak ] && mv -f "$file".dpkg-bak "$file" + [ -f "$file".grml-etc-core ] && mv -f "$file".grml-etc-core "$file" + + # trying to overwrite `/etc/skel/.zshrc', which is also in package zsh + # [ -f /etc/skel/.zshrc ] && \ + # dpkg-divert --quiet --add --rename --package grml-etc-core --divert /etc/skel/.zshrc.original /etc/skel/.zshrc + done + + ;; + *) + echo "preinst called with unknown argument $1" >&2 + exit 1 +esac + +exit 0 + +## END OF FILE ################################################################# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..152c7f9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,54 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp + +build-stamp: + dh_testdir + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + dh_clean + rm -rf debian/grml-etc-core/ + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/grml-etc-core. + cp -a etc/ debian/grml-etc-core/ + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_compress + dh_fixperms + dh_installdeb + #find debian/grml-etc-core/etc -type f ! -name \*.xpm ! -name \*.png -print | \ + #sed -e 's#^debian/grml-etc-core##g' > debian/grml-etc-core/DEBIAN/conffiles + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/etc/apt/sources.list.grml b/etc/apt/sources.list.grml new file mode 100644 index 0000000..fd3fa1f --- /dev/null +++ b/etc/apt/sources.list.grml @@ -0,0 +1,243 @@ +# Filename: sources.list +# Purpose: specify ressources for debian's package management system +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Don Sep 28 15:02:09 CEST 2006 [mika] +################################################################################ +# Notice: because of ressource limits some lines might have been commented +# out on the grml live CD system. Just uncomment lines containing +# '#1#' at the beginning to get a "full featured" debian system on your +# hard disc. +# +# See sources.list(5) for more information, especialy +# Remember that you can only use http, ftp or file URIs +# CDROMs are managed through the apt-cdrom tool. +# +# Also check out +# http://www.apt-get.org/ +# http://www.debianforum.de/wiki/WoodyBackports +# http://www.backports.org/ +############################################################################## + +# main grml repository: + deb http://grml.org/repos/ ./ + deb-src http://grml.org/repos/ ./ + +# Unstable: +# TU Graz mirror +# deb http://ftp.tu-graz.ac.at/mirror/debian unstable main contrib non-free +# deb-src http://ftp.tu-graz.ac.at/mirror/debian unstable main contrib non-free +# Use mirror from VC-Graz without authentication: +# deb http://10.0.0.5/mirror/debian unstable main contrib non-free + +# AT/DE mirror: + deb http://ftp.de.debian.org/debian unstable main contrib non-free + deb-src http://ftp.de.debian.org/debian/ unstable main contrib non-free +# deb http://ftp.at.debian.org/debian unstable main contrib non-free +# deb-src http://ftp.at.debian.org/debian/ unstable main contrib non-free + +# http://volatile.debian.net/ +# deb http://ftp2.de.debian.org/debian-volatile stable/volatile main +# deb-src http://ftp2.de.debian.org/debian-volatile stable/volatile main + +# Experimental: +#1# deb http://ftp.de.debian.org/debian/ experimental main contrib non-free +#1# deb-src http://ftp.de.debian.org/debian/ experimental main contrib non-free +# deb http://ftp.tu-graz.ac.at/mirror/debian experimental main contrib non-free +# deb-src http://ftp.tu-graz.ac.at/mirror/debian experimental main contrib non-free + +# Security updates: +#1# deb http://security.debian.org stable/updates main contrib non-free +#1# deb-src http://security.debian.org stable/updates main contrib non-free + +# gebi's packages for grml (grml-terminalserver, grml-vpn, grml-crypt,...): +#1# deb http://einsteinmg.dyndns.org/debian unstable/ +#1# deb-src http://einsteinmg.dyndns.org/debian unstable/ + +# jimmy's packages for grml (gcom): +#1# deb http://debian.g-tec.co.at/ unstable main +#1# deb-src http://debian.g-tec.co.at/ unstable main + +# unofficial debian packages: +#1# deb http://ftp.debian-unofficial.org/debian sarge main contrib non-free restricted +#1# deb-src http://ftp.debian-unofficial.org/debian sarge main contrib non-free restricted + +# MPEG, divx...: +#1# deb http://www.debian-multimedia.org sid main +#1# deb-src http://www.debian-multimedia.org sid main + +# kwtools: +# deb ftp://ftp.berlios.de/pub/netzworkk/scripts/kwtools/Debian/stable/ ./ +# deb-src ftp://ftp.berlios.de/pub/netzworkk/scripts/kwtools/Debian/stable/ ./ +#1# deb ftp://server.mamemu.de/pub/kwtools/Debian/unstable/ ./ +#1# deb-src ftp://server.mamemu.de/pub/kwtools/Debian/unstable/ ./ +#1# deb ftp://server.mamemu.de/pub/kwtools/Debian/stable/ ./ +#1# deb-src ftp://server.mamemu.de/pub/kwtools/Debian/stable/ ./ + +# cpm +#1# deb http://debian.harry-b.de/ binary/ + +# ara, pcopy,...: +#1# deb ftp://ftp.uni-sofia.bg/debian-addons-bg ./ +#1# deb-src ftp://ftp.uni-sofia.bg/debian-addons-bg ./ + +# tex-refs: +#1# deb http://www.miwie.org/ ./ + +# bkp: +#1# deb http://opensource.polytechnique.org/debian/ ./ +#1# deb-src http://opensource.polytechnique.org/debian/ ./ + +# camgrab update-apt: +#1# deb http://www.steve.org.uk/apt sarge main contrib non-free +#1# deb-src http://www.steve.org.uk/apt sarge main contrib non-free + +# olsr: +#1# deb http://www.skyhub.de/debian/ unstable main +#1# deb-src http://www.skyhub.de/debian/ unstable main + +# ext3rminator: +#1# deb http://web.glandium.org/debian/repository/experimental/ ./ +#1# deb-src http://web.glandium.org/debian/repository/experimental/ ./ + +# kenny +#1# deb http://www.cgarbs.de/stuff ./ +#1# deb-src http://www.cgarbs.de/stuff ./ + +# synctree: +#1# deb http://www.knizefamily.net/russ/software/debian/ ./ +#1# deb-src http://www.knizefamily.net/russ/software/debian/ ./ + +# musepack-decoder musepack-encoder musepack-replaygain +# be careful with libfaad2 <-> mplayer! +##1# deb http://www.rarewares.org/debian/packages/unstable/ ./ + +################################################################################ +# Diff stuff: +# =========== +# +# get specific debian package: +# deb http://snapshot.debian.net/archive/2005/03/27/debian unstable main contrib non-free +# deb http://snapshot.debian.net/archive/date/last-week/debian unstable main contrib non-free +# deb http://snapshot.debian.net/archive pool packagename1 packagename2 + +# Backports: +# deb http://www.backports.org/debian stable package1 ... +# deb-src http://www.backports.org/debian stable package1 ... + +# mentors: +# deb-src http://mentors.debian.net/debian unstable main contrib non-free + +# apt-build: +# deb file:/var/cache/apt-build/repository apt-build main + +# cd-rom: +# deb cdrom:[Debian GNU/Linux 2.2 r3 _Potato_ - Official i386 Binary-1 (20010427)]/ unstable contrib main + +# Stable: +# deb http://ftp.de.debian.org/pub/debian stable main contrib non-free +# deb-src http://ftp.de.debian.org/pub/debian stable main contrib non-free + +# Testing: +# deb http://ftp.de.debian.org/pub/debian testing main contrib non-free +# deb-src http://ftp.de.debian.org/pub/debian testing main contrib non-free + +# Testing Sources +# deb-src http://ftp.de.debian.org/pub/debian testing main contrib non-free +# deb http://security.debian.org testing/updates main contrib non-free + +# Debian Cluster Components - http://dcc.irb.hr/ (apt-get install dcc-front debconf-dcc): +# deb ftp://ftp.irb.hr/pub/irb/dcc ./ + +# jEdit Debian packages (make sure you have Java first): +# deb http://dl.sourceforge.net/sourceforge/jedit ./ +# deb-src http://dl.sourceforge.net/sourceforge/jedit ./ + +# packages for the Debian stable (aka "Sarge") distribution: +# deb http://packages.dotdeb.org stable all +# deb-src http://packages.dotdeb.org stable all + +# nobses packages: +# deb http://people.debian.org/~nobse/debian/ unstable/ +# deb-src http://people.debian.org/~nobse/debian/ unstable/ + +# e17/elive: +# deb http://idefix.eup.uva.es/elive elive main efl elive +# deb http://www.soulmachine.net/debian/ unstable + +# libcairo, libpixman1 (-> wmii): +# deb http://cairographics.org/packages/debian/ unstable/ +# deb-src http://cairographics.org/packages/debian/ unstable/ + +# moc / mutt-ng: +# deb http://www.lxtec.de/debarchiv binary-i386/ +# deb-src http://www.lxtec.de/debarchiv sources/ + +# debian.pkgs.cpan.org -- debified CPAN packages: +# deb http://debian.pkgs.cpan.org/debian unstable main + +# Very latest bleeding edge XFCE releases +# To include the signing key use this command, +# wget -O - http://www.corsac.net/corsac.asc | sudo apt-key add - +# +# deb http://xfce.corsac.net sid main +# deb http://xfce.corsac.net unstable main +# deb-src http://xfce.corsac.net unstable main + +# centericq (4.9.12-4) by Julien Lemoine: +# deb http://debian.speedblue.org ./ +# deb-src http://debian.speedblue.org ./ +# centericq-cvs (out of date - 20041120): +# deb http://debian.parsed.net unstable main +# deb-src http://debian.parsed.net unstable main +# centericq by Marc Thoben (includes quote/ask-quit patches @cicq 4.9.10-8): +# deb http://ipxserver.dyndns.org/debian unstable centericq + +# opengroupware: +# deb http://download.opengroupware.org/nightly/packages/debian/dists/sid/trunk/binary-i386/ ./ + +# bitlbee devel-version: +# deb http://get.bitlbee.org/devel/ ./ + +# kanotix-packages: +# deb http://kanotix.com/files/debian/ ./ +# deb-src http://kanotix.com/files/debian/ ./ + +# kde 3.5: +# deb http://pkg-kde.alioth.debian.org/3.5.3/ ./ + +# http://xoomer.virgilio.it/flavio.stanchina/debian/fglrx-installer.html +# deb http://www.stanchina.net/~flavio/debian/ ./ +# deb-src http://www.stanchina.net/~flavio/debian/ ./ + +# opera: +# deb http://deb.opera.com/opera/ unstable non-free + +# silc-client: +# deb http://silcnet.org/download/client/deb ./ +# deb-src http://silcnet.org/download/client/deb ./ +# silc-server: +# deb http://silcnet.org/download/server/deb ./ +# deb-src http://silcnet.org/download/server/deb ./ + +# Joey Hess's bleeding edge repository (get any of his packages, before they hit Incoming) +# deb http://kitenet.net/~joey/debian/unstable/ ./ + +# remaster: +# deb http://debian.tu-bs.de/knoppix/remaster/ ./ + +# Ubuntu (releases: warty / hoary / breezy / dapper / edgy): +# deb http://archive.ubuntu.com/ubuntu/ hoary main restricted universe multiverse +# deb http://archive.ubuntu.com/ubuntu/ hoary main universe +# deb http://archive.ubuntu.com/ubuntu/ breezy main restricted universe multiverse +# deb http://security.ubuntu.com/ubuntu/ hoary-security main restricted +# deb-src http://security.ubuntu.com/ubuntu/ hoary-security main restricted + +# acx100 firmware: +# deb http://stef.tvk.rwth-aachen.de/~nazgul/debian acx100/ + +# c't project +# deb ftp://ftp.heise.de/pub/ct/projekte/vdr/sarge/testing/binary base/ + +### END OF FILE ################################################################ diff --git a/etc/grml/lsb-functions b/etc/grml/lsb-functions new file mode 100644 index 0000000..547db31 --- /dev/null +++ b/etc/grml/lsb-functions @@ -0,0 +1,789 @@ +# lsb init-functions {{{ +# /lib/lsb/init-functions for Debian -*- shell-script -*- +# +# Copyright (c) 2002-03 Chris Lawrence +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the author nor the names of other contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +log_success_msg () { + echo " * $@" +} + +log_failure_msg () { + TPUT=/usr/bin/tput + if [ -x $TPUT ] && $TPUT hpa 60 >/dev/null 2>&1; then + RED=`$TPUT setaf 1` + #NORMAL=`$TPUT op` + echo " ${RED}*${NORMAL} $@" + else + echo " * $@" + fi +} + +log_warning_msg () { + TPUT=/usr/bin/tput + if [ -x $TPUT ] && $TPUT hpa 60 >/dev/null 2>&1; then + YELLOW=`$TPUT setaf 3` + #NORMAL=`$TPUT op` + # echo " *${NORMAL} $@" + echo " ${BLUE}*${NORMAL} $@" + else + echo " * $@" + fi +} + +log_warning_msg_nn () { + TPUT=/usr/bin/tput + if [ -x $TPUT ] && $TPUT hpa 60 >/dev/null 2>&1; then + YELLOW=`$TPUT setaf 3` + echo -n " ${BLUE}*${NORMAL} $@" + else + echo -n " * $@" + fi +} + +# int log_begin_message (char *message) +log_begin_msg () { + if [ -z "$1" ]; then + return 1 + fi + echo " ${GREEN}*${NORMAL} $@" +} + +log_begin_msg_nn () { + if [ -z "$1" ]; then + return 1 + fi + echo -n " ${GREEN}*${NORMAL} $@" +} + + +SUBMSG=" ${GREEN}-${NORMAL} " + +# int log_end_message (int exitstatus) +log_end_msg () { + + # If no arguments were passed, return + [ -z "$1" ] && return 1 + + # Only do the fancy stuff if we have an appropriate terminal + # and if /usr is already mounted + TPUT=/usr/bin/tput + EXPR=/usr/bin/expr + if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then + COLS=`$TPUT cols` + if [ -n "$COLS" ]; then + COL=`$EXPR $COLS - 7` + else + COL=73 + fi + UP=`$TPUT cuu1` + END=`$TPUT hpa $COL` + START=`$TPUT hpa 0` + #RED=`$TPUT setaf 1` + #NORMAL=`$TPUT op` + if [ $1 -eq 0 ]; then + echo "$UP$END${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}" + else + echo -e "${UP}${START} ${RED}*${NORMAL}${END}[${RED}fail${NORMAL}]" + fi + else + if [ $1 -eq 0 ]; then + echo " ...done." + else + echo " ...fail!" + fi + fi + return $1 +} + +# void esyslog(char* priority, char* tag, char* message) +# use the system logger to log a message +#esyslog() { +# local pri= +# local tag= +# +# if [ -x /usr/bin/logger ] +# then +# pri="$1" +# tag="$2" +# +# shift 2 +# [[ -z "$*" ]] && return 0 +# +# /usr/bin/logger -p "${pri}" -t "${tag}" -- "$*" +# fi +# +# return 0 +#} + +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-src/rc-scripts/sbin/functions.sh,v 1.81.2.6 2005/05/15 20:00:31 vapier Exp $ + +RC_GOT_FUNCTIONS="yes" + +# Different types of dependencies +deptypes="need use" +# Different types of order deps +ordtypes="before after" + +# +# Internal variables +# + +# Dont output to stdout? +RC_QUIET_STDOUT="no" +RC_VERBOSE="${RC_VERBOSE:-no}" + +# Should we use color? +RC_NOCOLOR="${RC_NOCOLOR:-no}" +# Can the terminal handle endcols? +RC_ENDCOL="yes" + +# +# Default values for rc system +# +RC_TTY_NUMBER=11 +RC_NET_STRICT_CHECKING="no" +RC_PARALLEL_STARTUP="no" +RC_USE_CONFIG_PROFILE="yes" + +# +# Default values for e-message indentation and dots +# +RC_INDENTATION='' +RC_DEFAULT_INDENT=2 +#RC_DOT_PATTERN=' .' +RC_DOT_PATTERN='' + +# void splash(...) +# +# Notify bootsplash/splashutils/gensplash/whatever about +# important events. +# +splash() { + return 0 +} + +# void profiling(...) +# +# Notify bootsplash/whatever about important events. +# +profiling() { + return 0 +} + +# void get_bootconfig() +# +# Get the BOOTLEVEL and SOFTLEVEL by setting +# 'bootlevel' and 'softlevel' via kernel +# parameters. +# +get_bootconfig() { + local copt= + local newbootlevel= + local newsoftlevel= + + for copt in $( 0 )) || (( i = RC_DEFAULT_INDENT )) + esetdent $(( ${#RC_INDENTATION} + i )) +} + +# void eoutdent(int num) +# +# decrease the indent used for e-commands. +# +eoutdent() { + local i=$1 + (( i > 0 )) || (( i = RC_DEFAULT_INDENT )) + esetdent $(( ${#RC_INDENTATION} - i )) +} + +# void esetdent(int num) +# +# hard set the indent used for e-commands. +# num defaults to 0 +# +esetdent() { + local i=$1 + (( i < 0 )) && (( i = 0 )) + RC_INDENTATION=$(printf "%${i}s" '') +} + +# void einfo(char* message) +# +# show an informative message (with a newline) +# +einfo() { + einfon "$*\n" + LAST_E_CMD=einfo + return 0 +} + +# void einfon(char* message) +# +# show an informative message (without a newline) +# +einfon() { + [[ ${RC_QUIET_STDOUT} == yes ]] && return 0 + [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo + echo -ne " ${GOOD}*${NORMAL} ${RC_INDENTATION}$*" + LAST_E_CMD=einfon + return 0 +} + +# void ewarn(char* message) +# +# show a warning message + log it +# +ewarn() { + if [[ ${RC_QUIET_STDOUT} == yes ]]; then + echo " $*" + else + [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo + echo -e " ${WARN}*${NORMAL} ${RC_INDENTATION}$*" + fi + + # Log warnings to system log + esyslog "daemon.warning" "rc-scripts" "$*" + + LAST_E_CMD=ewarn + return 0 +} + +# void eerror(char* message) +# +# show an error message + log it +# +eerror() { + if [[ ${RC_QUIET_STDOUT} == yes ]]; then + echo " $*" >/dev/stderr + else + [[ ${RC_ENDCOL} != yes && ${LAST_E_CMD} == ebegin ]] && echo + echo -e " ${BAD}*${NORMAL} ${RC_INDENTATION}$*" + fi + + # Log errors to system log + esyslog "daemon.err" "rc-scripts" "$*" + + LAST_E_CMD=eerror + return 0 +} + +# void ebegin(char* message) +# +# show a message indicating the start of a process +# +ebegin() { + local msg="$*" dots spaces=${RC_DOT_PATTERN//?/ } + [[ ${RC_QUIET_STDOUT} == yes ]] && return 0 + + if [[ -n ${RC_DOT_PATTERN} ]]; then + dots=$(printf "%$(( COLS - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '') + dots=${dots//${spaces}/${RC_DOT_PATTERN}} + msg="${msg}${dots}" + else + msg="${msg} ..." + fi + einfon "${msg}" + [[ ${RC_ENDCOL} == yes ]] && echo + + LAST_E_LEN=$(( 3 + ${#RC_INDENTATION} + ${#msg} )) + LAST_E_CMD=ebegin + return 0 +} + +# void _eend(int error, char *efunc, char* errstr) +# +# indicate the completion of process, called from eend/ewend +# if error, show errstr via efunc +# +# This function is private to functions.sh. Do not call it from a +# script. +# +_eend() { + local retval=${1:-0} efunc=${2:-eerror} msg + shift 2 + + if [[ ${retval} == 0 ]]; then + [[ ${RC_QUIET_STDOUT} == yes ]] && return 0 + msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}" + else + if [[ -n "$*" ]]; then + ${efunc} "$*" + fi + msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}" + fi + + if [[ ${RC_ENDCOL} == yes ]]; then + echo -e "${ENDCOL} ${msg}" + else + [[ ${LAST_E_CMD} == ebegin ]] || LAST_E_LEN=0 + printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}" + fi + + return ${retval} +} + +# void eend(int error, char* errstr) +# +# indicate the completion of process +# if error, show errstr via eerror +# +eend() { + local retval=${1:-0} + shift + + _eend ${retval} eerror "$*" + + LAST_E_CMD=eend + return $retval +} + +# void ewend(int error, char* errstr) +# +# indicate the completion of process +# if error, show errstr via ewarn +# +ewend() { + local retval=${1:-0} + shift + + _eend ${retval} ewarn "$*" + + LAST_E_CMD=ewend + return $retval +} + +# v-e-commands honor RC_VERBOSE which defaults to no. +# The condition is negated so the return value will be zero. +veinfo() { [[ "${RC_VERBOSE}" != yes ]] || einfo "$@"; } +veinfon() { [[ "${RC_VERBOSE}" != yes ]] || einfon "$@"; } +vewarn() { [[ "${RC_VERBOSE}" != yes ]] || ewarn "$@"; } +veerror() { [[ "${RC_VERBOSE}" != yes ]] || eerror "$@"; } +vebegin() { [[ "${RC_VERBOSE}" != yes ]] || ebegin "$@"; } +veend() { + [[ "${RC_VERBOSE}" == yes ]] && { eend "$@"; return $?; } + return ${1:-0} +} +veend() { + [[ "${RC_VERBOSE}" == yes ]] && { ewend "$@"; return $?; } + return ${1:-0} +} + +# char *KV_major(string) +# +# Return the Major (X of X.Y.Z) kernel version +# +KV_major() { + [[ -z $1 ]] && return 1 + + local KV=$@ + echo ${KV%%.*} +} + +# char *KV_minor(string) +# +# Return the Minor (Y of X.Y.Z) kernel version +# +KV_minor() { + [[ -z $1 ]] && return 1 + + local KV=$@ + KV=${KV#*.} + echo ${KV%%.*} +} + +# char *KV_micro(string) +# +# Return the Micro (Z of X.Y.Z) kernel version. +# +KV_micro() { + [[ -z $1 ]] && return 1 + + local KV=$@ + KV=${KV#*.*.} + echo ${KV%%[^[:digit:]]*} +} + +# int KV_to_int(string) +# +# Convert a string type kernel version (2.4.0) to an int (132096) +# for easy compairing or versions ... +# +KV_to_int() { + [[ -z $1 ]] && return 1 + + local KV_MAJOR=$(KV_major "$1") + local KV_MINOR=$(KV_minor "$1") + local KV_MICRO=$(KV_micro "$1") + local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) + + # We make version 2.2.0 the minimum version we will handle as + # a sanity check ... if its less, we fail ... + if [[ ${KV_int} -ge 131584 ]] ; then + echo "${KV_int}" + return 0 + fi + + return 1 +} + +# int get_KV() +# +# Return the kernel version (major, minor and micro concated) as an integer. +# Assumes X and Y of X.Y.Z are numbers. Also assumes that some leading +# portion of Z is a number. +# e.g. 2.4.25, 2.6.10, 2.6.4-rc3, 2.2.40-poop, 2.0.15+foo +# +get_KV() { + local KV=$(uname -r) + + echo $(KV_to_int "${KV}") + + return $? +} + +# bool get_bootparam(param) +# +# return 0 if gentoo=param was passed to the kernel +# +# EXAMPLE: if get_bootparam "nodevfs" ; then .... +# +get_bootparam() { + local x copt params retval=1 + + [ ! -r "/proc/cmdline" ] && return 1 + + for copt in $(< /proc/cmdline) + do + if [ "${copt%=*}" = "gentoo" ] + then + params="$(gawk -v PARAMS="${copt##*=}" ' + BEGIN { + split(PARAMS, nodes, ",") + for (x in nodes) + print nodes[x] + }')" + + # Parse gentoo option + for x in ${params} + do + if [ "${x}" = "$1" ] + then +# echo "YES" + retval=0 + fi + done + fi + done + + return ${retval} +} + +# Safer way to list the contents of a directory, +# as it do not have the "empty dir bug". +# +# char *dolisting(param) +# +# print a list of the directory contents +# +# NOTE: quote the params if they contain globs. +# also, error checking is not that extensive ... +# +dolisting() { + local x= + local y= + local tmpstr= + local mylist= + local mypath="$*" + + if [ "${mypath%/\*}" != "${mypath}" ] + then + mypath="${mypath%/\*}" + fi + + for x in ${mypath} + do + [ ! -e "${x}" ] && continue + + if [ ! -d "${x}" ] && ( [ -L "${x}" -o -f "${x}" ] ) + then + mylist="${mylist} $(ls "${x}" 2> /dev/null)" + else + [ "${x%/}" != "${x}" ] && x="${x%/}" + + cd "${x}"; tmpstr="$(ls)" + + for y in ${tmpstr} + do + mylist="${mylist} ${x}/${y}" + done + fi + done + + echo "${mylist}" +} + +# char *add_suffix(char * configfile) +# +# Returns a config file name with the softlevel suffix +# appended to it. For use with multi-config services. +add_suffix() { + if [ "${RC_USE_CONFIG_PROFILE}" = "yes" -a -e "$1.${DEFAULTLEVEL}" ] + then + echo "$1.${DEFAULTLEVEL}" + else + echo "$1" + fi + + return 0 +} + +# Network filesystems list for common use in rc-scripts. +# This variable is used in is_net_fs and other places such as +# localmount. +NET_FS_LIST="afs cifs coda gfs ncpfs nfs nfs4 shfs smbfs" + +# bool is_net_fs(path) +# +# return 0 if path is the mountpoint of a networked filesystem +# +# EXAMPLE: if is_net_fs / ; then ... +# +is_net_fs() { + local fstype + # /proc/mounts is always accurate but may not always be available + if [[ -e /proc/mounts ]]; then + fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts ) + else + fstype=$( mount | sed -n -e 's:.* on '"$1"' type \([^ ]*\).*:\1:p' ) + fi + [[ " ${NET_FS_LIST} " == *" ${fstype} "* ]] + return $? +} + +# bool is_uml_sys() +# +# return 0 if the currently running system is User Mode Linux +# +# EXAMPLE: if is_uml_sys ; then ... +# +is_uml_sys() { + grep -qs 'UML' /proc/cpuinfo + return $? +} + +# bool is_vserver_sys() +# +# return 0 if the currently running system is a Linux VServer +# +# EXAMPLE: if is_vserver_sys ; then ... +# +is_vserver_sys() { + grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status + return $? +} + +# bool get_mount_fstab(path) +# +# return the parameters to pass to the mount command generated from fstab +# +# EXAMPLE: cmd=$( get_mount_fstab /proc ) +# cmd=${cmd:--t proc none /proc} +# mount -n ${cmd} +# +get_mount_fstab() { + awk '$1 ~ "^#" { next } + $2 == "'$*'" { if (found++ == 0) { print "-t "$3,"-o "$4,$1,$2 } } + END { if (found > 1) { print "More than one entry for '$*' found in /etc/fstab!" > "/dev/stderr" } } + ' /etc/fstab +} + +# char *reverse_list(list) +# +# Returns the reversed order of list +# +reverse_list() { + for (( i = $# ; i > 0 ; --i )); do + echo -n "${!i} " + done +} + +# bool is_older_than(reference, files/dirs to check) +# +# return 0 if any of the files/dirs are newer than +# the reference file +# +# EXAMPLE: if is_older_than a.out *.o ; then ... +is_older_than() { + local x= + local ref="$1" + shift + + for x in "$@" ; do + [[ ${x} -nt ${ref} ]] && return 0 + + if [[ -d ${x} ]] ; then + is_older_than "${ref}" "${x}"/* && return 0 + fi + done + + return 1 +} + +if [ -z "${EBUILD}" ] ; then + # Setup a basic $PATH. Just add system default to existing. + # This should solve both /sbin and /usr/sbin not present when + # doing 'su -c foo', or for something like: PATH= rcscript start + PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:${PATH}" + + if [ "$(/sbin/consoletype 2> /dev/null)" = "serial" ] ; then + # We do not want colors/endcols on serial terminals + RC_NOCOLOR="yes" + RC_ENDCOL="no" + fi + + for arg in "$@" ; do + case "${arg}" in + # Lastly check if the user disabled it with --nocolor argument + --nocolor|-nc) + RC_NOCOLOR="yes" + ;; + esac + done + +else + # Should we use colors ? + if [[ $* != *depend* ]]; then + # Check user pref in portage + RC_NOCOLOR="$(portageq envvar NOCOLOR 2>/dev/null)" + [ "${RC_NOCOLOR}" = "true" ] && RC_NOCOLOR="yes" + else + # We do not want colors during emerge depend + RC_NOCOLOR="yes" + # No output is seen during emerge depend, so this is not needed. + RC_ENDCOL="no" + fi +fi + +if [[ -n ${EBUILD} && $* == *depend* ]]; then + # We do not want stty to run during emerge depend + COLS=80 +else + # Setup COLS and ENDCOL so eend can line up the [ ok ] + COLS=${COLUMNS:-0} # bash's internal COLUMNS variable + (( COLS == 0 )) && COLS=$(stty size 2>/dev/null | cut -d' ' -f2) + (( COLS > 0 )) || (( COLS = 80 )) # width of [ ok ] == 7 +fi + +if [[ ${RC_ENDCOL} == yes ]]; then + ENDCOL=$'\e[A\e['$(( COLS - 7 ))'G' +else + ENDCOL='' +fi + +# Setup the colors so our messages all look pretty +if [[ ${RC_NOCOLOR} == yes ]]; then + unset GOOD WARN BAD NORMAL HILITE BRACKET +else + GOOD=$'\e[32;01m' + WARN=$'\e[33;01m' + BAD=$'\e[31;01m' + NORMAL=$'\e[0m' + HILITE=$'\e[36;01m' + BRACKET=$'\e[34;01m' +fi + +# vim:ts=4 +# }}} diff --git a/etc/grml/screen_multisession b/etc/grml/screen_multisession new file mode 100644 index 0000000..d81e8e1 --- /dev/null +++ b/etc/grml/screen_multisession @@ -0,0 +1,12 @@ +# who is allowed to connect via multiuser-mode? +addacl root,grml + +# allow multiuser-mode +multiuser on + +# redefine C-a +defescape ^Bb +escape ^Bb + +# no nag-screen, please +startup_message off diff --git a/etc/grml/screenrc b/etc/grml/screenrc new file mode 100644 index 0000000..056ad8e --- /dev/null +++ b/etc/grml/screenrc @@ -0,0 +1,149 @@ +# Filename: screenrc +# Purpose: config file for GNU screen +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Sam Okt 14 22:56:18 CEST 2006 [mika] +################################################################################ + + backtick 1 0 60 /usr/bin/cpu-screen + backtick 2 0 60 /usr/bin/ip-screen + caption always "%{+b rk}$USER@%{wk}%H | %{yk}(load: %l |%{rk} cpu: %1` | %{Gk}net: %2`) %-21=%{wk}%D %d.%m.%Y %0c" + hardstatus alwayslastline "%{wr}%n%f %t %{kw} | %?%-Lw%?%{wb}%n*%f %t%?(%u)%?%{kw}%?%+Lw%? %{wk}" + +# hardstatus alwayslastline "%{bw}%1`%= " +# detach on hangup + autodetach on # default: on + crlf off # default: off + deflogin off # default: on +# defsilence off # default: off +# hardcopy_append on # default: off + hardcopy_append off # default: off + nethack on # default: off +# don't display the copyright page + startup_message off # default: on +# no annoying audible bell, please + vbell on + + defscrollback 1000 # default: 100 +# msgminwait 3 # default: 1 + silencewait 15 # default: 30 + + hardcopydir $HOME/.hardcopy + +# fix the "screen.linux" terminal problem (see Debian BTS #238355 + #239776) +# term linux + + shell zsh + +# "sorendition": set the colors for +# the "messages" and "text marking" +# (ie text you mark in copy mode): + sorendition 10 99 # default! + +# use %n to display the window number and %t for its title: + activity "activity in %n (%t) [%w:%s]~" + +# pass on the "beep" (CTRL-G) by adding a '~': + bell "bell in %n (%t) [%w:%s]~" + +# pow_detach_msg: Message shown when session +# gets power detached. + pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." + +# vbell_msg: Message shown when the +# "virtual bell" rings. + vbell_msg " *beep* " + +# Key bindings +# Remove some default key bindings by binding +# them to "nothing" (empty right-hand-side): +# bind . dumptermcap # default + bind . + bind ^\ + bind \\ + +# 040126 To be able to select windows with n > 9 -> +# press "C-a - #" instead of just "C-a #" + bind - command -c select_1n + bind -c select_1n 0 select 10 + bind -c select_1n 1 select 11 + bind -c select_1n 2 select 12 + bind -c select_1n 3 select 13 + bind -c select_1n 4 select 14 + bind -c select_1n 5 select 15 + bind -c select_1n 6 select 16 + bind -c select_1n 7 select 17 + bind -c select_1n 8 select 18 + bind -c select_1n 9 select 19 + bind -c select_1n - command -c select_2n + bind -c select_2n 0 select 20 + bind -c select_2n 1 select 21 + bind -c select_2n 2 select 22 + bind -c select_2n 3 select 23 + bind -c select_2n 4 select 24 + bind -c select_2n 5 select 25 + bind -c select_2n 6 select 26 + bind -c select_2n 7 select 27 + bind -c select_2n 8 select 28 + bind -c select_2n 9 select 29 + bind -c select_2n - select - + +# Use the function keys F11 and F12 to cycle backwards/forwards in +# the list of existing windows: +# bindkey -k F1 prev +# bindkey -k F2 next + +# remove some stupid / dangerous key bindings + bind k + bind ^k + bind . + bind ^\ + bind \\ + bind ^h + bind h hardcopy +# make them better + bind 'K' kill + bind 'I' login on + bind 'O' login off + bind '}' history + + bind G screen -t 'google' w3m www.google.com + bind H screen -t HeiseTicker w3m www.heise.de/newsticker/pda/data/paket4.html + +# Paste - use 'P' instead of ']': +# bind P # unbound by default + bind P paste . + +# Yet another hack: +# Prepend/append register [/] to the paste if ^a^] is pressed. +# This lets me have autoindent mode in vi. +# register [ "\033:se noai\015a" +# register ] "\033:se ai\015a" +# bind ^] paste [.] + +# X - a fast way to lock the current screen. + bind X lockscreen + +# 030511 Workaround for stupid machines without xmodmap ;-) + bindkey -t °a stuff "ä" + bindkey -t °A stuff "Ä" + bindkey -t °o stuff "ö" + bindkey -t °O stuff "Ö" + bindkey -t °u stuff "ü" + bindkey -t °U stuff "Ü" + bindkey -t °s stuff "ß" + + msgwait 1 + version +# change back to showing messages +# for duration of two seconds: + msgwait 2 + +# To get screen to add lines to xterm's scrollback buffer, uncomment the +# following termcapinfo line which tells xterm to use the normal screen buffer +# (which has scrollback), not the alternate screen buffer. + termcapinfo xterm|xterms|xs|rxvt ti@:te@ + +# Welcome the user: + echo "welcome BoFH!" diff --git a/etc/grml/screenrc_acpi b/etc/grml/screenrc_acpi new file mode 100644 index 0000000..781731b --- /dev/null +++ b/etc/grml/screenrc_acpi @@ -0,0 +1,144 @@ +# Filename: screenrc +# Purpose: config file for GNU screen +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Sam Mai 27 23:16:23 CEST 2006 [mika] +################################################################################ + + backtick 1 60 60 /usr/bin/cpu-screen + backtick 2 60 60 /usr/bin/yacpi -t + caption always "%{+b rk}$USER@%{wk}%H | %{yk}(load: %l |%{rk} cpu: %1` | %{Gk}acpi: %2`) %-21=%{wk}%D %d.%m.%Y %0c" + hardstatus alwayslastline "%{wr}%n%f %t %{kw} | %?%-Lw%?%{wb}%n*%f %t%?(%u)%?%{kw}%?%+Lw%? %{wk}" + +# hardstatus alwayslastline "%{bw}%1`%= " +# detach on hangup + autodetach on # default: on + crlf off # default: off + deflogin off # default: on +# defsilence off # default: off +# hardcopy_append on # default: off + hardcopy_append off # default: off + nethack on # default: off +# don't display the copyright page + startup_message off # default: on +# no annoying audible bell, please + vbell on + + defscrollback 1000 # default: 100 +# msgminwait 3 # default: 1 + silencewait 15 # default: 30 + + hardcopydir $HOME/.hardcopy + +# fix the "screen.linux" terminal problem (see Debian BTS #238355 + #239776) +# term linux + + shell zsh + +# "sorendition": set the colors for +# the "messages" and "text marking" +# (ie text you mark in copy mode): + sorendition 10 99 # default! + +# use %n to display the window number and %t for its title: + activity "activity in %n (%t) [%w:%s]~" + +# pass on the "beep" (CTRL-G) by adding a '~': + bell "bell in %n (%t) [%w:%s]~" + +# pow_detach_msg: Message shown when session +# gets power detached. + pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." + +# vbell_msg: Message shown when the +# "virtual bell" rings. + vbell_msg " *beep* " + +# Key bindings +# Remove some default key bindings by binding +# them to "nothing" (empty right-hand-side): +# bind . dumptermcap # default + bind . + bind ^\ + bind \\ + +# 040126 To be able to select windows with n > 9 -> +# press "C-a - #" instead of just "C-a #" + bind - command -c select_1n + bind -c select_1n 0 select 10 + bind -c select_1n 1 select 11 + bind -c select_1n 2 select 12 + bind -c select_1n 3 select 13 + bind -c select_1n 4 select 14 + bind -c select_1n 5 select 15 + bind -c select_1n 6 select 16 + bind -c select_1n 7 select 17 + bind -c select_1n 8 select 18 + bind -c select_1n 9 select 19 + bind -c select_1n - command -c select_2n + bind -c select_2n 0 select 20 + bind -c select_2n 1 select 21 + bind -c select_2n 2 select 22 + bind -c select_2n 3 select 23 + bind -c select_2n 4 select 24 + bind -c select_2n 5 select 25 + bind -c select_2n 6 select 26 + bind -c select_2n 7 select 27 + bind -c select_2n 8 select 28 + bind -c select_2n 9 select 29 + bind -c select_2n - select - + +# Use the function keys F11 and F12 to cycle backwards/forwards in +# the list of existing windows: +# bindkey -k F1 prev +# bindkey -k F2 next + +# remove some stupid / dangerous key bindings + bind k + bind ^k + bind . + bind ^\ + bind \\ + bind ^h + bind h hardcopy +# make them better + bind 'K' kill + bind 'I' login on + bind 'O' login off + bind '}' history + + bind G screen -t 'google' w3m www.google.com + bind H screen -t HeiseTicker w3m www.heise.de/newsticker/pda/data/paket4.html + +# Paste - use 'P' instead of ']': +# bind P # unbound by default + bind P paste . + +# Yet another hack: +# Prepend/append register [/] to the paste if ^a^] is pressed. +# This lets me have autoindent mode in vi. + register [ "\033:se noai\015a" + register ] "\033:se ai\015a" + bind ^] paste [.] + +# X - a fast way to lock the current screen. + bind X lockscreen + +# 030511 Workaround for stupid machines without xmodmap ;-) + bindkey -t °a stuff "ä" + bindkey -t °A stuff "Ä" + bindkey -t °o stuff "ö" + bindkey -t °O stuff "Ö" + bindkey -t °u stuff "ü" + bindkey -t °U stuff "Ü" + bindkey -t °s stuff "ß" + + msgwait 1 + version +# change back to showing messages +# for duration of two seconds: + msgwait 2 +# +# Welcome the user: + echo "welcome BoFH!" diff --git a/etc/grml/sysexits-sh b/etc/grml/sysexits-sh new file mode 100644 index 0000000..55e6d95 --- /dev/null +++ b/etc/grml/sysexits-sh @@ -0,0 +1,53 @@ +# +# Copyright (c) 1987, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)sysexits.h 8.1 (Berkeley) 6/2/93 +# + + +EX_OK=0 # successful termination + +EX__BASE=64 # base value for error messages + +EX_USAGE=64 # command line usage error +EX_DATAERR=65 # data format error +EX_NOINPUT=66 # cannot open input +EX_NOUSER=67 # addressee unknown +EX_NOHOST=68 # host name unknown +EX_UNAVAILABLE=69 # service unavailable +EX_SOFTWARE=70 # internal software error +EX_OSERR=71 # system error (e.g., can't fork) +EX_OSFILE=72 # critical OS file missing +EX_CANTCREAT=73 # can't create (user) output file +EX_IOERR=74 # input/output error +EX_TEMPFAIL=75 # temp failure; user is invited to retry +EX_PROTOCOL=76 # remote error in protocol +EX_NOPERM=77 # permission denied +EX_CONFIG=78 # configuration error + +EX__MAX=78 # maximum listed value diff --git a/etc/grml_colors b/etc/grml_colors new file mode 100644 index 0000000..e4ac7b7 --- /dev/null +++ b/etc/grml_colors @@ -0,0 +1,27 @@ +# Filename: grml_colors +# Purpose: color definition file +# Authors: (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fri May 12 22:09:25 CEST 2006 [mika] +################################################################################ + +# ANSI COLORS +CRE=" " +NORMAL="" +# RED: Failure or error message +RED="" +# GREEN: Success message +GREEN="" +# YELLOW: Descriptions +YELLOW="" +# BLUE: System messages +BLUE="" +# MAGENTA: Found devices or drivers +MAGENTA="" +# CYAN: Questions +CYAN="" +# BOLD WHITE: Hint +WHITE="" + +## END OF FILE ################################################################# diff --git a/etc/grml_nocolors b/etc/grml_nocolors new file mode 100644 index 0000000..40ef7df --- /dev/null +++ b/etc/grml_nocolors @@ -0,0 +1,32 @@ +# Filename: grml_nocolors +# Purpose: "no colors" definition file - don't use any escape sequences +# Authors: (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fri May 12 22:09:28 CEST 2006 [mika] +################################################################################ +# Notice: if you want to use colors in your script you probably are +# searching for /etc/grml_colors. This file is meant to be used +# when you don't want to get escape sequences in output. For example +# this is useful when logging stuff to a file. +################################################################################ + +# ANSI COLORS +CRE='' +NORMAL='' +# RED: Failure or error message +RED='' +# GREEN: Success message +GREEN='' +# YELLOW: Descriptions +YELLOW='' +# BLUE: System messages +BLUE='' +# MAGENTA: Found devices or drivers +MAGENTA='' +# CYAN: Questions +CYAN='' +# BOLD WHITE: Hint +WHITE='' + +## END OF FILE ################################################################# diff --git a/etc/network/interfaces.examples b/etc/network/interfaces.examples new file mode 100644 index 0000000..8ffde07 --- /dev/null +++ b/etc/network/interfaces.examples @@ -0,0 +1,106 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +# automatically added when upgrading +auto lo +iface lo inet loopback + +# Sample entries: +# =============== + +# static entry: +# auto eth1 +# iface eth1 inet static +# address 192.168.0.1 +# netmask 255.255.255.0 +# network 192.168.0.0 +# broadcast 192.168.0.255 +# gateway 192.168.0.1 +# dns-search foo.example +# dns-nameservers 192.168.0.10 192.168.0.20 +# +# vconfig: +# auto eth0.1 +# iface eth0.1 inet manual +# pre-up vconfig add eth0.1 +# up ifconfig eth0 0.0.0.0 promisc up +# post-down vconfig rem eth0.1 + +# Ad-hoc WLAN Network: +# auto eth1 +# iface eth1 inet static +# address 192.168.0.1 +# netmask 255.255.255.0 +# wireless_mode ad-hoc +# wireless_essid foobar +# wireless_channel 11 + +# WLAN: +# auto eth1 +# iface eth1 inet dhcp +# wireless_essid foo +# wireless_nick bar +# wireless_key 11111111111111111111111111 +# wireless_keymode restricted +# wireless_keymode open +# wireless_mode managed + +# DSL Interface +# allow-hotplug dsl +# iface dsl inet manual +# up ip link set $IFACE up +# up ip -6 addr flush dev $IFACE || true +# down ip link set $IFACE down + +# Mapping - bring up via e.g. 'ifup eth0=dhcp': +# iface dhcp inet dhcp + +# Mapping - bring up via e.g. 'ifup -v eth0=home': +# auto eth1 +# iface home inet dhcp +# wireless_essid foo +# wireless_nick bar +# wireless_key 11111111111111111111111111 +# wireless_keymode restricted + +# More complex mapping-setup: +# auto eth0 +# mapping eth0 +# script /etc/network/ping-places.sh +# map 192.168.0.90/24 192.168.0.42 home +# map 129.27.140.238/24 129.27.140.241 spsc +# map 192.168.0.90/24 192.168.0.100 sevian7 +# map 192.168.0.90/24 192.168.0.1 annenhof +# map 195.177.251.50/255.255.255.224 195.177.251.33 kunstlabor +# +# iface home inet static +# address 192.168.0.90 +# netmask 255.255.255.0 +# gateway 192.168.0.42 +# mtu 1400 +# +# up cp /etc/apt/sources.list.home /etc/apt/sources.list +# up cp /etc/resolv.conf.home /etc/resolv.conf +# +# +# iface spsc inet static +# address 129.27.140.238 +# netmask 255.255.255.0 +# gateway 129.27.140.1 +# +# up cp /etc/apt/sources.list.spsc /etc/apt/sources.list +# up cp /etc/resolv.conf.spsc /etc/resolv.conf +# +# iface annenhof inet static +# address 192.168.0.90 +# netmask 255.255.255.0 +# gateway 192.168.0.1 +# +# up cp /etc/resolv.conf.annenhof /etc/resolv.conf +# +# iface sevian7 inet dhcp +# +# iface kunstlabor inet dhcp +# up cp /etc/apt/sources.list.kunstlabor /etc/apt/sources.list + +# EOF diff --git a/etc/skel/.vim/klammerpaare.vim b/etc/skel/.vim/klammerpaare.vim new file mode 100644 index 0000000..55c1a91 --- /dev/null +++ b/etc/skel/.vim/klammerpaare.vim @@ -0,0 +1,62 @@ +syn region klammer10a matchgroup=KLAMMER10a start='\[' end='\]' contained +syn region klammer10b matchgroup=KLAMMER10a start='{' end='}' contained +syn region klammer9a matchgroup=KLAMMER9a start='\[' end='\]' contained contains=klammer10a,klammer10b +syn region klammer9b matchgroup=KLAMMER9a start='{' end='}' contained contains=klammer10a,klammer10b +syn region klammer8a matchgroup=KLAMMER8a start='\[' end='\]' contained contains=klammer9a,klammer9b +syn region klammer8b matchgroup=KLAMMER8a start='{' end='}' contained contains=klammer9a,klammer9b +syn region klammer7a matchgroup=KLAMMER7a start='\[' end='\]' contained contains=klammer8a,klammer8b +syn region klammer7b matchgroup=KLAMMER7a start='{' end='}' contained contains=klammer8a,klammer8b +syn region klammer6a matchgroup=KLAMMER6a start='\[' end='\]' contained contains=klammer7a,klammer7b +syn region klammer6b matchgroup=KLAMMER6a start='{' end='}' contained contains=klammer7a,klammer7b +syn region klammer5a matchgroup=KLAMMER5a start='\[' end='\]' contained contains=klammer6a,klammer6b +syn region klammer5b matchgroup=KLAMMER5a start='{' end='}' contained contains=klammer6a,klammer6b +syn region klammer4a matchgroup=KLAMMER4a start='\[' end='\]' contained contains=klammer5a,klammer5b +syn region klammer4b matchgroup=KLAMMER4a start='{' end='}' contained contains=klammer5a,klammer5b +syn region klammer3a matchgroup=KLAMMER3a start='\[' end='\]' contained contains=klammer4a,klammer4b +syn region klammer3b matchgroup=KLAMMER3a start='{' end='}' contained contains=klammer4a,klammer4b +syn region klammer2a matchgroup=KLAMMER2a start='\[' end='\]' contained contains=klammer3a,klammer3b +syn region klammer2b matchgroup=KLAMMER2a start='{' end='}' contained contains=klammer3a,klammer3b +syn region klammer1a matchgroup=KLAMMER1a start='\[' end='\]' contains=klammer2a,klammer2b +syn region klammer1b matchgroup=KLAMMER1a start='{' end='}' contains=klammer2a,klammer2b + +hi klammer1a ctermfg=Red ctermbg=Black guifg=Red guibg=Black +hi klammer1b ctermfg=Red ctermbg=Black guifg=Red guibg=Black +hi KLAMMER1b ctermfg=Red ctermbg=Black guifg=Red guibg=Black + +hi klammer2a ctermfg=Green ctermbg=Black guifg=Green guibg=Black +hi klammer2b ctermfg=Green ctermbg=Black guifg=Green guibg=Black +hi KLAMMER2b ctermfg=Green ctermbg=Black guifg=Green guibg=Black + +hi klammer3a ctermfg=Cyan ctermbg=Black guifg=Cyan guibg=Black +hi klammer3b ctermfg=Cyan ctermbg=Black guifg=Cyan guibg=Black +hi KLAMMER3b ctermfg=Cyan ctermbg=Black guifg=Cyan guibg=Black + +hi klammer4a ctermfg=Yellow ctermbg=Black guifg=Yellow guibg=Black +hi klammer4b ctermfg=Yellow ctermbg=Black guifg=Yellow guibg=Black +hi KLAMMER4b ctermfg=Yellow ctermbg=Black guifg=Yellow guibg=Black + +hi klammer5a ctermfg=Magenta ctermbg=Black guifg=Magenta guibg=Black +hi klammer5b ctermfg=Magenta ctermbg=Black guifg=Magenta guibg=Black +hi KLAMMER5b ctermfg=Magenta ctermbg=Black guifg=Magenta guibg=Black + +hi klammer6a ctermfg=Darkred ctermbg=Black guifg=Darkred guibg=Black +hi klammer6b ctermfg=Darkred ctermbg=Black guifg=Darkred guibg=Black +hi KLAMMER6b ctermfg=Darkred ctermbg=Black guifg=Darkred guibg=Black + +hi klammer7a ctermfg=Darkgreen ctermbg=Black guifg=Darkgreen guibg=Black +hi klammer7b ctermfg=Darkgreen ctermbg=Black guifg=Darkgreen guibg=Black +hi KLAMMER7b ctermfg=Darkgreen ctermbg=Black guifg=Darkgreen guibg=Black + +hi klammer8a ctermfg=Darkcyan ctermbg=Black guifg=Darkcyan guibg=Black +hi klammer8b ctermfg=Darkcyan ctermbg=Black guifg=Darkcyan guibg=Black +hi KLAMMER8b ctermfg=Darkcyan ctermbg=Black guifg=Darkcyan guibg=Black + +hi klammer9a ctermfg=Darkyellow ctermbg=Black guifg=Darkyellow guibg=Black +hi klammer9b ctermfg=Darkyellow ctermbg=Black guifg=Darkyellow guibg=Black +hi KLAMMER9b ctermfg=Darkyellow ctermbg=Black guifg=Darkyellow guibg=Black + +hi klammer10a ctermfg=Darkmagenta ctermbg=Black guifg=Darkmagenta guibg=Black +hi klammer10b ctermfg=Darkmagenta ctermbg=Black guifg=Darkmagenta guibg=Black +hi KLAMMER10b ctermfg=Darkmagenta ctermbg=Black guifg=Darkmagenta guibg=Black + +syn sync minlines=300 diff --git a/etc/skel/.vim/spellfile.add b/etc/skel/.vim/spellfile.add new file mode 100644 index 0000000..e69de29 diff --git a/etc/skel/.vimrc b/etc/skel/.vimrc new file mode 100644 index 0000000..9da7583 --- /dev/null +++ b/etc/skel/.vimrc @@ -0,0 +1,144 @@ +" Filename: .vimrc +" Purpose: configuration file for editor vim +" Authors: grml-team (grml.org), (c) Michael Prokop +" Bug-Reports: see http://grml.org/bugs/ +" License: This file is licensed under the GPL v2. +" Latest change: Mon Jun 05 16:30:29 CEST 2006 [mika] +"############################################################################### +" Thanks to Sven Guckes for his template! +"############################################################################### + +" be no-compatible with vi + set nocp +" turn these ON: + set digraph ek hidden ruler sc vb wmnu +" turn these OFF ("no" prefix): + set noeb noet nosol +" non-toggles: + set bs=2 fo=cqrt ls=2 shm=at tw=72 ww=<,>,h,l + set comments=b:#,:%,fb:-,n:>,n:) +" set list listchars=tab:»·,trail:· + set listchars=eol:$,precedes:«,extends:»,tab:»·,trail:· + set viminfo=%,'50,\"100,:100,n~/.viminfo + +" autocommands: +" when the file type is "mail" then set the textwidth to "70": + au FileType mail set tw=70 +" When editing a file, always jump to the last cursor position +" au BufReadPost * if line("'\"") | exe "'\"" | endif + autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif + +" some colors - as an example "white on black" [use bold fonts]: +" hi normal ctermfg=white ctermbg=black guifg=white guibg=black +" hi nontext ctermfg=blue ctermbg=black guifg=blue guibg=black +" switch on syntax coloring!! "bunt ist meine lieblingsfarbe!" :-) + syn on + +" some useful mappings: + set pastetoggle= + +" with F7 copy all current buffer to clipboard, or a selection. +" with shift-F7, paste all clipboard contents +" see: http://www.vim.org/tips/tip.php?tip_id=964 + map :w !xclip + vmap "*y + map :r!xclip -o + +" remove/delete trailing whitespace: + nmap ;tr :%s/\s\+$// + vmap ;tr :s/\s\+$// + +" execute the command in the current line (minus the first word, which +" is intended to be a shell prompt) and insert the output in the buffer + map ,e ^wy$:r!" + +" update timestamp + iab YDATE =strftime("%a %b %d %T %Z %Y") + map ,L 1G/Latest change:\s*/e+1CYDATE + +" the shell in a box mode. found in posting by Stefan `Sec` Zehl +" in newsgroup de.alt.sysadmin.recovery, msg­id: +" Requires zsh for "print -P $PS1" / replace if needed. +" Your prompt should end in > (and only contain one) +" so run something like: +" % export PS1='%n@%m > ' +" in your zsh, press ',l' and for running commands, end mode via + map __start :imap __cmd\|imap __end + noremap __end :iunmap \|iunmap :"Vish ended. + noremap __cmd 0f>ly$:r !";print -P $PS1A + noremap __scmd :r !print -P $PS1A + map ,l __start__scmd + +" Kill quote spaces (when quoting a quote) + map ,kqs mz:%s/^> >/>>/ + +" Vim 7 brings cool new features - see ':he version7'! +" The coolest features of Vim7 by mika +" ==================================== +" 1) omni/intellisense completion: use CTRL-X CTRL-O in insert mode to start it [:he compl-omni] +" 2) internal grep: vimgrep foo bar [:he vimgrep] +" 3) tab pages: vim -p file1 file2 - then use the :tab command [:he tabpage] +" gt -> next tab +" gT -> previous tab +" 4) undo branches: :undolist / :earlier 2h / :later 2h +" instead of using u (undo) and CTRL-R (redo), you might experiment with g- +" and g+ to move through the text state [:he undolist] +" 5) browse remote directories via scp using netrw plugin: :edit scp://host//path/to/ [:he netrw.vim] +" 6) start editing the filename under the cursor and jump to the line +" number following the file name: press gF [:he gF] +" 7) press 'CTRL-W F' to start editing the filename under the cursor in a new +" window and jump to the line number following the file name. [:he CTRL-W_F] +" 8) spelling correction (see later for its configuration) [:he spell]: +" ]s -> Move to next misspelled word after the cursor. +" zg -> Add word under the cursor as a good word to the first name in 'spellfile' +" zw -> Like "zg" but mark the word as a wrong (bad) word. +" z= -> For the word under/after the cursor suggest correctly spelled words. +" 9) highlight active cursor line using 'set cursorline' [:he cursorline] +" 10) delete inner quotes inside HTML-code using cit (see its mapping later) [:he tag-blocks] +" +if version >= 700 + " Thanks for some ideas to Christian 'strcat' Schneider and Julius Plenz + " turn spelling on by default: + " set spell + " toggle spelling with F12 key: + map :set spell!:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3) + set spellfile=~/.vim/spellfile.add + " change language - get spell files from http://ftp.vim.org/pub/vim/runtime/spell/ => + " cd ~/.vim/spell && wget http://ftp.vim.org/pub/vim/runtime/spell/de.latin1.spl + " change to german: + " set spelllang=de + " highlight spelling correction: + " highlight SpellBad term=reverse ctermbg=12 gui=undercurl guisp=Red " badly spelled word + " highlight SpellCap term=reverse ctermbg=9 gui=undercurl guisp=Blue " word with wrong caps + " highlight SpellRare term=reverse ctermbg=13 gui=undercurl guisp=Magenta " rare word + " highlight SpellLocale term=underline ctermbg=11 gui=undercurl guisp=DarkCyan " word only exists in other region + + " set maximum number of suggestions listed to top 10 items: + set sps=best,10 + + " highlight matching parens: + " set matchpairs=(:),[:],{:},< :> + " let loaded_matchparen = 1 + " highlight MatchParen term=reverse ctermbg=7 guibg=cornsilk + + " highlight the cursor line and column: + " set cursorline + " highlight CursorLine term=reverse ctermbg=7 guibg=#333333 + " highlight CursorColumn guibg=#333333 + + " change inner tag - very useful e.g. within HTML-code! + " ci" will remove the text between quotes, also works for ' and ` + imap cit + + " use the popup menu also when there is only one match: + " set completeopt=menuone + " determine the maximum number of items to show in the popup menu for: + set pumheight=7 + " set completion highlighting: + " highlight Pmenu ctermbg=13 guifg=Black guibg=#BDDFFF " normal item + " highlight PmenuSel ctermbg=7 guifg=Black guibg=Orange " selected item + " highlight PmenuSbar ctermbg=7 guifg=#CCCCCC guibg=#CCCCCC " scrollbar + " highlight PmenuThumb cterm=reverse gui=reverse guifg=Black guibg=#AAAAAA " thumb of the scrollbar + +endif +"# END OF FILE ################################################################# diff --git a/etc/skel/.zshrc b/etc/skel/.zshrc new file mode 100644 index 0000000..0d9d5dd --- /dev/null +++ b/etc/skel/.zshrc @@ -0,0 +1,874 @@ +# Filename: .zshrc +# Purpose: config file for zsh +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Mon Sep 18 18:54:28 CEST 2006 [mika] +################################################################################ + +# source ~/.zshrc.global {{{ +# see /etc/zsh/zshrc for some general settings +# If you don't have write permissions to /etc/zsh/zshrc on your own +# copy the file to your $HOME as /.zshrc.global and we source it: + if [ -r ~/.zshrc.global ] ; then + . ~/.zshrc.global + fi +# }}} + +# completion system {{{ +# just make sure it is loaded in this file too + type compinit &>/dev/null || { autoload -U compinit && compinit } +# }}} + +## variables {{{ + +# set terminal property (used e.g. by msgid-chooser) + export COLORTERM="yes" + +# set default browser + if [ -z $BROWSER ] ; then + if [ -n "$DISPLAY" ] ; then + [ -x =firefox ] && export BROWSER=firefox + else + [ -x =w3m ] && export BROWSER=w3m + fi + fi + (( ${+PAGER} )) || export PAGER="less" + +# export qtdir + [ -d /usr/share/qt3 ] && export QTDIR=/usr/share/qt3 + [ -d /usr/share/qt4 ] && export QTDIR=/usr/share/qt4 + +# support running 'jikes *.java && jamvm HelloWorld' OOTB: + [ -f /usr/share/classpath/glibj.zip ] && export JIKESPATH=/usr/share/classpath/glibj.zip +# }}} + +## set options {{{ + +# Allow comments even in interactive shells i. e. +# $ uname # This command prints system informations +# zsh: bad pattern: # +# $ setopt interactivecomments +# $ uname # This command prints system informations +# Linux +# setopt interactivecomments + +# ctrl-s will no longer freeze the terminal. +# stty erase "^?" + +# }}} + +# {{{ global aliases +# These do not have to be at the beginning of the command line. +# Avoid typing cd ../../ for going two dirs down and so on +# Usage, e.g.: "$ cd ...' or just '$ ...' with 'setopt auto_cd' + alias -g '...'='../..' + alias -g '....'='../../..' +# Usage is "$ somecommand C (this pipes it into 'wc -l'): + alias -g BG='& exit' + alias -g C='|wc -l' + alias -g G='|grep' + alias -g H='|head' + alias -g Hl=' --help |& less -r' + alias -g K='|keep' + alias -g L='|less' + alias -g LL='|& less -r' + alias -g M='|most' + alias -g N='&>/dev/null' + alias -g R='| tr A-z N-za-m' + alias -g SL='| sort | less' + alias -g S='| sort' + alias -g T='|tail' + alias -g V='| vim -' +# }}} + +## aliases {{{ + +# Xterm resizing-fu. +# Based on http://svn.kitenet.net/trunk/home-full/.zshrc?rev=11710&view=log (by Joey Hess) + alias hide='echo -en "\033]50;nil2\007"' + alias tiny='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-80-*-*-c-*-iso8859-15\007"' + alias small='echo -en "\033]50;6x10\007"' + alias medium='echo -en "\033]50;-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-15\007"' + alias default='echo -e "\033]50;-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-15\007"' + alias large='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-150-*-*-c-*-iso8859-15\007"' + alias huge='echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-210-*-*-c-*-iso8859-15\007"' + alias smartfont='echo -en "\033]50;-artwiz-smoothansi-*-*-*-*-*-*-*-*-*-*-*-*\007"' + alias semifont='echo -en "\033]50;-misc-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-15\007"' +# if [ "$TERM" = "xterm" ] && [ "$LINES" -ge 50 ] && [ "$COLUMNS" -ge 100 ] && [ -z "$SSH_CONNECTION" ]; then +# large +# fi + +# general + alias da='du -sch' + alias j='jobs -l' +# alias u='translate -i' # translate + +# compile stuff + alias CO="./configure" + alias CH="./configure --help" + +# http://conkeror.mozdev.org/ + alias conkeror='firefox -chrome chrome://conkeror/content' + +# arch/tla stuff + alias ldiff='tla what-changed --diffs | less' + alias tbp='tla-buildpackage' + alias mirror='tla archive-mirror' + alias commit='tla commit' + alias merge='tla star-merge' + +# listing stuff + alias dir="ls -lSrah" + alias lad='ls -d .*(/)' # only show dot-directories + alias lsa='ls -a .*(.)' # only show dot-files + alias lss='ls -l *(s,S,t)' # only files with setgid/setuid/sticky flag + alias lsl='ls -l *(@[1,10])' # only symlinks + alias lsx='ls -l *(*[1,10])' # only executables + alias lsw='ls -ld *(R,W,X.^ND/)' # world-{readable,writable,executable} files + alias lsbig="ls -flh *(.OL[1,10])" # display the biggest files + alias lsd='ls -d *(/)' # only show directories + alias lse='ls -d *(/^F)' # only show empty directories + alias lsnew="ls -rl *(D.om[1,10])" # display the newest files + alias lsold="ls -rtlh *(D.om[1,10])" # display the oldest files + alias lssmall="ls -Srl *(.oL[1,10])" # display the smallest files + +# chmod + alias rw-='chmod 600' + alias rwx='chmod 700' + alias r--='chmod 644' + alias r-x='chmod 755' + +# some useful aliases + alias md='mkdir -p' + +# console stuff + alias cmplayer='mplayer -vo fbdev' + alias fbmplayer='mplayer -vo fbdev' + alias fblinks='links2 -driver fb' + +# ignore ~/.ssh/known_hosts entries +# alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"' + alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' + +# use colors when browsing man pages (if not using pinfo or PAGER=most) + [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man' + +# check whether Debian's package management (dpkg) is running + alias check_dpkg_running="sudo dpkg_running" +# }}} + +## useful functions {{{ + +# functions without detailed explanation: + agoogle() { ${=BROWSER} "http://groups.google.com/groups?as_uauthors=$*" ; } + bk() { cp -b ${1} ${1}_`date --iso-8601=m` } + cdiff() { diff -crd "$*" | egrep -v "^Only in |^Binary files " } + cl() { cd $1 && ls -a } # cd && ls + cvsa() { cvs add $* && cvs com -m 'initial checkin' $* } + cvsd() { cvs diff -N $* |& $PAGER } + cvsl() { cvs log $* |& $PAGER } + cvsq() { cvs -nq update } + cvsr() { rcs2log $* | $PAGER } + cvss() { cvs status -v $* } + debbug() { ${=BROWSER} "http://bugs.debian.org/$*" } + 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// /_} } + ewicti() { ${=BROWSER} http://en.wiktionary.org/wiki/${(C)1// /_} } + fir() { firefox -a firefox -remote "openURL($1)" } + ggogle() { ${=BROWSER} "http://groups.google.com/groups?q=$*" } + google() { ${=BROWSER} "http://www.google.com/search?&num=100&q=$*" } + mdiff() { diff -udrP "$1" "$2" > diff.`date "+%Y-%m-%d"`."$1" } + memusage(){ ps aux | awk '{if (NR > 1) print $5; if (NR > 2) print "+"} END { print "p" }' | dc } + mggogle() { ${=BROWSER} "http://groups.google.com/groups?selm=$*" } + netcraft(){ ${=BROWSER} "http://toolbar.netcraft.com/site_report?url=$1" } + oleo() { ${=BROWSER} "http://dict.leo.org/?search=$*" } + shtar() { gunzip -c $1 | tar -tf - -- | $PAGER } + shtgz() { tar -ztf $1 | $PAGER } + shzip() { unzip -l $1 | $PAGER } + sig() { agrep -d '^-- $' "$*" ~/.Signature } + swiki() { ${=BROWSER} http://de.wikipedia.org/wiki/Spezial:Search/${(C)1} } + udiff() { diff -urd $* | egrep -v "^Only in |^Binary files " } + viless() { vim --cmd 'let no_plugin_maps = 1' -c "so \$VIMRUNTIME/macros/less.vim" "${@:--}" } + wikide () { ${=BROWSER} http://de.wikipedia.org/wiki/"${(C)*}" } + wikien() { ${=BROWSER} http://en.wikipedia.org/wiki/"$*" } + wodeb () { ${=BROWSER} "http://packages.debian.org/cgi-bin/search_contents.pl?word=$1&version=${2:-unstable}" } + +# Function Usage: doc packagename + doc() { cd /usr/share/doc/$1 && ls } + _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 -depth 8 -quality 80 `date "+%Y-%m-%d--%H:%M:%S"`.png + cd ~/shots ; sleep 5; import -window root shot_`date --iso-8601=m`.jpg + } + + +# list images only + limg() { + local -a images + images=( *.{jpg,gif,png}(.N) ) + if [[ $#images -eq 0 ]] ; then + print "No image files found" + else + ls "$@" "$images[@]" + fi + } + + +# create pdf file from source code + makereadable() { + output=$1 + shift + a2ps --medium A4dj -E -o $output $* + ps2pdf $output + } + +# zsh with perl-regex - use it e.g. via: +# regcheck '\s\d\.\d{3}\.\d{3} Euro' ' 1.000.000 Euro' + regcheck() { + zmodload -i zsh/pcre + 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) } + +# grep the history + greph () { history 0 | grep $1 } + (grep --help 2>/dev/null |grep -- --color) >/dev/null && \ + alias grep='grep --color=auto' # use colors when GNU grep with color-support + alias GREP='grep -i --color=auto' + +# one blank line between each line + if [ -r ~/.terminfo/m/mostlike ] ; then +# alias man2='MANPAGER="sed -e G |less" TERMINFO=~/.terminfo TERM=mostlike /usr/bin/man' + man2() { PAGER='dash -c "sed G | /usr/bin/less"' TERM=mostlike /usr/bin/man "$@" ; } + fi + +# jump between directories +# Copyright 2005 Nikolai Weibull +# notice: option AUTO_PUSHD has to be set + d(){ + emulate -L zsh + autoload -U colors + local color=$fg_bold[blue] + integer i=0 + dirs -p | while read dir; do + local num="${$(printf "%-4d " $i)/ /.}" + printf " %s $color%s$reset_color\n" $num $dir + (( i++ )) + done + integer dir=-1 + read -r 'dir?Jump to directory: ' || return + (( dir == -1 )) && return + if (( dir < 0 || dir >= i )); then + echo d: no such directory stack entry: $dir + return 1 + fi + cd ~$dir + } + +# provide useful information on globbing + H-Glob() { + echo -e " + / directories + . plain files + @ symbolic links + = sockets + p named pipes (FIFOs) + * executable plain files (0100) + % device files (character or block special) + %b block special files + %c character special files + r owner-readable files (0400) + w owner-writable files (0200) + x owner-executable files (0100) + A group-readable files (0040) + I group-writable files (0020) + E group-executable files (0010) + R world-readable files (0004) + W world-writable files (0002) + X world-executable files (0001) + s setuid files (04000) + S setgid files (02000) + t files with the sticky bit (01000) + print *(m-1) # Dateien, die vor bis zu einem Tag modifiziert wurden. + print *(a1) # Dateien, auf die vor einem Tag zugegriffen wurde. + print *(@) # Nur Links + print *(Lk+50) # Dateien die ueber 50 Kilobytes grosz sind + print *(Lk-50) # Dateien die kleiner als 50 Kilobytes sind + print **/*.c # Alle *.c - Dateien unterhalb von \$PWD + print **/*.c~file.c # Alle *.c - Dateien, aber nicht 'file.c' + print (foo|bar).* # Alle Dateien mit 'foo' und / oder 'bar' am Anfang + print *~*.* # Nur Dateien ohne '.' in Namen + chmod 644 *(.^x) # make all non-executable files publically readable + print -l *(.c|.h) # Nur Dateien mit dem Suffix '.c' und / oder '.h' + print **/*(g:users:) # Alle Dateien/Verzeichnisse der Gruppe >users< + echo /proc/*/cwd(:h:t:s/self//) # Analog zu >ps ax | awk '{print $1}'<" + } + + lcheck() { + nm -go /usr/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"":[[:xdigit:]]\{8\} . .*$1" + } + +# clean up directory + purge() { + FILES=(*~(N) .*~(N) \#*\#(N) *.o(N) a.out(N) *.core(N) *.cmo(N) *.cmi(N) .*.swp(N)) + NBFILES=${#FILES} + if [[ $NBFILES > 0 ]]; then + print $FILES + local ans + echo -n "Remove this files? [y/n] " + read -q ans + if [[ $ans == "y" ]] + then + rm ${FILES} + echo ">> $PWD purged, $NBFILES files removed" + else + echo "Ok. .. than not.." + fi + fi + } + +# Translate DE<=>EN +# 'translate' looks up fot a word in a file with language-to-language +# translations (field separator should be " : "). A typical wordlist looks +# like at follows: +# | english-word : german-transmission +# It's also only possible to translate english to german but not reciprocal. +# Use the following oneliner to turn back the sort order: +# $ awk -F ':' '{ print $2" : "$1" "$3 }' \ +# /usr/local/lib/words/en-de.ISO-8859-1.vok > ~/.translate/de-en.ISO-8859-1.vok + trans() { + case "$1" in + -[dD]*) translate -l de-en $2 + ;; + -[eE]*) translate -l en-de $2 + ;; + *) + echo "Usage: $0 { -D | -E }" + echo " -D == German to English" + echo " -E == English to German" + esac + } + +# Some quick Perl-hacks aka /useful/ oneliner +# bew() { perl -le 'print unpack "B*","'$1'"' } +# web() { perl -le 'print pack "B*","'$1'"' } +# hew() { perl -le 'print unpack "H*","'$1'"' } +# weh() { perl -le 'print pack "H*","'$1'"' } +# pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79" +# getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* } +# gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* } +# getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* } +# getforms () { perl -ne 'while ( m:(\):gic ) { print $1, "\n"; }' $* } +# getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*} +# getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* } +# showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' } +# vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` } +# vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" } + +# plap foo -- list all occurrences of program in the current PATH + plap() { + if [[ $# = 0 ]] + then + echo "Usage: $0 program" + echo "Example: $0 zsh" + echo "Lists all occurrences of program in the current PATH." + else + ls -l ${^path}/*$1*(*N) + fi + } + +# Found in the mailinglistarchive from Zsh (IIRC ~1996) + selhist() { + emulate -L zsh + local TAB=$'\t'; + (( $# < 1 )) && { + echo "Usage: $0 command" + return 1 + }; + cmd=(${(f)"$(grep -w $1 $HISTFILE | sort | uniq | pr -tn)"}) + print -l $cmd | less -F + echo -n "enter number of desired command [1 - $(( ${#cmd[@]} - 1 ))]: " + local answer + read answer + print -z "${cmd[$answer]#*$TAB}" + } + +# mkdir && cd + mcd() { mkdir -p "$@"; cd "$@" } # mkdir && cd + +# cd && ls + cl() { cd $1 && ls -a } + +# Use vim to convert plaintext to HTML + 2html() { vim -u NONE -n -c ':syntax on' -c ':so $VIMRUNTIME/syntax/2html.vim' -c ':wqa' $1 > /dev/null 2> /dev/null } + +# Usage: simple-extract +# Description: extracts archived files (maybe) + simple-extract () { + if [[ -f $1 ]] + then + case $1 in + *.tar.bz2) bzip2 -v -d $1 ;; + *.tar.gz) tar -xvzf $1 ;; + *.rar) unrar $1 ;; + *.deb) ar -x $1 ;; + *.bz2) bzip2 -d $1 ;; + *.lzh) lha x $1 ;; + *.gz) gunzip -d $1 ;; + *.tar) tar -xvf $1 ;; + *.tgz) gunzip -d $1 ;; + *.tbz2) tar -jxvf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *) echo "'$1' Error. Please go away" ;; + esac + else + echo "'$1' is not a valid file" + fi + } + +# Usage: smartcompress () +# Description: compresses files or a directory. Defaults to tar.gz + smartcompress() { + if [ $2 ]; then + case $2 in + tgz | tar.gz) tar -zcvf$1.$2 $1 ;; + tbz2 | tar.bz2) tar -jcvf$1.$2 $1 ;; + tar.Z) tar -Zcvf$1.$2 $1 ;; + tar) tar -cvf$1.$2 $1 ;; + gz | gzip) gzip $1 ;; + bz2 | bzip2) bzip2 $1 ;; + *) + echo "Error: $2 is not a valid compression type" + ;; + esac + else + smartcompress $1 tar.gz + fi + } + +# Usage: show-archive +# Description: view archive without unpack + show-archive() { + if [[ -f $1 ]] + then + case $1 in + *.tar.gz) gunzip -c $1 | tar -tf - -- ;; + *.tar) tar -tf $1 ;; + *.tgz) tar -ztf $1 ;; + *.zip) unzip -l $1 ;; + *.bz2) bzless $1 ;; + *) echo "'$1' Error. Please go away" ;; + esac + else + echo "'$1' is not a valid archive" + fi + } + + folsym() { + if [[ -e $1 || -h $1 ]]; then + file=$1 + else + file=`which $1` + fi + if [[ -e $file || -L $file ]]; then + if [[ -L $file ]]; then + echo `ls -ld $file | perl -ane 'print $F[7]'` '->' + folsym `perl -le '$file = $ARGV[0]; + $dest = readlink $file; + if ($dest !~ m{^/}) { + $file =~ s{(/?)[^/]*$}{$1$dest}; + } else { + $file = $dest; + } + $file =~ s{/{2,}}{/}g; + while ($file =~ s{[^/]+/\.\./}{}) { + ; + } + $file =~ s{^(/\.\.)+}{}; + print $file' $file` + else + ls -d $file + fi + else + echo $file + fi + } + +# Use 'view' to read manpages, if u want colors, regex - search, ... +# like vi(m). +# It's shameless stolen from + vman() { man $* | col -b | view -c 'set ft=man nomod nolist' - } + +# search for various types or README file in dir and display them in $PAGER +# function readme() { $PAGER -- (#ia3)readme* } + readme() { + local files + files=(./(#i)*(read*me|lue*m(in|)ut)*(ND)) + if (($#files)) + then $PAGER $files + else + print 'No README files.' + fi + } + +# find all suid files in $PATH +# suidfind() { ls -latg $path | grep '^...s' } + suidfind() { ls -latg $path/*(sN) } + +# See above but this is /better/ ... anywise .. +# Note: Add $USER and 'find' with "NOPASSWD" in your /etc/sudoers or run it +# as root (UID == 0) + findsuid() { + if [ UID != 0 ] ; then + print 'Not running as root. Trying to run via sudo...' + RUNASROOT=sudo + fi + print 'Output will be written to ~/suid_* ...' + $RUNASROOT find / -type f \( -perm -4000 -o -perm -2000 \) -ls > ~/suid_suidfiles.`date "+%Y-%m-%d"`.out 2>&1 + $RUNASROOT find / -type d \( -perm -4000 -o -perm -2000 \) -ls > ~/suid_suiddirs.`date "+%Y-%m-%d"`.out 2>&1 + $RUNASROOT find / -type f \( -perm -2 -o -perm -20 \) -ls > ~/suid_writefiles.`date "+%Y-%m-%d"`.out 2>&1 + $RUNASROOT find / -type d \( -perm -2 -o -perm -20 \) -ls > ~/suid_writedirs.`date "+%Y-%m-%d"`.out 2>&1 + print 'Finished' + } + +# Reload functions. + refunc() { + for func in $argv + do + unfunction $func + autoload $func + done + } + +# a small check to see which DIR is located on which server/partition. +# stolen and modified from Sven's zshrc.forall + dirspace() { + for dir in $path; + do + (cd $dir; echo "-<$dir>"; du -shx .; echo); + done + } + +# $ show_print `cat /etc/passwd` + slow_print() { + for argument in "${@}" + do + for ((i = 1; i <= ${#1} ;i++)) { + print -n "${argument[i]}" + sleep 0.08 + } + print -n " " + done + print "" + } + + status() { + print "" + print "Date..: "$(date "+%Y-%m-%d %H:%M:%S")"" + print "Shell.: Zsh $ZSH_VERSION (PID = $$, $SHLVL nests)" + print "Term..: $TTY ($TERM), $BAUD bauds, $COLUMNS x $LINES cars" + print "Login.: $LOGNAME (UID = $EUID) on $HOST" + print "System: $(cat /etc/[A-Za-z]*[_-][rv]e[lr]*)" + print "Uptime:$(uptime)" + print "" + } + + audiorip() { + mkdir -p ~/ripps + cd ~/ripps + cdrdao read-cd --device $DEVICE --driver generic-mmc audiocd.toc + cdrdao read-cddb --device $DEVICE --driver generic-mmc audiocd.toc + echo " * Would you like to burn the cd now? (yes/no)" + read input + if + [ "$input" = "yes" ]; then + echo " ! Burning Audio CD" + audioburn + echo " * done." + else + echo " ! Invalid response." + fi + } + + audioburn() { + cd ~/ripps + cdrdao write --device $DEVICE --driver generic-mmc audiocd.toc + echo " * Should I remove the temporary files? (yes/no)" + read input + if [ "$input" = "yes" ]; then + echo " ! Removing Temporary Files." + cd ~ + rm -rf ~/ripps + echo " * done." + else + echo " ! Invalid response." + fi + } + + mkaudiocd() { + cd ~/ripps + for i in *.[Mm][Pp]3; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done + for i in *.mp3; do mv "$i" `echo $i | tr ' ' '_'`; done + for i in *.mp3; do mpg123 -w `basename $i .mp3`.wav $i; done + normalize -m *.wav + for i in *.wav; do sox $i.wav -r 44100 $i.wav resample; done + } + + mkiso() { + echo " * Volume name " + read volume + echo " * ISO Name (ie. tmp.iso)" + read iso + echo " * Directory or File" + read files + mkisofs -o ~/$iso -A $volume -allow-multidot -J -R -iso-level 3 -V $volume -R $files + } + +# generate thumbnails ;) + genthumbs () { + rm -rf thumb-* index.html + echo " + + + Images + + " > index.html + for f in *.(gif|jpeg|jpg|png) + do + convert -size 100x200 "$f" -resize 100x200 thumb-"$f" + echo " " >> index.html + done + echo " + +" >> index.html + } + +# unset all limits (see zshbuiltins(1) /ulimit for details) + allulimit() { + ulimit -c unlimited + ulimit -d unlimited + ulimit -f unlimited + ulimit -l unlimited + ulimit -n unlimited + ulimit -s unlimited + ulimit -t unlimited + } + +# ogg2mp3 with bitrate of 192 + ogg2mp3_192() { + oggdec -o - ${1} | lame -b 192 - ${1:r}.mp3 + } + +# RFC 2396 URL encoding in Z-Shell + urlencode() { + setopt localoptions extendedglob + input=( ${(s::)1} ) + print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))} + } + +# get x-lite voip software + getxlite() { + [ -d ~/tmp ] || mkdir ~/tmp + cd ~/tmp + echo "Downloading http://www.counterpath.com/download/X-Lite_Install.tar.gz and storing it in ~/tmp:" + if wget http://www.counterpath.com/download/X-Lite_Install.tar.gz ; then + unp X-Lite_Install.tar.gz && echo done || echo failed + else + echo "Error while downloading." ; return 1 + fi + if [ -x xten-xlite/xtensoftphone ] ; then + echo "Execute xten-xlite/xtensoftphone to start xlite." + fi + } + +# get skype + getskype() { + echo "Downloading debian package of skype." + echo "Notice: If you want to use a more recent skype version run 'getskypebeta'." + wget http://www.skype.com/go/getskype-linux-deb + # mkdir skype.install + # dpkg-deb --extract skype_*.deb skype.install/ + # dpkg-deb --control skype_*.deb skype.install/DEBIAN + # sed -i 's/libqt3c102-mt/libqt3-mt/' skype.install/DEBIAN/control + # dpkg --build skype.install + sudo dpkg -i skype_debian-*.deb && echo "skype installed." + } + +# get beta-version of skype + getskypebeta() { + echo "Downloading debian package of skype (beta version)." + wget http://www.skype.com/go/getskype-linux-beta-deb + sudo dpkg -i skype-beta*.deb && echo "skype installed." + } + +# get gzimo (voicp software) + getgizmo() { + echo "gconf2-common and libgconf2-4 have to be available. Installing therefor." + sudo apt-get update + sudo apt-get install gconf2-common libgconf2-4 + wget $(lynx --dump http://www.gizmoproject.com/download-linux.html | awk '/\.deb/ {print $2" "}' | tr -d '\n') + sudo dpkg -i libsipphoneapi*.deb bonjour_*.deb gizmo-*.deb && echo "gizmo installed." + } + +# get AIR - Automated Image and Restore + getair() { + [ -w . ] || { echo 'Error: you do not have write permissions in this directory. Exiting.' ; return 1 } + local VER='1.2.8' + wget http://puzzle.dl.sourceforge.net/sourceforge/air-imager/air-$VER.tar.gz + tar zxf air-$VER.tar.gz + cd air-$VER + INTERACTIVE=no sudo ./install-air-1.2.8 + [ -x /usr/local/bin/air ] && [ -n "$DISPLAY" ] && sudo air + } + +# get specific git commitdiff + git-get-diff() { + if [ -z $GITTREE ] ; then + GITTREE='linux/kernel/git/torvalds/linux-2.6.git' + fi + if ! [ -z $1 ] ; then + ${=BROWSER} "http://kernel.org/git/?p=$GITTREE;a=commitdiff;h=$1" + else + echo "Usage: git-get-diff " + fi + } + +# get specific git commit + git-get-commit() { + if [ -z $GITTREE ] ; then + GITTREE='linux/kernel/git/torvalds/linux-2.6.git' + fi + if ! [ -z $1 ] ; then + ${=BROWSER} "http://kernel.org/git/?p=$GITTREE;a=commit;h=$1" + else + echo "Usage: git-get-commit " + fi + } + +# get specific git diff + git-get-plaindiff() { + if [ -z $GITTREE ] ; then + GITTREE='linux/kernel/git/torvalds/linux-2.6.git' + fi + if ! [ -z $1 ] ; then + wget "http://kernel.org/git/?p=$GITTREE;a=commitdiff_plain;h=$1" -O $1.diff + else + echo 'Usage: git-get-plaindiff ' + fi + } + +# log 'make install' output +# http://strcat.de/blog/index.php?/archives/335-Software-sauber-deinstallieren...html + mmake() { + [[ ! -d ~/.errorlogs ]] && mkdir ~/.errorlogs + =make -n install > ~/.errorlogs/${PWD##*/}-makelog + } + +# indent source code + smart-indent() { + indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs $* + } + + +# rename pictures based on information found in exif headers + exirename() { + if [ $# -lt 1 ] ; then + echo 'Usage: jpgrename $FILES' >& 2 + return 1 + else + echo -n 'Checking for jhead with version newer than 1.9: ' + jhead_version=`jhead -h | grep 'used by most Digital Cameras. v.*' | awk '{print $6}' | tr -d v` + if [[ $jhead_version > '1.9' ]]; then + echo 'success - now running jhead.' + jhead -n%Y-%m-%d_%Hh%M_%f $* + else + echo 'failed - exiting.' + fi + fi + } + +# }}} + +# some useful commands often hard to remember - let's grep for them {{{ + +# Work around ion/xterm resize bug. +#if [ "$SHLVL" = 1 ]; then +# if [ -x `which resize 2>/dev/null` ]; then +# eval `resize Packages.gz +# dpkg-scansources . | gzip > Sources.gz +# grep-dctrl --field Maintainer $* /var/lib/apt/lists/* + +# other stuff: +# convert -geometry 200x200 -interlace LINE -verbose +# ldapsearch -x -b "OU=Bedienstete,O=tug" -h ldap.tugraz.at sn=$1 +# ps -ao user,pcpu,start,command +# gpg --keyserver blackhole.pca.dfn.de --recv-keys +# xterm -bg black -fg yellow -fn -misc-fixed-medium-r-normal--14-140-75-75-c-90-iso8859-15 -ah +# nc -vz $1 1-1024 # portscan via netcat +# wget --mirror --no-parent --convert-links +# pal -d `date +%d` +# autoload -U tetris; zle -N tetris; bindkey '...' ; echo "press ... for playing tennis" +# +# modify console cursor +# see http://www.tldp.org/HOWTO/Framebuffer-HOWTO-5.html +# print $'\e[?96;0;64c' +# }}} + +# finally source a local zshrc {{{ +# this allows us to stay in sync with /etc/skel/.zshrc +# through 'ln -s /etc/skel/.zshrc ~/.zshrc' and put own +# modifications in ~/.zshrc.local + if [ -r ~/.zshrc.local ] ; then + . ~/.zshrc.local + fi +# }}} + +## END OF FILE ################################################################# +# vim:foldmethod=marker diff --git a/etc/vim/vimrc b/etc/vim/vimrc new file mode 100644 index 0000000..c40a521 --- /dev/null +++ b/etc/vim/vimrc @@ -0,0 +1,97 @@ +" Filename: /etc/vim/vimrc +" Purpose: configuration file for vim +" Authors: grml-team (grml.org), (c) Michael Prokop +" Bug-Reports: see http://grml.org/bugs/ +" License: This file is licensed under the GPL v2. +" Latest change: Son Mai 28 01:26:49 CEST 2006 [mika] +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just +" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime you +" can find below. If you wish to change any of those settings, you should do it +" in the file /etc/vim/vimrc.local, since debian.vim will be overwritten +" everytime an upgrade of the vim packages is performed and this file +" (/etc/vim/vimrc) every time the package grml-etc is upgraded. It is +" recommended to make changes after sourcing debian.vim since it alters the +" value of the 'compatible' option. + +" This line should not be removed as it ensures that various options are +" properly set to work with the Vim-related packages available in Debian. +runtime! debian.vim + +" Uncomment the next line to make Vim more Vi-compatible +" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous +" options, so any other options should be set AFTER setting 'compatible'. +"set compatible + +set backspace=indent,eol,start " more powerful backspacing + +" Now we set some defaults for the editor +set autoindent " always set autoindenting on +" set linebreak " Don't wrap words by default +set textwidth=0 " Don't wrap lines by default +set nobackup " Don't keep a backup file +set backupcopy=no " grml: Overwrite files/links with w! +" set backupcopy=yes " Keep a backup file +set viminfo='20,\"50 " read/write a .viminfo file, don't store more than + " 50 lines of registers +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time + +" Suffixes that get lower priority when doing tab completion for filenames. +" These are files we are not likely to want to edit or read. +set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc + +" Make p in Visual mode replace the selected text with the "" register. +vnoremap p :let current_reg = @"gvdi=current_reg + +" Vim5 and later versions support syntax highlighting. Uncommenting the next +" line enables syntax highlighting by default. +syntax on + +" Debian uses compressed helpfiles. We must inform vim that the main +" helpfiles is compressed. Other helpfiles are stated in the tags-file. +" set helpfile=$VIMRUNTIME/doc/help.txt.gz + +" If using a dark background within the editing area and syntax highlighting +" turn on this option as well +set background=dark + +" begin of grml specials: +" set list listchars=tab:»· +" set listchars=eol:$,precedes:«,extends:»,tab:··,trail:· +" end of grml specials + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +"if has("autocmd") +" au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") +" \| exe "normal g'\"" | endif +"endif + +" Uncomment the following to have Vim load indentation rules according to the +" detected filetype. Per default Debian Vim only load filetype specific +" plugins. +"if has("autocmd") +" filetype indent on +"endif + +" The following are commented out as they cause vim to behave a lot +" differently from regular Vi. They are highly recommended though. + set showcmd " Show (partial) command in status line. + set showmatch " Show matching brackets. +"set ignorecase " Do case insensitive matching +"set smartcase " Do smart case matching +"set incsearch " Incremental search +"set autowrite " Automatically save before commands like :next and :make +" When switching between different buffers you can't use undo without 'set hidden': + set hidden " Hide buffers when they are abandoned +"set mouse=a " Enable mouse usage (all modes) in terminals + +" Source a global configuration file if available +" XXX Deprecated by Debian but as grml's package grml-etc provides this file +" it is still valid +if filereadable("/etc/vim/vimrc.local") + source /etc/vim/vimrc.local +endif +" EOF diff --git a/etc/zsh/completion.d/debian_rules b/etc/zsh/completion.d/debian_rules new file mode 100644 index 0000000..17b3d65 --- /dev/null +++ b/etc/zsh/completion.d/debian_rules @@ -0,0 +1,2 @@ + _debian_rules() { words=(make -f debian/rules) _make } + compdef _debian_rules debian/rules # type debian/rules inside a source package diff --git a/etc/zsh/completion.d/fbset b/etc/zsh/completion.d/fbset new file mode 100644 index 0000000..073b9f7 --- /dev/null +++ b/etc/zsh/completion.d/fbset @@ -0,0 +1,3 @@ +# simple completion for fbset (switch resolution on console) + _fbmodes() { compadd 640x480-60 640x480-72 640x480-75 640x480-90 640x480-100 768x576-75 800x600-48-lace 800x600-56 800x600-60 800x600-70 800x600-72 800x600-75 800x600-90 800x600-100 1024x768-43-lace 1024x768-60 1024x768-70 1024x768-72 1024x768-75 1024x768-90 1024x768-100 1152x864-43-lace 1152x864-47-lace 1152x864-60 1152x864-70 1152x864-75 1152x864-80 1280x960-75-8 1280x960-75 1280x960-75-32 1280x1024-43-lace 1280x1024-47-lace 1280x1024-60 1280x1024-70 1280x1024-74 1280x1024-75 1600x1200-60 1600x1200-66 1600x1200-76 } + compdef _fbmodes fbset diff --git a/etc/zsh/completion.d/grml-lang b/etc/zsh/completion.d/grml-lang new file mode 100644 index 0000000..73e39ca --- /dev/null +++ b/etc/zsh/completion.d/grml-lang @@ -0,0 +1,2 @@ + _grml-lang() { compadd at ch de us ; } + compdef _grml-lang grml-lang diff --git a/etc/zsh/completion.d/grml-wallpaper b/etc/zsh/completion.d/grml-wallpaper new file mode 100644 index 0000000..2a9c940 --- /dev/null +++ b/etc/zsh/completion.d/grml-wallpaper @@ -0,0 +1,7 @@ + grml-wallpaper() { Esetroot -scale /usr/share/grml/$* } + _grml-wallpaper() { + dirs=(. /usr/share/grml/) + _description files expl 'set desktop wallpaper on grml system' + _files "$expl[@]" -W dirs -g '*.{jpg,png}(-.)' + } + compdef _grml-wallpaper grml-wallpaper diff --git a/etc/zsh/completion.d/iwconfig b/etc/zsh/completion.d/iwconfig new file mode 100644 index 0000000..c3a48f0 --- /dev/null +++ b/etc/zsh/completion.d/iwconfig @@ -0,0 +1,88 @@ +_wlan_interfaces() { + local intf + intf=$(iwconfig |& egrep 'IEEE 802.11[abg]' | cut -d' ' -f1 | tr ' ' \\n ) + # intf=$( fgrep ': ' < /proc/net/wireless | cut -d: -f1 | tr \\n ' ' | tr -s " \t" ) + _wanted interfaces expl 'wireless network interface' \ + compadd ${intf} +} + +_wlan_networks() { + networks=() + while read LINE + do + networks+=$LINE + done <<(iwlist scanning 2>/dev/null | grep ESSID | sed -e s/'.*"\(.*\)"'/'\1'/ ) + _wanted -x names expl 'network name' \ + compadd off any on ${networks} +} + +_iwconfig() { + local curcontext="$curcontext" state line expl ret=1 + + _arguments -C \ + '(1 * -)--help[display help information]' \ + '(1 * -)--version[display version information]' \ + '1:network interface:_wlan_interfaces' \ + '*:parameter:->parameters' && ret=0 + + if [[ -n "$state" ]]; then + local -a arg + + case $words[CURRENT-1] in + essid) _wlan_networks;; + nwid|domain) _message -e ids 'network id' ;; + freq|channel) _message -e channels 'channel or frequency' ;; + sens) _message -e levels 'signal level' ;; + mode) + _wanted modes expl 'operating mode' compadd \ + Ad-Hoc Managed Master Repeater Secondary Monitor Auto + ;; + ap) _message -e access-points 'access point' ;; + nick*) _message -e names 'nickname' ;; + rate|bit*) _message -e bit-rates 'bit rate' ;; + rts*|frag*) _message -e sizes 'size' ;; + key|enc*) _message -e keys 'key' ;; + power) + arg=( + \*{min,max}'[modifier]' + '*off[disable power management]' + '*on[enable power management]' + '*all[receive all packets]' + 'unicast[receive unicast packets only]' + 'multicast[receive multicast and broadcast packets only]' + ) + ;& + min|max) + _values -S ' ' -w 'parameter' \ + 'period[set the period between wake ups]' \ + 'timeout[set timeout before sleep]' \ + $arg[@] && ret=0 + ;; + period|timeout) _message -e timeouts 'timeout' ;; + txpower) _message -e power 'transmit power' ;; + retry) _message -e retries 'retries' ;; + *) + _values -S ' ' -w 'option' \ + 'essid[set the network name]' \ + '(nwid domain)'{nwid,domain}'[set the network ID]' \ + '(freq channel)'{freq,channel}'[set the operating frequency or channel]' \ + 'sens[set the sensitivity threhold]' \ + 'mode[set operating mode]' \ + 'ap[register with given access point]' \ + '(nick nickname)'nick{,name}'[set the nickname]' \ + '(rate bit)'{rate,bit}'[set the bitrate]' \ + 'rts[set packet size threshold for sending RTS]' \ + 'frag[set maximum packet fragment size]' \ + \*{key,enc}'[add encryption key]' \ + '*power[manipulate power management scheme parameters]' \ + 'txpower[set transmit power]' \ + 'retry[set number of retries]' \ + 'commit[apply changes imediately]' && ret=0 + ;; + esac + fi + + return ret +} + +compdef _iwconfig iwconfig diff --git a/etc/zsh/keephack b/etc/zsh/keephack new file mode 100644 index 0000000..d4c8a5f --- /dev/null +++ b/etc/zsh/keephack @@ -0,0 +1,88 @@ +# Filename: /etc/zsh/keephack +# Purpose: this file belongs to the zsh setup (see /etc/zsh/zshrc) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Don Jän 27 23:38:57 CET 2005 [mika] +################################################################################ + +# save output in a variable for later use +# Written by Bart Schaefer, for more details see: +# http://www.zsh.org/cgi-bin/mla/wilma_hiliter/users/2004/msg00894.html ff. + function keep { + setopt localoptions nomarkdirs nonomatch nocshnullglob nullglob + kept=() # Erase old value in case of error on next line + kept=($~*) + if [[ ! -t 0 ]]; then + local line + while read line; do + kept+=( $line ) # += is a zsh 4.2+ feature + done + fi + print -Rc - ${^kept%/}(T) + } + # use it via: + # locate -i backup | grep -i thursday | keep + # echo $kept + # + # or: + # + # patch < mypatch.diff + # keep **/*.(orig|rej) + # vim ${${kept:#*.orig}:r} + # rm $kept + alias keep='noglob keep' + + _insert_kept() { + (( $#kept )) || return 1 + local action + zstyle -s :completion:$curcontext insert-kept action + if [[ -n $action ]] + then compstate[insert]=$action + elif [[ $WIDGET = *expand* ]] + then compstate[insert]=all + fi + if [[ $WIDGET = *expand* ]] + then compadd -U ${(M)kept:#${~words[CURRENT]}} + else compadd -a kept + fi + } + + # now bind it to keys and enable completition + zle -C insert-kept-result complete-word _generic + zle -C expand-kept-result complete-word _generic + zstyle ':completion:*-kept-result:*' completer _insert_kept + zstyle ':completion:insert-kept-result:*' menu yes select + + bindkey '^Xk' insert-kept-result + bindkey '^XK' expand-kept-result # shift-K to get expansion + + # And the "_expand_word_and_keep" replacement for _expand_word: + _expand_word_and_keep() { + function compadd() { + local -A args + zparseopts -E -A args J: + if [[ $args[-J] == all-expansions ]] + then + builtin compadd -A kept "$@" + kept=( ${(Q)${(z)kept}} ) + fi + builtin compadd "$@" + } + # for older versions of zsh: + local result + _main_complete _expand + result=$? + unfunction compadd + return result + # versions >=4.2.1 understand this: + # { _main_complete _expand } always { unfunction compadd } + } + + # This line must come after "compinit" in startup: + zle -C _expand_word complete-word _expand_word_and_keep + # No bindkey needed, it's already ^Xe from _expand_word + zstyle ':completion:*' insert-kept menu + zmodload -i zsh/complist + +## END OF FILE ################################################################# diff --git a/etc/zsh/zlogin b/etc/zsh/zlogin new file mode 100644 index 0000000..7f655fd --- /dev/null +++ b/etc/zsh/zlogin @@ -0,0 +1,17 @@ +# Filename: zlogin +# Purpose: system-wide .zlogin file for zsh(1) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Die Nov 16 13:25:04 CET 2004 [mika] +################################################################################ +# This file is sourced only for login shells. It +# should contain commands that should be executed only +# in login shells. It should be used to set the terminal +# type and run a series of external commands (fortune, +# msgs, from, etc.) +# +# Global Order: zshenv, zprofile, zshrc, zlogin +################################################################################ +# nothing yet. +## END OF FILE ################################################################# diff --git a/etc/zsh/zlogout b/etc/zsh/zlogout new file mode 100644 index 0000000..e8d24bb --- /dev/null +++ b/etc/zsh/zlogout @@ -0,0 +1,9 @@ +# Filename: zlogout +# Purpose: system-wide .zlogout file for zsh(1) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Die Nov 16 13:25:11 CET 2004 [mika] +################################################################################ +# nothing yet. +## END OF FILE ################################################################# diff --git a/etc/zsh/zprofile b/etc/zsh/zprofile new file mode 100644 index 0000000..6b79d4e --- /dev/null +++ b/etc/zsh/zprofile @@ -0,0 +1,15 @@ +# Filename: zprofile +# Purpose: system-wide .zprofile file for zsh(1) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Fri Nov 11 00:08:57 CET 2005 [mika] +################################################################################ +# This file is sourced only for login shells (i.e. shells +# invoked with "-" as the first character of argv[0], and +# shells invoked with the -l flag.) +# +# Global Order: zshenv, zprofile, zshrc, zlogin +################################################################################ +# nothing yet +## END OF FILE ################################################################# diff --git a/etc/zsh/zshenv b/etc/zsh/zshenv new file mode 100644 index 0000000..26c1e83 --- /dev/null +++ b/etc/zsh/zshenv @@ -0,0 +1,76 @@ +# Filename: zshenv +# Purpose: system-wide .zshenv file for zsh(1) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Sam Sep 23 14:20:25 CEST 2006 [mika] +################################################################################ +# This file is sourced on all invocations of the shell. +# If the -f flag is present or if the NO_RCS option is +# set within this file, all other initialization files +# are skipped. +# +# This file should contain commands to set the command +# search path, plus other important environment variables. +# This file should not contain commands that produce +# output or assume the shell is attached to a tty. +# +# Global Order: zshenv, zprofile, zshrc, zlogin +################################################################################ + +# language settings (read in /etc/environment before /etc/default/locale as +# the latter one is the default on Debian nowadays) + [ -r /etc/environment ] && source /etc/environment + [ -r /etc/default/locale ] && source /etc/default/locale + [ -n "$LANG" ] && export LANG || export LANG="en_US.iso885915" + [ -n "$LC_ALL" ] && export LC_ALL # || export LC_ALL="$LANG" + [ -n "$LC_MESSAGES" ] && export LC_MESSAGES + + [ -r /etc/sysconfig/keyboard ] && source /etc/sysconfig/keyboard + +# set environment variables (important for autologin on tty) + [ -n "$HOSTNAME" ] || export HOSTNAME=`hostname` + [ -z "$USER" ] && export USER=`id -un` + + [[ $LOGNAME == LOGIN ]] && LOGNAME=$(id -un) + +# workaround for live-cd mode as $HOME is not set via rungetty + if [ -f /etc/grml_cd ] ; then + if (( EUID == 0 )); then + export HOME=/root + else + export HOME=/home/$USER + fi + fi + +# set $PATH +# gentoo users have to source /etc/profile.env + if [ -r /etc/gentoo-release ] ; then + [ -r /etc/profile.env ] && source /etc/profile.env + if (( EUID != 0 )); then + PATH="$HOME/bin:/bin/:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin:$PATH" + else + PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin:$PATH" + fi + else + # support extra software in special directory outside of squashfs environment in live-cd mode + if [ -f /etc/grml_cd ] ; then + [ -d /cdrom/addons/ ] && ADDONS=':/cdrom/addons/' + fi + if (( EUID != 0 )); then + PATH="$HOME/bin:/bin/:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/NX/bin$ADDONS" + else + PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/NX/bin$ADDONS" + fi +# fi + fi + +# less (:=pager) options: +# export LESS=C + export LESSOPEN="|lesspipe.sh %s" + export READNULLCMD=${PAGER:-/usr/bin/pager} + export DISTCC_HOSTS="+zeroconf" +# MAKEDEV should be usable on udev as well by default: + export WRITE_ON_UDEV=yes + +## END OF FILE ################################################################# diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc new file mode 100644 index 0000000..68b4cea --- /dev/null +++ b/etc/zsh/zshrc @@ -0,0 +1,705 @@ +# Filename: zshrc +# Purpose: config file for zsh (z shell) +# Authors: grml-team (grml.org), (c) Michael Prokop +# Bug-Reports: see http://grml.org/bugs/ +# License: This file is licensed under the GPL v2. +# Latest change: Son Okt 08 01:46:31 CEST 2006 [mika] +################################################################################ +# This file is sourced only for interactive shells. It +# should contain commands to set up aliases, functions, +# options, key bindings, etc. +# +# Global Order: zshenv, zprofile, zshrc, zlogin +################################################################################ + +# {{{ check for version/system +# check for versions (compatibility reasons) + is4(){ + if [[ $ZSH_VERSION == 4.* ]]; then + return 0 + else + return 1 + fi + } + +# current release + is42(){ + if [[ $ZSH_VERSION == 4.<2->* ]]; then + return 0 + else + return 1 + fi + } + +# grml specific stuff + isgrml(){ + if [ -f /etc/grml_version ] ; then + return 0 + else + return 1 + fi + } + + isgrmlcd(){ + if [ -f /etc/grml_cd ] ; then + return 0 + else + return 1 + fi + } + +# check for user, if not running as root set $SUDO to sudo + (( EUID != 0 )) && SUDO='sudo' || SUDO='' + +# change directory to home on first invocation of zsh +# important for rungetty -> autologin +# Thanks go to Bart Schaefer! + isgrml && checkhome() { + if [[ -z "$ALREADY_DID_CD_HOME" ]]; then + export ALREADY_DID_CD_HOME=$HOME + cd + fi + } +# }}} + +# {{{ set some variables + [[ -z "$EDITOR" ]] && export EDITOR='vim' + [[ -z "$SHELL" ]] && export SHELL='/bin/zsh' + [[ -z "$MAIL" ]] && export MAIL="/var/mail/$USER" + [[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less' + [[ -x /usr/bin/dircolors ]] && eval `dircolors -b` + +# Search path for the cd comman +# cdpath=(.. ~) + +# automatically remove duplicates from these arrays + typeset -U path cdpath fpath manpath +# }}} + +# {{{ keybindings + if [[ "$TERM" != emacs ]]; then + [[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char + [[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line + [[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line + [[ -z "$terminfo[kdch1]" ]] || bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char + [[ -z "$terminfo[khome]" ]] || bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line + [[ -z "$terminfo[kend]" ]] || bindkey -M vicmd "$terminfo[kend]" vi-end-of-line + [[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history + [[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char + [[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history + [[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history + [[ -z "$terminfo[kcuf1]" ]] || bindkey -M viins "$terminfo[kcuf1]" vi-forward-char + [[ -z "$terminfo[kcub1]" ]] || bindkey -M viins "$terminfo[kcub1]" vi-backward-char + # ncurses stuff: + [[ "$terminfo[kcuu1]" == "O"* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history + [[ "$terminfo[kcud1]" == "O"* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history + [[ "$terminfo[kcuf1]" == "O"* ]] && bindkey -M viins "${terminfo[kcuf1]/O/[}" vi-forward-char + [[ "$terminfo[kcub1]" == "O"* ]] && bindkey -M viins "${terminfo[kcub1]/O/[}" vi-backward-char + [[ "$terminfo[khome]" == "O"* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line + [[ "$terminfo[kend]" == "O"* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line + [[ "$terminfo[khome]" == "O"* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line + [[ "$terminfo[kend]" == "O"* ]] && bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line +fi + +## keybindings (run 'bindkeys' for details, more details via man zshzle) +# use emacs style per default + bindkey -e +# use vi style: +# bindkey -v + +#if [[ "$TERM" == screen ]]; then + bindkey '\e[1~' beginning-of-line # home + bindkey '\e[4~' end-of-line # end + bindkey "^[[A" up-line-or-search # cursor up + bindkey "^[[B" down-line-or-search # - + bindkey '^x' history-beginning-search-backward # alternative ways of searching the shell history +# bindkey -s '^L' "|less\n" # ctrl-L pipes to less +# bindkey -s '^B' " &\n" # ctrl-B runs it in the background +# if terminal type is set to 'rxvt': + bindkey '\e[7~' beginning-of-line # home + bindkey '\e[8~' end-of-line # end +#fi + +# bindkey '\eq' push-line-or-edit +# }}} + +# {{{ autoloading + autoload -U zmv # who needs mmv or rename? + autoload history-search-end + + # we don't want to quote/espace URLs on our own... + # avoid 'url-quote-magic: function definition file not found' on some older boxes + if [ -f /usr/share/zsh/$ZSH_VERSION/functions/Zle/url-quote-magic ] ; then + autoload -U url-quote-magic + zle -N self-insert url-quote-magic + fi + + alias run-help >&/dev/null && unalias run-help + autoload run-help # use via 'esc-h' + + is4 && autoload -U compinit && compinit # completition system + is4 && autoload -U zed # use ZLE editor to edit a file or function + + is4 && zmodload -i zsh/complist + is4 && zmodload -i zsh/deltochar + is4 && zmodload -i zsh/mathfunc +# autoload zsh modules when they are referenced + is4 && zmodload -a zsh/stat stat + is4 && zmodload -a zsh/zpty zpty + is4 && zmodload -a zsh/zprof zprof + is4 && zmodload -ap zsh/mapfile mapfile + + is4 && autoload -U insert-files && \ + zle -N insert-files && \ + bindkey "^Xf" insert-files # C-x-f + + bindkey ' ' magic-space # also do history expansion on space + bindkey '\ei' menu-complete # menu completion via esc-i + +# press esc-e for editing command line in $EDITOR or $VISUAL + is4 && autoload -U edit-command-line && \ + zle -N edit-command-line && \ + bindkey '\ee' edit-command-line + +# press "ctrl-e d" to insert the actual date in the form yyyy-mm-dd + _bkdate() { BUFFER="$BUFFER$(date '+%F')"; CURSOR=$#BUFFER; } + bindkey '\C-ed' _bkdate + zle -N _bkdate + +# press esc-m for inserting last typed word again (thanks to caphuso!) + insert-last-typed-word() { zle insert-last-word -- 0 -1 }; \ + zle -N insert-last-typed-word; bindkey "\em" insert-last-typed-word + +# set command prediction from history, see 'man 1 zshcontrib' +# is4 && autoload -U predict-on && \ +# zle -N predict-on && \ +# zle -N predict-off && \ +# bindkey "^X^Z" predict-on && \ +# bindkey "^Z" predict-off + +# put job into foreground via ctrl-z: + bindkey -s '^z' "fg\n" + +# press ctrl-q to quote line: +# mquote () { +# zle beginning-of-line +# zle forward-word +# # RBUFFER="'$RBUFFER'" +# RBUFFER=${(q)RBUFFER} +# zle end-of-line +# } +# zle -N mquote && bindkey '^q' mquote + +# run command line as user root via sudo: + _sudo-command-line() { + [[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER" + } + zle -N sudo-command-line _sudo-command-line + bindkey "^Os" sudo-command-line +# }}} + +# {{{ set some important options + umask 022 + +# history: + setopt append_history # append history list to the history file (important for multiple parallel zsh sessions!) + is4 && setopt SHARE_HISTORY # import new commands from the history file also in other zsh-session + setopt extended_history # save each command's beginning timestamp and the duration to the history file + is4 && setopt histignorealldups # If a new command line being added to the history + # list duplicates an older one, the older command is removed from the list + setopt histignorespace # remove command lines from the history list when + # the first character on the line is a space +# setopt histallowclobber # add `|' to output redirections in the history +# setopt NO_clobber # warning if file exists ('cat /dev/null > ~/.zshrc') + setopt auto_cd # if a command is issued that can't be executed as a normal command, + # and the command is the name of a directory, perform the cd command to that directory + setopt extended_glob # in order to use #, ~ and ^ for filename generation + # grep word *~(*.gz|*.bz|*.bz2|*.zip|*.Z) -> + # -> searches for word not in compressed files + # don't forget to quote '^', '~' and '#'! + setopt notify # report the status of backgrounds jobs immediately + setopt hash_list_all # Whenever a command completion is attempted, make sure \ + # the entire command path is hashed first. + setopt completeinword # not just at the end +# setopt nocheckjobs # don't warn me about bg processes when exiting + setopt nohup # and don't kill them, either +# setopt printexitvalue # alert me if something failed +# setopt dvorak # with spelling correction, assume dvorak kb + setopt auto_pushd # make cd push the old directory onto the directory stack. + setopt nonomatch # try to avoid the 'zsh: no matches found...' + setopt nobeep # avoid "beep"ing + + MAILCHECK=30 # mailchecks + REPORTTIME=5 # report about cpu-/system-/user-time of command if running longer than 5 secondes + watch=(notme root) # watch for everyone but me and root + +# define word separators (for stuff like backward-word, forward-word, backward-kill-word,..) +# WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default +# WORDCHARS=. +# WORDCHARS='*?_[]~=&;!#$%^(){}' +# WORDCHARS='${WORDCHARS:s@/@}' + +# only slash should be considered as a word separator: + slash-backward-kill-word() { + local WORDCHARS="${WORDCHARS:s@/@}" + # zle backward-word + zle backward-kill-word + } + zle -N slash-backward-kill-word + bindkey 'v' slash-backward-kill-word # press esc-v to delete a word until its last '/' (not the same as ctrl-w!) +# }}} + +# {{{ history + export ZSHDIR=$HOME/.zsh + HISTFILE=$HOME/.zsh_history + isgrmlcd && HISTSIZE=500 || HISTSIZE=5000 + isgrmlcd && SAVEHIST=1000 || SAVEHIST=10000 # useful for setopt append_history +# }}} + +# {{{ display battery status on right side of prompt via running 'BATTERY=1 zsh' + if [ -n "$BATTERY" ] ; then + if [ -x =acpi ] ; then + PERCENT="${(C)${(s| |)$(acpi 2>/dev/null)}[4]}" + [ -z "$PERCENT" ] && PERCENT='acpi not present' + if [ "${PERCENT%%%}" -lt 20 ] ; then + PERCENT="warning: ${PERCENT}%" + fi + fi + fi +# }}} + +# {{{ set prompt + autoload promptinit ; promptinit # people should be able to use their favourite prompt + # precmd() => a function which is executed just before each prompt + # precmd () { setopt promptsubst; [[ -o interactive ]] && jobs -l; + # run 'NOPRECMD=1 zsh' to disable the precmd + preexec commands + is4 && ! [[ -n "$NOPRECMD" ]] && precmd () { + if [ -n "$BATTERY" ] ; then + RPROMPT="%(?..:()% ${PERCENT}${SCREENTITLE}" + else + RPROMPT="%(?..:()% ${SCREENTITLE}" + fi + # adjust title of xterm + # see http://www.faqs.org/docs/Linux-mini/Xterm-Title.html + case $TERM in (xterm*|rxvt) + print -Pn "\e]0;%n@%m: %~\a" + ;; + esac + } + + # chpwd () => a function which is executed whenever the directory is changed + + # preexec() => a function running before every command + is4 && ! [[ -n "$NOPRECMD" ]] && preexec () { + # set screen window title if running in a screen + # get the name of the program currently running and hostname of local machine + local HOSTNAME=$(hostname) + if [[ "$HOSTNAME" != grml ]] ; then + NAME="@$HOSTNAME" + fi + if [[ "$TERM" == screen* ]]; then +# local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} # dont't use hostname + local CMD="${1[(wr)^(*=*|sudo|ssh|-*)]}$NAME" # use hostname + echo -ne "\ek$CMD\e\\" + fi + # set the screen title to "zsh" when sitting at the command prompt: + if [[ "$TERM" == screen* ]]; then + SCREENTITLE=$'%{\ekzsh\e\\%}' + else + SCREENTITLE='' + fi + # adjust title of xterm + case $TERM in (xterm*|rxvt) + print -Pn "\e]0;%n@%m: $1\a" + ;; + esac + } + + EXITCODE="%(?..%?%1v )" + local BLUE="%{%}" + local RED="%{%}" + local GREEN="%{%}" + local CYAN="%{%}" + local WHITE="%{%}" + local NO_COLOUR="%{%}" + PS2='`%_> ' # secondary prompt, printed when the shell needs more information to complete a command. + PS3='?# ' # selection prompt used within a select loop. + PS4='+%N:%i:%_> ' # the execution trace prompt (setopt xtrace). default: '+%N:%i>' + +# set variable debian_chroot if running in a chroot with /etc/debian_chroot + if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) + fi + +# don't use colors on dumb terminals (like emacs): + if [[ "$TERM" == dumb ]] ; then + PROMPT="${EXITCODE}${debian_chroot:+($debian_chroot)}%n@%m %40<...<%B%~%b%<< %# " + else + # only if $GRMLPROMPT is set (e.g. via 'GRMLPROMPT=1 zsh') use the extended prompt + # set variable identifying the chroot you work in (used in the prompt below) + if [[ -n "$GRMLPROMPT" ]]; then + PROMPT="${RED}${EXITCODE}${CYAN}[%j running job(s)] ${GREEN}{history#%!} ${RED}%(3L.+.) ${BLUE}%* %D +${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# " + else + if (( EUID != 0 )); then + PROMPT="${RED}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# " # primary prompt string + else + PROMPT="${BLUE}${EXITCODE}${WHITE}${debian_chroot:+($debian_chroot)}${RED}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# " # primary prompt string + fi + fi + fi + +# if we are inside a grml-chroot set a specific prompt theme + if [ -n "$GRML_CHROOT" ] ; then + PROMPT="%{$fg[red]%}(CHROOT) %{$fg_bold[red]%}%n%{$fg_no_bold[white]%}@%m %40<...<%B%~%b%<< %\# " + fi +# }}} + +# {{{ 'hash' some often used directories + hash -d deb=/var/cache/apt/archives + hash -d doc=/usr/share/doc + hash -d linux=/lib/modules/$(command uname -r)/build/ + hash -d log=/var/log + hash -d slog=/var/log/syslog + hash -d src=/usr/src + hash -d templ=/usr/share/doc/grml-templates + hash -d tt=/usr/share/doc/texttools-doc + hash -d www=/var/www +# }}} + +# {{{ some aliases + if [ $UID = 0 ] ; then + [ -r /etc/grml/screenrc ] && alias screen='/usr/bin/screen -c /etc/grml/screenrc' + elif [ -r $HOME/.screenrc ] ; then + alias screen="/usr/bin/screen -c $HOME/.screenrc" + else + [ -r /etc/grml/screenrc_grml ] && alias screen='/usr/bin/screen -c /etc/grml/screenrc_grml' + fi + + if ls --help 2>/dev/null |grep -- --color= >/dev/null && [ "$TERM" != dumb ] ; then + alias ls='ls -b -CF --color=auto' # do we have GNU ls with color-support? + alias la='ls -la --color=auto' + alias ll='ls -l --color=auto' + alias lh='ls -hAl --color=auto' + alias l='ls -lF --color=auto' + else + alias ls='ls -b -CF' + alias la='ls -la' + alias ll='ls -l' + alias lh='ls -hAl' + alias l='ls -lF' + fi + + alias cp='nocorrect cp' # no spelling correction on cp + alias mkdir='nocorrect mkdir' # no spelling correction on mkdir + alias mv='nocorrect mv' # no spelling correction on mv + alias rm='nocorrect rm' # no spelling correction on rm + + alias rd='rmdir' + alias md='mkdir' + + alias swspeak="setopt singlelinezle ; unsetopt prompt_cr ; export PS1='%m%# ' ; speechd-up" # set up software synth. + +# truecrypt; use e.g. via 'truec /dev/ice' /mnt/ice' or 'truec -i' + if [ -x /usr/sbin/truecrypt ] ; then + alias truec='truecrypt --mount-options "rw,sync,dirsync,users,uid=1000,gid=users,umask=077" ' + fi + + zsh-help(){print "$bg[white]$fg[black] +zsh-help - hints for use of zsh on grml +=======================================$reset_color + +Main configuration of zsh happens in /etc/zsh/zshrc (global) +and /etc/skel/.zshrc which is copied to \$HOME/.zshrc once. +The files are part of the package grml-etc, if you want to +use them on a non-grml-system just get the tar.gz from +http://grml.org/repos/ + +If you want to stay in sync with zsh configuration of grml +run 'ln -sf /etc/skel/.zshrc \$HOME/.zshrc' and configure +your own stuff in \$HOME/.zshrc.local. System wide configuration +without touching configuration files of grml can take place +in /etc/zsh/zshrc.local. + +If you want to use the configuration of user grml also when +running as user root just run 'zshskel' which will source +the file /etc/skel/.zshrc. + +For information regarding zsh start at http://grml.org/zsh/ + +Take a look at grml's zsh refcard: +% xpdf =(zcat /usr/share/doc/grml-docs/zsh/grml-zsh-refcard.pdf.gz) + +Check out the main zsh refcard: +% $BROWSER http://www.bash2zsh.com/zsh_refcard/refcard.pdf + +And of course visit the zsh-lovers: +% man zsh-lovers + +You can adjust some options through environment variables when +invoking zsh without having to edit configuration files. +Basically meant for bash users who are not used to the power of +the zsh yet. :) + + \"NOCOR=1 zsh\" => deactivate automatic correction + \"NOMENU=1 zsh\" => do not use menu completion (note: use strg-d for completion instead!) + \"NOPRECMD=1 zsh\" => disable the precmd + preexec commands (set GNU screen title) + \"BATTERY=1 zsh\" => activate battery status (via acpi) on right side of prompt +$bg[white]$fg[black] +Please report wishes + bugs to the grml-team: http://grml.org/bugs/ +Enjoy your grml system with the zsh!$reset_color" +} + +# debian stuff + if [ -r /etc/debian_version ] ; then + alias acs="apt-cache search" + alias acsh="apt-cache show" + alias adg="$SUDO apt-get dist-upgrade" + alias agi="$SUDO apt-get install" + alias ag="$SUDO apt-get upgrade" + alias au="$SUDO apt-get update" + alias dbp="dpkg-buildpackage" + alias ge="grep-excuses" + + 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 + fi + +# if cdrecord is a symlink (to wodim) or isn't present at all warn: + if [ -L /usr/bin/cdrecord -o ! -x =cdrecord ] ; then + if [ -x =wodim ] ; then + alias cdrecord="echo 'cdrecord is not provided under its original name by Debian anymore. +See #377109 in the BTS of Debian for more details. + +Please use the wodim binary instead' ; return 1" + fi + fi + +# }}} + +# {{{ 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 + limit -s +# }}} + +# {{{ completion stuff + +# Where to look for autoloaded function definitions + if [ -d /etc/zsh/completion.d ] ; then + local comp=/etc/zsh/completion.d + for func in $comp/*(N-.:t); . ${comp}/${func} + fi + +# called later (via is4 && grmlcomp) +# notice: use 'zstyle' for getting current settings +# press ^Xh (control-x h) for getting tags in context; ^X? (control-x ?) to run complete_debug with trace output +grmlcomp() { +## completion system + zstyle ':completion:*:approximate:' max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )' # allow one error for every three characters typed in approximate completer + zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~' # don't complete backup files as executables + zstyle ':completion:*:correct:*' insert-unambiguous true # start menu completion only if it could find no unambiguous initial string + zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}' # + zstyle ':completion:*:correct:*' original true # + zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} # activate color-completion(!) + zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}' # format on completion + zstyle ':completion:*:*:cd:*:directory-stack' menu yes select # complete 'cd -' with menu + zstyle ':completion:*:expand:*' tag-order all-expansions # insert all expansions for expand completer + zstyle ':completion:*:history-words' list false # + zstyle ':completion:*:history-words' menu yes # activate menu + zstyle ':completion:*:history-words' remove-all-dups yes # ignore duplicate entries + zstyle ':completion:*:history-words' stop yes # + zstyle ':completion:*:*:linda:*' file-patterns '*.deb' # complete debian packages for command 'linda' + zstyle ':completion:*:*:lintian:*' file-patterns '*.deb' # complete debian packages for command 'lintian' + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # match uppercase from lowercase + zstyle ':completion:*:matches' group 'yes' # separate matches into groups + if [[ -z "$NOMENU" ]] ; then + zstyle ':completion:*' menu select=5 # if there are more than 5 options allow selecting from a menu + else + setopt no_auto_menu # don't use any menus at all + fi + zstyle ':completion:*:messages' format '%d' # + zstyle ':completion:*:options' auto-description '%d' # + zstyle ':completion:*:options' description 'yes' # describe options in full + zstyle ':completion:*:processes' command 'ps -au$USER' # on processes completion complete all user processes + zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters # offer indexes before parameters in subscripts + zstyle ':completion:*' verbose true # provide verbose completion information + zstyle ':completion:*:warnings' format $'%{\e[0;31m%}No matches for:%{\e[0m%} %d' # set format for warnings + zstyle ':completion:*:*:zcompile:*' ignored-patterns '(*~|*.zwc)' # define files to ignore for zcompile + zstyle ':completion:correct:' prompt 'correct to: %e' # + zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*' # Ignore completion functions for commands you don't have: + +# complete manual by their section + zstyle ':completion:*:manuals' separate-sections true + zstyle ':completion:*:man:*' menu yes select + +## correction +# run rehash on completion so new installed program are found automatically: + _force_rehash() { + (( CURRENT == 1 )) && rehash + return 1 # Because we didn't really complete anything + } +# some people don't like the automatic correction - so run 'NOCOR=1 zsh' to deactivate it + if [[ -n "$NOCOR" ]] ; then + zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete + setopt nocorrect # do not try to correct the spelling if possible + else +# zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _correct _approximate + setopt correct # try to correct the spelling if possible + zstyle -e ':completion:*' completer ' + if [[ $_last_try != "$HISTNO$BUFFER$CURSOR" ]]; then + _last_try="$HISTNO$BUFFER$CURSOR" + reply=(_complete _match _prefix) + else + if [[ $words[1] = (rm|mv) ]]; then + reply=(_complete) + else + reply=(_oldlist _expand _force_rehash _complete _correct _approximate) + fi + fi' + fi +# zstyle ':completion:*' completer _complete _correct _approximate +# zstyle ':completion:*' expand prefix suffix + +# command for process lists, the local web server details and host completion + hosts=(`hostname` grml.org) + zstyle '*' hosts $hosts + zstyle ':completion:*:urls' local 'www' '/var/www/' 'public_html' + +# caching + [ -d $ZSHDIR/cache ] && zstyle ':completion:*' use-cache yes && \ + zstyle ':completion::complete:*' cache-path $ZSHDIR/cache/ + +# use ~/.ssh/known_hosts for completion [does not work with hashing of new ssh versions anymore] + if [ -f "$HOME/.ssh/known_hosts" ] ; then + hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) + zstyle ':completion:*:hosts' hosts $hosts + fi + +# use generic completion system for programs not yet defined: + compdef _gnu_generic tail head feh cp mv gpg df stow uname ipacsum fetchipac + +# see upgrade function in this file + compdef _hosts upgrade +} +# }}} + +# {{{ grmlstuff +grmlstuff() { +# people should use 'grml-x'! + function startx() { + if [ -e /etc/X11/xorg.conf ] ; then + [ -x /usr/bin/startx ] && /usr/bin/startx || /usr/X11R6/bin/startx + else + echo "Please use the script \"grml-x\" for starting the X Window System +because there does not exist /etc/X11/xorg.conf yet. +If you want to use startx anyway please call \"/usr/bin/startx\"." + return -1 + fi + } + + function xinit() { + if [ -e /etc/X11/xorg.conf ] ; then + [ -x /usr/bin/xinit ] && /usr/bin/xinit || /usr/X11R6/bin/xinit + else + echo "Please use the script \"grml-x\" for starting the X Window System. +because there does not exist /etc/X11/xorg.conf yet. +If you want to use xinit anyway please call \"/usr/bin/xinit\"." + return -1 + fi + } + + if [ -x /usr/sbin/915resolution ] ; then + alias 855resolution='echo -e "Please use 915resolution as resolution modify tool for Intel graphic chipset."; return -1' + fi + + alias grml-version='cat /etc/grml_version' + + if [ -x /usr/sbin/rebuildfstab ] ; then + local fstabuser=$(getent passwd 1000 | cut -d: -f1) + alias grml-rebuildfstab="rebuildfstab -v -r -u $fstabuser -g $fstabuser" + fi +} +# }}} + +# {{{ now run the functions + isgrml && checkhome + is4 && isgrml && grmlstuff + is4 && grmlcomp +# }}} + +# {{{ keephack + [ -r /etc/zsh/keephack ] && is4 && source /etc/zsh/keephack +# }}} + +# {{{ wonderful idea of using "e" glob qualifier by Peter Stephenson +# You use it as follows: +# $ NTREF=/reference/file +# $ ls -l *(e:nt:) +# This lists all the files in the current directory newer than the reference file. +# You can also specify the reference file inline; note quotes: +# $ ls -l *(e:'nt ~/.zshenv':) + is4 && nt() { + if [[ -n $1 ]]; then + local NTREF=${~1} + fi + [[ $REPLY -nt $NTREF ]] + } +# }}} + +# shell functions {{{ + setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility + freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done } + manzsh() { /usr/bin/man zshall | vim -c "se ft=man| se hlsearch" +/"$1" - ; } +# manzsh() { man zshall | $MYLESS -p $1 ; } +# manzsh() { /usr/bin/man zshall | most +/"$1" ; } + +# use "dchange " to view Debian's changelog of the package: + dchange() { most /usr/share/doc/${1}/changelog.Debian.gz ; } + _dchange() { _files -W /usr/share/doc -/ } + compdef _dchange dchange + +# use "uchange " to view upstream's changelog of the package: + uchange() { most /usr/share/doc/${1}/changelog.gz ; } + _uchange() { _files -W /usr/share/doc -/ } + compdef _uchange uchange + +# edit alias via zle: + edalias() { + [ -z "$1" ] && { echo "Usage: edalias " ; return 1 } || vared aliases'[$1]' ; + } + compdef _aliases edalias + +# edit function via zle: + edfun() { + [ -z "$1" ] && { echo "Usage: edfun " ; return 1 } || zed -f "$1" ; + } + compdef _functions edfun + +# use it e.g. via 'Restart apache2' + if [ -d /etc/init.d ] ; then + for i in Start Restart Stop 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 + fi +# }}} + +# source another config file if present {{{ + if [ -r /etc/zsh/zshrc.local ]; then + source /etc/zsh/zshrc.local + fi +# }}} + +# "persistent history" {{{ +# just write important commands you always need to ~/.important_commands + if [ -r ~/.important_commands ] ; then + fc -R ~/.important_commands + fi +# }}} + +## END OF FILE ################################################################# +# vim:foldmethod=marker -- 2.1.4