diff options
author | Gordon GECOS <u@adam> | 2023-11-22 15:07:29 -0500 |
---|---|---|
committer | Gordon GECOS <u@adam> | 2023-11-22 15:07:29 -0500 |
commit | 81fdd7a90cc0dfdc2bc2744d41a346c0d255a6af (patch) | |
tree | 090eb8f61bdf253a0d07117b0f0751148036aacd | |
parent | c562f252be28507df1d2f45e1912734e1ef0a8e4 (diff) |
cruft
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | user.mk | 32 |
2 files changed, 0 insertions, 34 deletions
@@ -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 |
100 | endif | 100 | endif |
101 | 101 | ||
102 | include 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 @@ | |||
1 | user_username = u | ||
2 | user_home_path := $(shell getent passwd "$(user_username)" | (IFS=: read _ _ _ _ _ homedir _; echo $$homedir)) | ||
3 | user_home_btrfs = $(user_home_path).btrfs | ||
4 | user_home_bytes = 10GiB | ||
5 | user_home_force_replace = | ||
6 | |||
7 | user_exists = getent passwd "$(user_username)" >/dev/null | ||
8 | |||
9 | is_btrfs = df ~$(user_username) -t btrfs >/dev/null | ||
10 | |||
11 | user-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 | |||
16 | remove_user_home_btrfs = sudo mv -b "$(user_home_btrfs)" "$(user_home_btrfs)"~"$$(date -Is)" | ||
17 | |||
18 | user-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 | |||
31 | mount-user-btrfs-home: | ||
32 | mountpoint -q "$(user_home_path)" || sudo mount -t btrfs "$(user_home_btrfs)" "$(user_home_path)" | ||