From 15383cbd49486d38a233e79ab20aea23db81f359 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Wed, 30 Nov 2011 12:04:30 +0100 Subject: [PATCH] zshrc: Move minimal-shell to its own file Signed-off-by: Frank Terbeck --- doc/grmlzshrc.t2t | 4 ---- etc/zsh/zshrc | 13 ------------- usr_share_grml/zsh/functions/minimal-shell | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 usr_share_grml/zsh/functions/minimal-shell diff --git a/doc/grmlzshrc.t2t b/doc/grmlzshrc.t2t index c058db9..d10e0db 100644 --- a/doc/grmlzshrc.t2t +++ b/doc/grmlzshrc.t2t @@ -569,10 +569,6 @@ Returns true, if run within an utf environment, else false. Creates directory including parent directories, if necessary. Then changes current working directory to it. -: **minimal-shell()** -Spawns a minimally set up MirBSD Korn shell. It references no files in /usr, -so that file system can be unmounted. - : **modified()** Lists files in current directory, which have been modified within the last N days. N is an integer to be passed as first and only argument. diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 7c71ff4..ef4b3a9 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2149,19 +2149,6 @@ deswap() { print 'Finished, running "swapoff -a; swapon -a" may also be useful.' } -# spawn a minimally set up mksh - useful if you want to umount /usr/. -minimal-shell() { - emulate -L zsh - local shell="/bin/mksh" - - if [[ ! -x ${shell} ]]; then - printf '`%s'\'' not available, giving up.\n' ${shell} >&2 - return 1 - fi - - exec env -i ENV="/etc/minimal-shellrc" HOME="$HOME" TERM="$TERM" ${shell} -} - # a wrapper for vim, that deals with title setting # VIM_OPTIONS # set this array to a set of options to vim you always want diff --git a/usr_share_grml/zsh/functions/minimal-shell b/usr_share_grml/zsh/functions/minimal-shell new file mode 100644 index 0000000..dd72cff --- /dev/null +++ b/usr_share_grml/zsh/functions/minimal-shell @@ -0,0 +1,15 @@ +# spawn a minimally set up mksh - useful if you want to umount /usr/. +emulate -L zsh + +local shell="/bin/mksh" +local env_file="/etc/minimal-shellrc" + +if [[ ! -x ${shell} ]]; then + printf '`%s'\'' not available, giving up.\n' ${shell} >&2 + return 1 +elif [[ ! -f ${env_file} ]]; then + printf 'minimal-shell: Configuration missing: `%s'\''\n' ${shell} >&2 + return 2 +fi + +exec env -i ENV="$env_file" HOME="$HOME" TERM="$TERM" ${shell} -- 2.1.4