1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-24 16:10:05 -07:00
kiss/contrib/kiss-new

32 lines
661 B
Plaintext
Raw Normal View History

#!/bin/sh
2020-05-01 00:07:20 -06:00
# Create a boilerplate package
die() {
2020-04-18 03:27:38 -06:00
printf '%s\n' "$*"
exit 1
}
log() {
2020-04-18 03:27:38 -06:00
printf '=> %s.\n' "$1"
}
2020-04-18 03:27:38 -06:00
[ "$1" ] || die "usage: kiss-new [name] [version] [source]"
[ -d "$1" ] && die "error: Package $1 already exists"
mkdir -p "$1" || die "error: Couldn't create directory in $PWD"
cd "$1" || die "error: Couldn't enter directory $1/"
2020-04-18 03:27:38 -06:00
log "Creating build file"; {
printf '#!/bin/sh -e\n' > build
chmod +x build
}
2020-04-18 03:27:38 -06:00
log "Creating version file with '${2%% *} 1'"; {
printf '%s\n' "${2%% *} 1" > version
}
2020-04-18 03:27:38 -06:00
log "Creating sources file with '$3'"; {
printf '%s\n' "$3" > sources
}
2020-04-18 03:27:38 -06:00
log "Package $1 created in $PWD"