Skip to content

Commit

Permalink
zshrc: Move minimal-shell to its own file
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
  • Loading branch information
ft authored and mika committed Dec 6, 2011
1 parent f3c3139 commit 15383cb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 0 additions & 4 deletions doc/grmlzshrc.t2t
Expand Up @@ -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.
Expand Down
13 changes: 0 additions & 13 deletions etc/zsh/zshrc
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions 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}

0 comments on commit 15383cb

Please sign in to comment.