-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·60 lines (46 loc) · 1.17 KB
/
setup.sh
File metadata and controls
executable file
·60 lines (46 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
set -o errexit -o errtrace -o pipefail
trap 'echo "Error on line ${LINENO}"' ERR
[ -d .git ] || git init
if ! git diff --cached --exit-code; then
echo "Git repository is not clean; please commit and try again." >&2
exit 1
fi
safecreate () {
file=$1
shift
if [ -e $file ]; then
echo "$file already exists"
else
echo "Creating $file"
echo $@ > $file
git add $file
fi
}
safecp () {
[ $# -eq 2 ] || exit 1
local src=$1
local dest=$2
if [ -e $dest ]; then
echo $dest already exists
else
echo Copying $src to $dest and adding to git
cp $src $dest
git add $dest
fi
}
safecp pgxntool/_.gitignore .gitignore
safecp pgxntool/META.in.json META.in.json
safecreate Makefile include pgxntool/base.mk
make META.json
git add META.json
mkdir -p sql test src
cd test
safecp ../pgxntool/test/deps.sql deps.sql
[ -d pgxntool ] || ln -s ../pgxntool/test/pgxntool .
git add pgxntool
git status
echo "If you won't be creating C code then you can:
rmdir src
If everything looks good then
git commit -am 'Add pgxntool (https://github.com/decibel/pgxntool/tree/release)'"