diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-01 10:40:01 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-01 10:40:01 +0200 |
commit | e7ebdcd1ed66f9833906fbf154607cdbd46fdae2 (patch) | |
tree | d857f3a5a219a038a77113d8d412c824b225e56d /stowdots | |
parent | e0fab4836639db0c9b4719551aa24cc26850b358 (diff) | |
parent | b3e19b6a7c1ab3ea8fefc60352ace64a560b46cd (diff) |
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'stowdots')
-rwxr-xr-x | stowdots | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -1,20 +1,28 @@ #!/bin/sh -trap "echo -ne '\nbye'; exit 1" EXIT +trap "echo -e '\nbye'; exit 1" EXIT + +die () { + echo "$@" 1>&2 +} if ! stow --version > /dev/null 2>&1 then - echo "E: stow not installed or not found" 1>&2 - exit 1 + die "stow not installed or not found." + die "install stow?" + die -n ">" + test "y" = "$(head -n 1)" && + doas pacman -Sy stow || + exit 1 fi if [ -n "${MACH:=$1}" ] then - echo "I: stowing for $MACH" + die "I: stowing for $MACH" else - echo "E: MACH not set" 1>&2 - echo "Enter valid value for 'MACH'" - echo "d(esktop) | s(erver) | l(aptop)" - echo -n ">" + die "E: MACH not set" >&2 + die "Enter valid value for 'MACH'" + die "d(esktop) | s(erver) | l(aptop)" + echo -n ">" >&2 read MACH fi @@ -34,6 +42,6 @@ case "$MACH" in stow -d config/ -t "$HOME/" -R home ;; *) - echo "E: invalid value for 'MACH'" 1>&2 + die "E: invalid value for 'MACH'" break esac |