diff options
Diffstat (limited to 'install.awk')
| -rw-r--r-- | install.awk | 64 |
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) - } -} - - |
