Fixed typo.
[dcp.git] / dcp-init
index 7bd3d7e..38f0459 100755 (executable)
--- a/dcp-init
+++ b/dcp-init
@@ -3,7 +3,7 @@
 set -e
 
 usage() {
-    echo "usage: dcp-init [-C key=val] [-d REPODIR] PACKAGE [PATCH...]"
+    echo "usage: dcp-init [-sh] [-C key=val] [-d REPODIR] PACKAGE [PATCH...]"
     echo "       PATCH ::= [-p LEVEL] [-bB BRANCH] FILE"
     echo "       -b creates a new branch at the current patch"
     echo "       -B creates a new branch at the upstream sources"
@@ -20,9 +20,6 @@ getaptsrc() {
     mkdir "$td/apt-tmp"
     (cd "$td/apt-tmp"; apt-get source "$1") || false
     
-    echo Achtung
-    sleep 10
-
     sdir=
     for f in "$td/apt-tmp"/*; do
        if [ -d "$f" ]; then
@@ -45,7 +42,7 @@ getaptsrc() {
 }
 
 initrepo() {
-    rungit init -q
+    rungit init
     mkdir "$td/control"
     touch "$td/control/conf"
     rungit add control
@@ -58,6 +55,11 @@ initbase() {
     mkdir "$td/control/update.d"
     cat >"$td/control/functions" <<EOF
 readconf() {
+    if [ -r "\$HOME/.dcp-build-conf" ]; then
+        while read key val; do
+            export "CONF_\$key"="\$val"
+        done <"\$HOME/.dcp-build-conf"
+    fi
     while read key val; do
         export "CONF_\$key"="\$val"
     done <control/conf
@@ -112,7 +114,7 @@ initapt() {
 
 set -e
 
-cmd=(dpkg-buildpackage -b)
+cmd=(dpkg-buildpackage -b -rfakeroot)
 if [ -n "\$CONF_MAINTAINER" ]; then
     cmd=("\${cmd[@]}" "-m\$CONF_MAINTAINER")
 fi
@@ -142,6 +144,7 @@ EOF
 defdir=/srv/dcp
 repodir=
 confopts=()
+shared=n
 
 while [ "${1:0:1}" = - ]; do
     opt="${1:1}"
@@ -152,6 +155,8 @@ while [ "${1:0:1}" = - ]; do
     elif [ "$opt" = h ]; then
        usage
        exit 0
+    elif [ "$opt" = s ]; then
+       shared=y
     elif [ "$opt" = C ]; then
        confopts=("${confopts[@]}" "$1")
        shift
@@ -232,5 +237,9 @@ while [ $# -gt 0 ]; do
 done
 
 git clone -q --bare "$td" "$repodir"
+if [ "$shared" = y ]; then
+    chmod -R g+w "$repodir"
+    td="$repodir" rungit config core.sharedrepository 1
+fi
 
 rm -rf "$td"