From 99ec2b49e0496425a245157d4fed811754032d3b Mon Sep 17 00:00:00 2001 From: mathias Date: Thu, 17 Mar 2005 00:05:50 +0000 Subject: [PATCH] added -c to startfluxbox so one can have different startup-files --- util/startfluxbox.in | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/util/startfluxbox.in b/util/startfluxbox.in index bbe7bf69..7e5de20e 100755 --- a/util/startfluxbox.in +++ b/util/startfluxbox.in @@ -1,15 +1,41 @@ #!/bin/sh # $Id$ -if [ -x ~/.fluxbox/startup ]; then - exec ~/.fluxbox/startup -elif [ -r ~/.fluxbox/startup ]; then - exec sh ~/.fluxbox/startup + +command="`basename \"$0\"`" +startup="~/.fluxbox/startup" + +while [ $# -gt 0 ]; do + case "$1" in + -c|--config) + if [ $# -lt 2 ]; then + echo "$command:error, missing argument" + exit 1 + fi + shift + startup=$1 + ;; + -h|--help) cat < ~/.fluxbox/startup + if [ ! -r "$startup" ]; then + cat << EOF > "$startup" # fluxbox startup-script: # # Lines starting with a '#' are ignored. @@ -61,6 +87,6 @@ exec @pkgbindir@/fluxbox # exec @pkgbindir@/fluxbox -log ~/.fluxbox/log EOF fi - chmod 755 ~/.fluxbox/startup - exec ~/.fluxbox/startup + chmod 755 "$startup" + exec "$startup" fi