mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Add scouts honor escape hatch for source embedding
This commit is contained in:
parent
c91b3c5006
commit
b4269930f7
547 changed files with 1516 additions and 944 deletions
33
examples/package/new.sh
Executable file
33
examples/package/new.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# Creates new package in repository.
|
||||
#
|
||||
# EXAMPLE
|
||||
#
|
||||
# examples/package/new.sh com/github/user/project
|
||||
|
||||
DIR=${1:?need directory arg}
|
||||
VAR=$(echo "$DIR" | tr a-z A-Z | tr / _)
|
||||
BASENAME=${DIR##*/}
|
||||
FILENAME="$DIR/$BASENAME"
|
||||
MAKEFILE="$DIR/$BASENAME.mk"
|
||||
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "already exists: $DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DIR" &&
|
||||
cp -R examples/package/new/* "$DIR" &&
|
||||
find "$DIR" -type f |
|
||||
xargs sed -i -e "
|
||||
s/EXAMPLES_PACKAGE/$VAR/g
|
||||
s/examples\/package\/package/$FILENAME/g
|
||||
s/examples\/package/$DIR/g
|
||||
" &&
|
||||
sed -i -e "
|
||||
/#-φ-examples\/package\/new\.sh/i\
|
||||
include $MAKEFILE
|
||||
" Makefile
|
Loading…
Add table
Add a link
Reference in a new issue