Ver Fonte

Build tweaks

Jakob Borg há 13 anos atrás
pai
commit
cb304e145a
1 ficheiros alterados com 7 adições e 1 exclusões
  1. 7 1
      Makefile

+ 7 - 1
Makefile

@@ -3,11 +3,17 @@ BIN := zsnapper node_modules
 SMF := zsnapper.xml
 ETC := zsnapper.json.sample
 TAR := smartos-zsnapper.tar.gz
+UID = $(shell id -u)
+
 
 $(TAR): $(BIN) $(SMF) $(ETC) $(BUILD)/opt/local/bin $(BUILD)/opt/local/etc $(BUILD)/opt/custom/smf
+ifneq ($(UID), 0)
+	$(error Should run as uid 0 for correct file ownership; consider fakeroot)
+endif
 	cp -r $(BIN) $(BUILD)/opt/local/bin
 	cp -r $(ETC) $(BUILD)/opt/local/etc
 	cp -r $(SMF) $(BUILD)/opt/custom/smf
+	chown -R 0:0 $(BUILD)
 	tar -C $(BUILD) -zcf $@ opt
 
 node_modules:
@@ -21,5 +27,5 @@ $(BUILD)/opt/custom/smf:
 	mkdir -p $@
 
 clean:
-	rm -rf .build $(TAR)
+	rm -rf .build $(TAR) node_modules
 .PHONY: clean