1
0
Fork 0

change install system

master
dece 2 years ago
parent 1627302081
commit f02910e9aa

@ -0,0 +1,9 @@
#!/bin/bash
# Install scripts from this repo using our neighbour paf.sh.
# Requires fdfind and fzf to work.
script_dir="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
paf="$script_dir/paf.sh"
fdfind -t x | fzf --multi --layout=reverse --header="Pick scripts to install" \
| while read -r script; do "$paf" "$script"; done

@ -1,16 +0,0 @@
#!/bin/bash
ensure_has() {
if ! command -v "$1" > /dev/null; then
echo "Can't find $1."
exit 1
fi
}
ensure_has fdfind
ensure_has fzf
ensure_has install-script
fdfind -t x \
| fzf -m --layout=reverse \
| while read -r script; do install-script "$script"; done

@ -0,0 +1,16 @@
#!/bin/bash -e
# A script to install other scripts! Create a symbolic link to the path passed
# as first argument in ~/.local/bin and strip the extension. If a second
# argument is passed, this name is used (unstripped) instead. If a file already
# exists at the link path, the script fails (last command is ln itself). This is
# intentional.
script_dir="$HOME/.local/bin"
script="$(realpath "$1")"
if [ -n "$2" ]; then
script_name="$2"
else
script_name="$(basename "$script")"
script_name="${script_name%.*}" # remove extension
fi
ln -s "$script" "$script_dir/$script_name"
Loading…
Cancel
Save