summaryrefslogtreecommitdiff
path: root/include/newpackage
blob: ebba174d234e1d0e199d83be41d46b9afa2420db (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 ${PDIR-~/packages}
mkdir $package
cd $package
git init