forked from kiss-community/kiss
kiss: Further simplify utilities.
This commit is contained in:
parent
23448e5079
commit
10333def43
@ -23,7 +23,6 @@ clean() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
|
||||||
[ -z "$1" ] && die Need a path to the chroot
|
[ -z "$1" ] && die Need a path to the chroot
|
||||||
[ -d "$1" ] || die Given path does not exist
|
[ -d "$1" ] || die Given path does not exist
|
||||||
[ "$(id -u)" = 0 ] || die Script needs to be run as root
|
[ "$(id -u)" = 0 ] || die Script needs to be run as root
|
||||||
@ -53,6 +52,3 @@ main() {
|
|||||||
MAKEFLAGS="-j$(nproc 2>/dev/null || echo 1)" \
|
MAKEFLAGS="-j$(nproc 2>/dev/null || echo 1)" \
|
||||||
/bin/sh -l
|
/bin/sh -l
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
@ -2,45 +2,30 @@
|
|||||||
# Create a boilerplate package.
|
# Create a boilerplate package.
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
printf 'error: %s.\n' "$*" >&2
|
printf '%s\n' "$*"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
printf '=> %s.\n' "$*"
|
printf '=> %s.\n' "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
[ "$1" ] || die "usage: kiss-new [name] [version] [source]"
|
||||||
[ "$1" ] || {
|
[ -d "$1" ] && die "error: Package $1 already exists"
|
||||||
log Create boilerplate KISS packages
|
mkdir -p "$1" || die "error: Couldn't create directory in $PWD"
|
||||||
log Usage: kiss-new name version source
|
cd "$1" || die "error: Couldn't enter directory $1/"
|
||||||
|
|
||||||
exit
|
log "Creating build file"; {
|
||||||
}
|
|
||||||
|
|
||||||
[ -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
|
printf '#!/bin/sh -e\n' > build
|
||||||
chmod +x build
|
chmod +x build
|
||||||
}
|
}
|
||||||
|
|
||||||
log Creating version file with "'${2%% *} 1'"; {
|
log "Creating version file with '${2%% *} 1'"; {
|
||||||
printf '%s\n' "${2%% *} 1" > version
|
printf '%s\n' "${2%% *} 1" > version
|
||||||
}
|
}
|
||||||
|
|
||||||
log Creating sources file with "'$3'"; {
|
log "Creating sources file with '$3'"; {
|
||||||
printf '%s\n' "$3" > sources
|
printf '%s\n' "$3" > sources
|
||||||
}
|
}
|
||||||
|
|
||||||
log Package "$1" created in "$PWD"
|
log "Package $1 created in $PWD"
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user