forked from kiss-community/kiss
kiss-new: Create boilerplate kiss packages
This commit is contained in:
parent
3df4c95d3b
commit
17ee3eaed4
45
contrib/kiss-new
Executable file
45
contrib/kiss-new
Executable file
@ -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 "$@"
|
Loading…
Reference in New Issue
Block a user