summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/alias/short2
-rw-r--r--etc/completion2
-rw-r--r--etc/functions/off11
-rw-r--r--etc/parameters9
4 files changed, 19 insertions, 5 deletions
diff --git a/etc/alias/short b/etc/alias/short
index 2c1431e..e2c42e8 100644
--- a/etc/alias/short
+++ b/etc/alias/short
@@ -73,7 +73,7 @@ salias s2d='s2disk'
salias s2r='s2ram -f'
## SSH Hosts
-for host in $hosts; {
+for host in ${(k)hosts}; {
alias $host="ssh $host"
}
unset host
diff --git a/etc/completion b/etc/completion
index 8671712..51a9a2b 100644
--- a/etc/completion
+++ b/etc/completion
@@ -34,7 +34,7 @@ zstyle ':completion:*:*:(todo|td*):*:items' menu yes
function _hosts {
typeset expl
_wanted host expl 'host name' \
- compadd $hosts
+ compadd ${(k)hosts}
}
if [[ -r $compdump ]] {
diff --git a/etc/functions/off b/etc/functions/off
index 3e65aef..7ecaec9 100644
--- a/etc/functions/off
+++ b/etc/functions/off
@@ -1,8 +1,9 @@
## vim:ft=zsh
+autoload warn
typeset filesystem line IFS=$'\n'
typeset -a filesystems
typeset tune2fs
-typeset reboot simulate
+typeset -i force reboot simulate
function execute {
(( simulate )) || $*
@@ -12,10 +13,18 @@ while [[ $1 == -* ]] {
case $1 in
-n) simulate=1 ;;
-r) reboot=1 ;;
+ --force) force=1 ;;
esac
shift
}
+# Don't shut down a server too easily
+if [[ $force != 1 && $hosts[$HOST] == *:server:* ]] {
+ warn "This seems to be a server... not shutting down"
+ echo "Use 'off --force' if you really mean it"
+ return 1
+}
+
execute uinit stop-all
for line in $(cat /etc/fstab); {
if [[ $line == *[12] ]] {
diff --git a/etc/parameters b/etc/parameters
index 3eb3904..aac7f87 100644
--- a/etc/parameters
+++ b/etc/parameters
@@ -10,9 +10,14 @@ TIMEFMT='%J (%P) - %*E real, %*U user, %*S system'
# zshrc parameters
compdump='var/cache/zsh/compdump'
+typeset -A hosts
hosts=(
- kraftwerk saviour kappa nemesis aneurysm
- sievert
+ kraftwerk ''
+ saviour ''
+ kappa ':server:'
+ nemesis ''
+ aneurysm ':server:'
+ sievert ''
)
# Paths