change install system
This commit is contained in:
parent
1627302081
commit
f02910e9aa
9
install-scripts.sh
Executable file
9
install-scripts.sh
Executable file
|
@ -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
|
16
install.sh
16
install.sh
|
@ -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
|
|
16
paf.sh
Executable file
16
paf.sh
Executable file
|
@ -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…
Reference in a new issue