aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xinstall.sh126
-rw-r--r--nvim/.config/nvim/lua/tobyvin/lazy.lua1
-rwxr-xr-xnvim/install.sh9
3 files changed, 15 insertions, 121 deletions
diff --git a/install.sh b/install.sh
index 2d14b2e..338b976 100755
--- a/install.sh
+++ b/install.sh
@@ -1,12 +1,11 @@
#!/bin/sh
-# shellcheck source-path=SCRIPTDIR
SCRIPT="$(basename "$0")"
SCRIPT_DIR="$(dirname -- "$(readlink -f -- "$0")")"
INSTALL_DIR="$(dirname "$SCRIPT_DIR")"
-long='install,clean,clean-only,no,simulate,verbose,help'
-short='icCnvh'
+long='clean-only,help'
+short='ch'
if ! opts="$(getopt -o $short -l $long -n "$SCRIPT" -- "$@")"; then
exit 1
@@ -20,88 +19,28 @@ help() {
Toby Vincent <tobyv@tobyvin.dev>
$SCRIPT
- Installer script. Basically just a wrapper around GNU stow with a few niceties. Running with
- no arguments and no '--clean-only' flag with stow all packages, with the exception of
- platform specific packages, e.g. 'wsl'.
+ Installer script that is a simple wrapper around GNU stow that removes broken symlinks
+ found in $INSTALL_DIR, stows all packages, and runs all ./*/install.sh scripts.
USAGE:
- $SCRIPT [OPTION ...] [PACKAGE ...]
+ $SCRIPT [OPTION ...]
OPTIONS:
- -i, --install After stowing, run any '<PKG>/install.sh' in packages.
- -c, --clean Remove broken symlinks found in $INSTALL_DIR for proceeding.
- -C, --clean-only Like --clean, but will exit after cleaning.
- -n, --no, --simulate Do not actually make any filesystem changes.
- -v, --verbose Increase verbosity.
-h, --help Show this help.
EOF
}
-say() {
- printf "%s: %s\n" "$SCRIPT" "$@"
-}
-
-say_verbose() {
- # shellcheck disable=2086
- if [ $verbose -gt 0 ]; then
- say "$@"
- fi
-}
-
-say_err() {
- say "$@" >&2
-}
-
-err() {
- say_err "ERROR: $*"
- exit 1
-}
-
-err_help() {
- help
- err "$*"
-}
-
-need() {
- for need_cmd in "$@"; do
- if ! command -v "$need_cmd" >/dev/null 2>&1; then
- err "need $need_cmd (command not found)"
- fi
- done
-}
-
-clean=false
clean_only=false
-verbose=0
-simulate=""
-install=false
while true; do
case "$1" in
-h | --help)
help
exit 0
;;
- -v | --verbose)
- verbose=$((verbose + 1))
- shift
- ;;
- -i | --install)
- install=true
- shift
- ;;
- -c | --clean)
- clean=true
- shift
- ;;
- -C | --clean-only)
- clean=true
+ -c | --clean-only)
clean_only=true
shift
;;
- -n | --no | --simulate)
- simulate='-n'
- shift
- ;;
--)
shift
break
@@ -112,53 +51,14 @@ while true; do
esac
done
-verbose_args="$(head -c $verbose </dev/zero | tr '\0' 'v' | sed 's/^/-/')"
-
-if $clean; then
- need fd
- fd_verbose=$(printf %s\\n "$verbose_args" | sed 's/-vv\?//' | sed 's/^v/-v/')
-
- # shellcheck disable=2086,2016
- fd . "$HOME" --hidden --type l --exclude \.dotfiles/** --exec sh $simulate $fd_verbose -c \
- '[ -e "{}" ] || (l=$(readlink -m "{}"); [ "${l#'"$SCRIPT_DIR"'}" == "$l" ] || rm -v "{}")'
+find . -type l -exec sh -c 'for x; do [ -e "$x" ] || rm -v "$x"; done' _ {} +
- if $clean_only; then
- exit 0
- fi
-fi
-
-if [ $# -eq 0 ]; then
- for pkg_path in "$SCRIPT_DIR"/*; do
- if [ -d "$pkg_path" ]; then
- pkg="$(basename "$pkg_path")"
-
- case "$pkg" in
- wsl)
- if [ -n "${WSL_DISTRO_NAME+1}" ]; then
- set -- "$@" "$pkg"
- fi
- ;;
- *)
- set -- "$@" "$pkg"
- ;;
- esac
- fi
- done
+if $clean_only; then
+ exit 0
fi
-say_verbose "Installing: $*"
+stow "$@" -- */
-# shellcheck disable=2068,2086
-stow $verbose_args $simulate "$@"
-
-if $install; then
- for pkg; do
- if [ -e "$SCRIPT_DIR/$pkg/install.sh" ]; then
- if [ -z "$simulate" ]; then
- "$SCRIPT_DIR/$pkg/install.sh"
- else
- echo "simulated: $SCRIPT_DIR/$pkg/install.sh"
- fi
- fi
- done
-fi
+for f in "$SCRIPT_DIR"/*/install.sh; do
+ $f
+done
diff --git a/nvim/.config/nvim/lua/tobyvin/lazy.lua b/nvim/.config/nvim/lua/tobyvin/lazy.lua
index 3fee88c..bb44179 100644
--- a/nvim/.config/nvim/lua/tobyvin/lazy.lua
+++ b/nvim/.config/nvim/lua/tobyvin/lazy.lua
@@ -15,7 +15,6 @@ require("lazy").setup("plugins", {
defaults = {
lazy = true,
},
- concurrency = 5,
dev = {
path = "~/src",
},
diff --git a/nvim/install.sh b/nvim/install.sh
index 106125f..f4efb7c 100755
--- a/nvim/install.sh
+++ b/nvim/install.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
SCRIPT="$0"
@@ -6,11 +6,6 @@ say() {
printf "%s: %s\n" "$SCRIPT" "$@"
}
-# Update plugins
-say "Updating plugins to lock-file"
+say "Installing plugins..."
nvim --headless -c 'Lazy! restore' -c qa
nvim --headless -c 'Lazy! clean' -c qa
-
-# Update LSP servers
-say "Updating LSP servers"
-nvim --headless -c 'autocmd User MasonUpdateAllComplete quitall' -c 'MasonUpdateAll'