Accept a name for dl and include starter script file
[khome.git] / Makefile
index abcaefb..7a32ec4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 MAKEFLAGS := --no-builtin-rules
+SHELL     := /bin/bash
 
 DEPS := $(wildcard deps/*)
 
@@ -20,7 +21,10 @@ endif
     home \
     diff \
     pull \
-    mpdconf \
+    push \
+    dirs \
+    pkgs_void \
+    pkgs_void_update \
     pkgs_brew_cask_install \
     pkgs_brew_install \
     pkgs_cargo \
@@ -39,19 +43,13 @@ default:
        @echo '================================================================================'
        @exit 1
 
-home: mpdconf compiled
+home: compiled dirs
        cp -Rp bin $(HOME)/
-       # Limit depth because directories are copied recursively:
-       find home -maxdepth 1 -print0 \
-       | $(GREP) -zv '^home$$' \
-       | xargs -0 -I% cp -Rp % ~
+       $(MAKE) push
+       xdg-user-dirs-update
 
-mpdconf:
-       mkdir -p ~/arc/aud
-       mkdir -p ~/var/lib/mpd/playlists
-       mkdir -p ~/var/log/mpd
-       mkdir -p ~/var/run/mpd
-       cp home/.mpdconf $(HOME)/
+dirs:
+       mkdir -p $(shell ./list dirs)
 
 compiled:
        mkdir -p bin
@@ -61,11 +59,30 @@ compiled:
 font_cache:
        fc-cache -fv
 
+#
+# Void Linux
+#
+
+pkgs_void:
+       sudo xbps-install $(shell ./list pkgs-void.list)
+
+# Mark $pkg as manually-installed:
+#
+#     sudo xbps-pkgdb -m manual $pkg
+#
+# List manually-installed packages:
+#
+#     xbps-query -m
+#
+pkgs_void_update:
+       xbps-query -m | awk -F - '{sub("-" $$NF "$$", ""); print}' | sort -fu | grep -vf <(./list -v sep='\n' -v end='\n' pkgs-void-src.list) > pkgs-void.list
+       (echo '#'; ./patch-comments pkgs-void.list.comments pkgs-void.list) | sponge pkgs-void.list
+
 #
 # Golang
 #
 pkgs_golang: list pkgs-golang.list
-       go get -u $(shell ./list pkgs-golang.list)
+       go install $(shell ./list pkgs-golang.list)
 
 #
 # Ubuntu
@@ -80,10 +97,10 @@ pkgs_ubuntu_debfiles: list pkgs-ubuntu-debfiles.list
 # PIP
 #
 pkgs_pip_install:
-       pip3 install --user $(shell ./list pkgs-pip.list)
+       pip install --user $(shell ./list pkgs-pip.list)
 
 pkgs_pip_upgrade:
-       pip3 install --user --upgrade $(shell ./list pkgs-pip.list)
+       pip install --user --upgrade $(shell ./list pkgs-pip.list)
 
 #
 # Rust (cargo)
@@ -146,13 +163,28 @@ $(foreach d,$(DEPS),$(eval $(call GEN_DEP_RULE,$(d))))
 diff:
        find home -type f -print0 \
        | $(SED) -z 's/^home\///g' \
-       | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=always ~/% home/%'
+       | sort -zr \
+       | xargs -0 -I% sh -c 'echo %; $(DIFF) --color=auto ~/% home/%'
+
+.PHONY: diff_bins_untracked
+diff_bins_untracked:
+       ls -1 ~/bin | sort | grep -vf <(ls -1 home/bin | sort)
 
 pull:
        find home -type f -print0 \
        | $(SED) -z 's/^home\///g' \
        | xargs -0 -I% sh -c '$(DIFF) -q ~/% home/% > /dev/null || cp ~/% home/%'
 
+push:
+       # TODO Backup files before replacing.
+       #      But - recursive copy is not a good strategy for this.
+       #      Need to do a file by file pass, like the diff recipe.
+       #
+       # Limit depth because directories are copied recursively:
+       find home -maxdepth 1 -print0 \
+       | $(GREP) -zv '^home$$' \
+       | xargs -0 -I% cp -Rp % ~
+
 clean:
        rm -rf ./debfiles
        cd src && make clean
This page took 0.03516 seconds and 4 git commands to generate.