devstructure / debra

build Debian packages
Other
16 stars 0 forks source link

Is 'root' really necessary? #7

Open mcallaway opened 10 years ago

mcallaway commented 10 years ago

You could leverage "fakeroot" to avoid needing root permissions:

  diff --git a/Makefile.in b/Makefile.in
  index 1caf7f1..4b20ff7 100644
  --- a/Makefile.in
  +++ b/Makefile.in
  @@ -60,16 +60,11 @@ uninstall:
          rmdir $(DESTDIR)$(datarootdir)/debra

   deb:
  -ifeq (root, $(shell whoami))
          bin/debra create debian control
          $(GIT) archive --prefix=debian/ HEAD | $(GZIP) >debian.tar.gz
          bin/debra sourceinstall debian debian.tar.gz -p /usr
          rm debian.tar.gz
  -       chown -R root:root debian
  -       bin/debra build debian debra_$(VERSION)_all.deb
  +       fakeroot bin/debra build debian debra_$(VERSION)_all.deb
          bin/debra destroy debian
  -else
  -       @echo "You must be root to build a Debian package."
  -endif

   .PHONY: all install uninstall man deb