summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-03-18 10:18:53 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-03-18 10:18:53 -0400
commit21b3a17b9b3e0ab21354b22b8b4017380d0a39ea (patch)
treee6f1f620b36a1984ed6da5d03e60de7ea9c5aace
parente42d401d0f379a6c6ec541eaf05682973abf4bf9 (diff)
add pbs-init
-rwxr-xr-xpbs-init41
1 files changed, 41 insertions, 0 deletions
diff --git a/pbs-init b/pbs-init
new file mode 100755
index 0000000..40918bc
--- /dev/null
+++ b/pbs-init
@@ -0,0 +1,41 @@
+#!/bin/bash -euE
+
+. pbs-plumb-shlib
+
+cmd=${0##*/}
+usage() {
+ echo "Usage: $cmd [OPTIONS] [DIRECTORY]"
+ echo 'Creates a new pbs repository'
+ echo ''
+ echo 'Options:'
+ echo ' -h Show this message'
+}
+
+main() {
+ while getopts 'h' arg; do
+ case $arg in
+ h) usage; return 0;;
+ *) usage; return 1;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+ if [[ $# > 1 ]]; then
+ usage
+ return 1
+ fi
+
+ local dir=${1:-./}
+ mkdir -p "$dir"
+ cd "$dir"
+
+ if in_pbs; then
+ error "Already in a PBS directory"
+ exit 1
+ fi
+
+ git init
+ touch .pbs-root
+ git commit -m 'initial commit' .pbs-root
+}
+
+main "$@"