summaryrefslogtreecommitdiff
path: root/install.awk
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2026-06-19 11:12:47 -0700
committerThomas Ulmer <thomasmulmer02@gmail.com>2026-06-19 11:12:47 -0700
commit98120e50c940354ac70c21a1f0ad89b8ef3568ae (patch)
treeecb379883cc5039b62bb81a892eb243f46881fdf /install.awk
parent2bc6652ba8e4802f0601d90d593e9a377e9581b7 (diff)
simplify/portify the setup scripts
Diffstat (limited to 'install.awk')
-rw-r--r--install.awk64
1 files changed, 0 insertions, 64 deletions
diff --git a/install.awk b/install.awk
deleted file mode 100644
index 78c9f94..0000000
--- a/install.awk
+++ /dev/null
@@ -1,64 +0,0 @@
-function path_join(a, b, x, y) {
- x = a
- y = b
-
- sub(/\/+$/, "", x) # remove trailing / from a
- sub(/^\/+/, "", y) # remove leading / from b
-
- if (x == "")
- return y
- if (y == "")
- return x
-
- return x "/" y
-}
-
-BEGIN { FS = "," } ;
-ARGIND == 1 {
- # requested dirs
- dir=path_join(ENVIRON["HOME"], $1)
- cmd="mkdir -p " dir
- print cmd
- system(cmd)
-
- next
-}
-
-ARGIND == 2 {
- # block for locations
- src=path_join(ENVIRON["PWD"], $1)
- dst=path_join(ENVIRON["HOME"], $2)
- testcmd="test -e " dst
- linkcmd="ln -sf " src " " dst
- diffcmd="diff -ursN " dst " " src
-
- if (system(testcmd) == 0) {
- system("ls -lda " dst)
- printf "Exists, overwrite? y/N/d" # no newline
- getline resp < "/dev/tty"
- while (1) {
- if (resp == "d" || resp == "D") {
- # dst is exists src is new, order is right
- print "Showing diff to apply (empty is none)"
- system(diffcmd)
- printf "Exists, overwrite? y/N/d" # no newline
- getline resp < "/dev/tty"
- continue
- } else if (resp == "y" || resp == "Y") {
- print linkcmd
- system(linkcmd)
- break
- } else if (resp == "n" || resp == "N" || resp == "") {
- print "Skipped"
- break
- }
- print "Exists, overwrite? y/N/d"
- getline resp < "/dev/tty"
- }
- } else {
- print linkcmd
- system(echo linkcmd)
- }
-}
-
-