summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon GECOS <u@adam>2023-11-22 15:07:29 -0500
committerGordon GECOS <u@adam>2023-11-22 15:07:29 -0500
commit81fdd7a90cc0dfdc2bc2744d41a346c0d255a6af (patch)
tree090eb8f61bdf253a0d07117b0f0751148036aacd
parentc562f252be28507df1d2f45e1912734e1ef0a8e4 (diff)
cruft
-rw-r--r--Makefile2
-rw-r--r--user.mk32
2 files changed, 0 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 9f7a5f5..ce0e826 100644
--- a/Makefile
+++ b/Makefile
@@ -99,8 +99,6 @@ else
99 install -p -m0644 -DT conf/torrc ${instdir}/etc/tor/torrc 99 install -p -m0644 -DT conf/torrc ${instdir}/etc/tor/torrc
100endif 100endif
101 101
102include user.mk
103
104.PHONY: submodules build-submodules $(SUBMODULES) 102.PHONY: submodules build-submodules $(SUBMODULES)
105$(SUBMODULES): stack 103$(SUBMODULES): stack
106 @a=$$(cd $@ && (exec 3>&1; exec >&2; if test -z "$$(git ls-files)"; then git reset; fi; git status -uno -s >&3)) && (if test -z "$$a"; then set -x; git submodule update --init --recursive $@/; fi) 104 @a=$$(cd $@ && (exec 3>&1; exec >&2; if test -z "$$(git ls-files)"; then git reset; fi; git status -uno -s >&3)) && (if test -z "$$a"; then set -x; git submodule update --init --recursive $@/; fi)
diff --git a/user.mk b/user.mk
deleted file mode 100644
index 4292fe8..0000000
--- a/user.mk
+++ /dev/null
@@ -1,32 +0,0 @@
1user_username = u
2user_home_path := $(shell getent passwd "$(user_username)" | (IFS=: read _ _ _ _ _ homedir _; echo $$homedir))
3user_home_btrfs = $(user_home_path).btrfs
4user_home_bytes = 10GiB
5user_home_force_replace =
6
7user_exists = getent passwd "$(user_username)" >/dev/null
8
9is_btrfs = df ~$(user_username) -t btrfs >/dev/null
10
11user-account:
12 [ "$(user_username)" ]
13 $(user_exists) || sudo useradd "$(user_username)" -G sudo -m -p '' -s /bin/bash
14 $(is_btrfs) || $(MAKE) mount-user-btrfs-home >/dev/null 2>&1 || $(MAKE) user-btrfs-home
15
16remove_user_home_btrfs = sudo mv -b "$(user_home_btrfs)" "$(user_home_btrfs)"~"$$(date -Is)"
17
18user-btrfs-home:
19 [ "$(user_home_path)" ]
20 [ ! -e "$(user_home_btrfs)" ] || $(if $(user_home_force_replace),$(remove_user_home_btrfs),false)
21 [ ! -e "$(user_home_btrfs)" ]
22 ! mountpoint -q "$(user_home_path)" || sudo umount "$(user_home_path)"
23 [ ! -e "$(user_home_path)" ] || sudo rmdir "$(user_home_path)" || sudo mv -b "$(user_home_path)" "$(user_home_path)"~"$$(date -Is)"
24 [ -e "$(user_home_btrfs)" ] || sudo fallocate -l "$(user_home_bytes)" "$(user_home_btrfs)"
25 sudo mkdir "$(user_home_path)"
26 sudo mkfs.btrfs "$(user_home_btrfs)"
27 sudo mount -t btrfs "$(user_home_btrfs)" "$(user_home_path)"
28 sudo rsync -a /etc/skel/ "$(user_home_path)"/
29 sudo chown -R "$(user_username):" "$(user_home_path)"
30
31mount-user-btrfs-home:
32 mountpoint -q "$(user_home_path)" || sudo mount -t btrfs "$(user_home_btrfs)" "$(user_home_path)"