summaryrefslogtreecommitdiff
path: root/include/newpackage
blob: 924da442778f6b33e3ea59e5496aa447f18c8e82 (plain)
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
#!/usr/bin/env zsh
## Set up a new package in the package_root
setopt err_exit
typeset package=$1
typeset -i bare=1

while [[ $1 == --* ]] {
	case $1 in
		--not-bare) bare=0
	esac
	shift
}

[[ -r ~/.pkg.conf ]] && source ~/.pkg.conf
[[ -d $PKG_ROOT ]] || exit 1

cd $PKG_ROOT
if [[ -d $package ]] {
	echo "Package $package already exists" >&2
	exit 2
}
mkdir $package
cd $package
if ((bare)) {
	git --bare init
} else {
	git init
	git config receive.denyCurrentBranch ignore
}

cd ${PKG_DIR-~/packages}
mkdir $package
cd $package
git init