Make the script curl runnable
This commit is contained in:
parent
4b126bd540
commit
39acf5cae1
23
setup.sh
23
setup.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CMD="$0"
|
||||
set -o pipefail
|
||||
|
||||
[ "$NAME" ] || NAME=
|
||||
[ "$EMAIL" ] || EMAIL=
|
||||
|
@ -13,12 +13,17 @@ die() { echo "$1" 1>&2 && show_help && [ "$2" ] && [ "$2" -ge 0 ] && exit "$2" |
|
|||
|
||||
# Show help function to be used below
|
||||
show_help() {
|
||||
awk 'NR>1{print} /^(###|$)/{exit}' "$CMD"
|
||||
echo "USAGE: $(basename "$CMD") [arguments]"
|
||||
echo "USAGE: setup.sh [arguments]"
|
||||
echo "ARGS:"
|
||||
MSG=$(awk '/^NARGS=-1; while/,/^esac; done/' "$CMD" | sed -e 's/^[[:space:]]*/ /' -e 's/|/, /' -e 's/)//' | grep '^ -')
|
||||
EMSG=$(eval "echo \"$MSG\"")
|
||||
echo "$EMSG"
|
||||
cat <<HELP
|
||||
-h, --help # This help message
|
||||
-n, --name # Name for git
|
||||
-e, --email # Email for git
|
||||
-s, --server # Server for irssi
|
||||
-P, --port # Port for irssi
|
||||
-N, --nick # Nick for irssi
|
||||
-p, --password # Password for irssi
|
||||
HELP
|
||||
}
|
||||
|
||||
# Parse command line options (odd formatting to simplify show_help() above)
|
||||
|
@ -66,7 +71,11 @@ elif [[ "$UNAMESTR" == 'Darwin' ]]; then
|
|||
true
|
||||
fi
|
||||
|
||||
git clone git@git.chrissexton.org:cws/dotfiles.git "$HOME"/.dotfiles
|
||||
if [ ! -d "$HOME"/.dotfiles ]; then
|
||||
git clone git@git.chrissexton.org:cws/dotfiles.git "$HOME"/.dotfiles
|
||||
elif [ ! -d "$HOME"/.dotfiles/files ]; then
|
||||
die "You must have a destination for the dotfiles repository!"
|
||||
fi
|
||||
DOTFILES="$HOME"/.dotfiles
|
||||
|
||||
cat "$DOTFILES"/files/gitignore_global > "$HOME"/.gitignore_global
|
||||
|
|
Loading…
Reference in New Issue