2021-03-31 12:15:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Clone or update alacritty to $HOME/dev/alacritty, build and install to $HOME/bin
|
|
|
|
# Note: run from ZSH in a different terminal emulator.
|
|
|
|
set -e
|
|
|
|
|
2021-04-23 01:49:39 +00:00
|
|
|
if pgrep alacritty > /dev/null; then
|
|
|
|
echo "Error: alacritty is running. Kill it and retry."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-03-31 12:15:08 +00:00
|
|
|
if ! [ -x "$(command -v cargo)" ]; then
|
|
|
|
echo "Install Rust toolchain first"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-10-07 08:43:32 +00:00
|
|
|
mkdir -p "$HOME/dev" "$HOME/bin"
|
2021-03-31 12:15:08 +00:00
|
|
|
destdir=$HOME/dev/alacritty
|
2023-10-07 08:43:32 +00:00
|
|
|
if [ -d "$destdir" ]; then
|
2021-03-31 12:15:08 +00:00
|
|
|
echo "Updating alacritty..."
|
2023-10-07 08:43:32 +00:00
|
|
|
cd "$destdir"
|
2021-03-31 12:15:08 +00:00
|
|
|
git pull --rebase
|
|
|
|
else
|
|
|
|
echo "Cloning alacritty..."
|
2023-10-07 08:43:32 +00:00
|
|
|
cd "$HOME/dev"
|
2021-03-31 12:15:08 +00:00
|
|
|
git clone -q https://github.com/alacritty/alacritty.git alacritty
|
|
|
|
fi
|
2021-04-06 15:35:06 +00:00
|
|
|
|
2023-10-07 08:43:32 +00:00
|
|
|
cd "$destdir"
|
2021-03-31 12:15:08 +00:00
|
|
|
echo "Building alacritty..."
|
2023-10-07 08:43:32 +00:00
|
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
2021-04-06 15:35:06 +00:00
|
|
|
make app
|
2023-10-07 08:43:32 +00:00
|
|
|
sudo cp -av "$destdir/target/release/osx/Alacritty.app" /Applications/
|
2021-04-06 15:35:06 +00:00
|
|
|
else
|
|
|
|
cargo build --release
|
|
|
|
echo "Installing alacritty..."
|
2023-10-07 08:43:32 +00:00
|
|
|
cp "$destdir/target/release/alacritty" "$HOME/bin/alacritty"
|
2021-04-06 15:35:06 +00:00
|
|
|
fi
|
2021-03-31 12:15:08 +00:00
|
|
|
|
|
|
|
if [ -z "$ZDOTDIR" ]; then
|
|
|
|
echo "WARNING: ZDOTDIR blank so not installing ZSH completions"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing ZSH completions..."
|
|
|
|
funcdir=$ZDOTDIR/functions
|
2023-10-07 08:43:32 +00:00
|
|
|
mkdir -p "$funcdir"
|
|
|
|
cp "$destdir/extra/completions/_alacritty" "$funcdir/_alacritty"
|
2021-06-22 02:20:16 +00:00
|
|
|
|
2023-10-07 08:43:32 +00:00
|
|
|
if [ "$(uname -s)" = "Linux" ]; then
|
2021-06-22 02:20:16 +00:00
|
|
|
# TODO: fix for Manjaro/xfce4:
|
2023-10-07 08:43:32 +00:00
|
|
|
sudo cp "$destdir/extra/logo/alacritty-term.svg" /usr/share/pixmaps/Alacritty.svg
|
|
|
|
sudo desktop-file-install "$destdir/extra/linux/Alacritty.desktop"
|
2021-06-22 02:20:16 +00:00
|
|
|
sudo update-desktop-database
|
|
|
|
fi
|
|
|
|
|
2021-03-31 12:15:08 +00:00
|
|
|
echo "Done"
|