aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-22 17:00:29 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-22 17:00:29 +0000
commitc70c7f2e91cf571c4fa5bfea07f1f9ffe92a9d02 (patch)
treea0055a59bd2ce76f9c2f3c469475df20dca98742 /contrib
parentfa6c3ca3ee14909c1949c018ae6833b24259ed6f (diff)
downloadcpt-c70c7f2e91cf571c4fa5bfea07f1f9ffe92a9d02.tar.gz
kiss-new: Create boilerplate kiss packages
FossilOrigin-Name: f3578293ef4d35f20cd7b7ac1f146b40c4c26d439a69a68aef2e815e6c2f29ae
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/kiss-new45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/kiss-new b/contrib/kiss-new
new file mode 100755
index 0000000..c5ded48
--- /dev/null
+++ b/contrib/kiss-new
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+die() {
+ printf 'error: %s.\n' "$*" >&2
+ exit 1
+}
+
+log() {
+ printf '=> %s.\n' "$*"
+}
+
+main() {
+ [ "$1" ] || {
+ log Create boilerplate KISS packages
+ log Usage: kiss-new name version source
+
+ exit
+ }
+
+ [ -d "$1" ] &&
+ die Package "$1" already exists.
+
+ mkdir -p "$1" ||
+ die Couldn\'t create directory in "$PWD"
+
+ cd "$1" ||
+ die Couldn\'t enter directory "$1/"
+
+ log Creating build file; {
+ printf '#!/bin/sh -e\n' > build
+ chmod +x build
+ }
+
+ log Creating version file with "'${2%% *} 1'"; {
+ printf '%s\n' "${2%% *} 1" > version
+ }
+
+ log Creating sources file with "'$3'"; {
+ printf '%s\n' "$3" > sources
+ }
+
+ log Package "$1" created in "$PWD"
+}
+
+main "$@"