aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-new
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cpt-new')
-rwxr-xr-xcontrib/cpt-new23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/cpt-new b/contrib/cpt-new
new file mode 100755
index 0000000..a068704
--- /dev/null
+++ b/contrib/cpt-new
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+# Create a boilerplate KISS package
+
+out() { printf '\033[1;33m-> \033[m%s\n' "$@" >&2 ;}
+die() { printf '\033[1;31m!> \033[m%s\n' "$@" >&2 ; exit 1 ;}
+
+case "$1" in ''|--help|-h) out "usage: ${0##*/} [name] [version] [source]"; exit 0; esac
+
+[ -d "$1" ] && die "Package '$1' already exists."
+
+# Create the directory
+mkdir -p "$1"
+
+# Create the build file
+printf '%s\n' "#!/bin/sh -e" > "$1/build" ; chmod +x "$1/build"
+
+# Create the version file
+printf '%s\n' "$2 1" > "$1/version"
+
+# Create the sources file
+printf '%s\n' "$3" > "$1/sources"
+
+out "Package '$1' created to '$PWD/$1'"