Bladeren bron

Makefile: Don't silently install user's config files.

We request the admin to copy them over themself.
parazyd 4 jaren geleden
bovenliggende
commit
42d32b9e51
4 gewijzigde bestanden met toevoegingen van 24 en 32 verwijderingen
  1. 10 22
      Makefile
  2. 10 6
      README.md
  3. 2 2
      example/config/cashierd.toml
  4. 2 2
      example/config/darkfid.toml

+ 10 - 22
Makefile

@@ -1,8 +1,7 @@
 .POSIX:
 
 PREFIX = /usr/local
-CONFDIR = $(HOME)/.config/darkfi
-DLURL = http://185.165.171.77
+DLURL = https://testnet.cashier.dark.fi
 
 CARGO = cargo
 DLTOOL = wget -nv --show-progress -O-
@@ -17,18 +16,12 @@ BINDEPS = \
 	$(shell find token -type f) \
 	$(shell find sql -type f)
 
-all: $(BINS) uid confdir mint.params spend.params
+all: $(BINS) mint.params spend.params
 
 $(BINS): $(BINDEPS)
 	$(CARGO) build --release --all-features --bin $@
 	cp target/release/$@ $@
 
-uid:
-	id -u > $@
-
-confdir:
-	@echo "$(CONFDIR)" > $@
-
 %.params:
 	$(DLTOOL) $(DLURL)/$@ > $@
 
@@ -41,29 +34,24 @@ fix:
 clippy:
 	$(CARGO) clippy --release --all-features
 
-install:
-	@if ! [ -f uid ]; then \
-		echo "Please run 'make' as user first." ; \
-		exit 1 ; \
-	fi;
+install: all
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
+	mkdir -p $(DESTDIR)$(PREFIX)/share/darkfi
+	mkdir -p $(DESTDIR)$(PREFIX)/share/doc/darkfi
 	cp -f $(BINS) $(DESTDIR)$(PREFIX)/bin
-	mkdir -p "$(shell cat confdir)"
-	for i in $(BINS); \
-	do \
-		cp example/config/$$i.toml "$(shell cat confdir)" ; \
-	done;
-	cp mint.params spend.params "$(shell cat confdir)"
-	chown -R "$(shell cat uid):$(shell cat uid)" "$(shell cat confdir)"
+	cp -f example/config/*.toml $(DESTDIR)$(PREFIX)/share/doc/darkfi
+	cp -f mint.params spend.params $(DESTDIR)$(PREFIX)/share/darkfi
 
 uninstall:
 	for i in $(BINS); \
 	do \
 		rm -f $(DESTDIR)$(PREFIX)/bin/$$i; \
 	done;
+	rm -rf $(DESTDIR)$(PREFIX)/share/doc/darkfi
+	rm -rf $(DESTDIR)$(PREFIX)/share/darkfi
 
 clean:
-	rm -f $(BINS) mint.params spend.params uid confdir
+	rm -f $(BINS) mint.params spend.params
 
 distclean: clean
 	rm -rf target

+ 10 - 6
README.md

@@ -15,19 +15,23 @@ $ make
 
 ## Install
 
-This will install the binaries in `/usr/local`, and set up the
-config files in your user's `$HOME/.config/darkfi`. You can review
-the installed config files, but the defaults should be good for using
-the testnet.
+This will install the binaries and configurations in the configured
+namespace (`/usr/local` by default). The configurations are installed
+as TOML files in `/usr/local/share/doc/darkfi`. They have to be copied
+in your user's `$HOME/.config/darkfi` directory. You can review the
+installed config files, but the defaults should be good for using
+the testnet if you're following this document.
 
 ```
 $ sudo make install
+$ mkdir -p ~/.config/darkfi
+$ cp -f /usr/local/share/doc/darkfi/*.toml ~/.config/darkfi
 ```
 
 ## Usage
 
-After the installation, you should have `drk` and `darkfid` binaries in
-`/usr/local`. Also, the params and configuration files should be in
+After the installation, you should have `drk` and `darkfid`
+binaries in `/usr/local`. Also, the configuration files should be in
 `~/.config/darkfi`. Now we're ready to use the testnet.
 
 In one terminal, start `darkfid`, which is the daemon that will

+ 2 - 2
example/config/cashierd.toml

@@ -24,10 +24,10 @@ gateway_protocol_url = "tcp://testnet.gateway-protocol.dark.fi:3333"
 gateway_publisher_url = "tcp://testnet.gateway-publish.dark.fi:4444"
 
 # Path to mint.params
-mint_params_path = "~/.config/darkfi/mint.params"
+mint_params_path = "/usr/local/share/darkfi/mint.params"
 
 # Path to spend.params
-spend_params_path = "~/.config/darkfi/spend.params"
+spend_params_path = "/usr/local/share/darkfi/spend.params"
 
 # Path to cashierd wallet
 cashier_wallet_path = "~/.config/darkfi/cashier_wallet.db"

+ 2 - 2
example/config/darkfid.toml

@@ -24,10 +24,10 @@ gateway_protocol_url = "tcp://testnet.gateway-protocol.dark.fi:3333"
 gateway_publisher_url = "tcp://testnet.gateway-publish.dark.fi:4444"
 
 # Path to mint.params
-mint_params_path = "~/.config/darkfi/mint.params"
+mint_params_path = "/usr/local/share/darkfi/mint.params"
 
 # Path to spend.params
-spend_params_path = "~/.config/darkfi/spend.params"
+spend_params_path = "/usr/local/share/darkfi/spend.params"
 
 # Path to the client database
 database_path = "~/.config/darkfi/darkfid_client.db"