Skip to content

Instantly share code, notes, and snippets.

@rexroof
Last active April 3, 2022 15:03
Show Gist options
  • Save rexroof/76ddee88a14d6a0532762ce5f6290200 to your computer and use it in GitHub Desktop.
Save rexroof/76ddee88a14d6a0532762ce5f6290200 to your computer and use it in GitHub Desktop.
#!/bin/bash
SRCDIR="${HOME}/github/alacritty"
if command -v podman ;then
PODMAN=$(command -v podman)
DOCKERFILE="Containerfile"
fi
if command -v docker ;then
PODMAN=$(command -v docker)
DOCKERFILE="Dockerfile"
fi
if [ -z "$PODMAN" ] ; then
echo podman/docker not found
exit 1
fi
OS_IMAGE="ubuntu"
if [ "$ID" = "arch" ] ; then
OS_IMAGE="archlinux"
fi
if [ ! -d "$SRCDIR" ] ; then
git clone https://github.com/alacritty/alacritty $SRCDIR
fi
cd $SRCDIR
git fetch --all
if [ -n "$1" ] ; then
git checkout $1
else
git pull
fi
rm -f $DOCKERFILE
cat <<'END' > $DOCKERFILE
FROM rust
RUN apt-get update \
&& apt-get install -y cmake pkg-config libfreetype6-dev \
libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev \
python3
WORKDIR /src
CMD cargo clean && cargo build --release
END
$PODMAN pull rust
$PODMAN build -t buildalacritty .
$PODMAN run --rm -it -v $PWD:/src buildalacritty
ls -al target/release/alacritty /usr/bin/alacritty
sudo mv /usr/bin/alacritty /tmp/alacritty
sudo cp target/release/alacritty /usr/bin/alacritty
ls -al target/release/alacritty /usr/bin/alacritty
if [ -d $HOME/.local/share/applications/ ]; then
if [ ! -f $HOME/.local/share/applications/Alacritty.desktop ] ; then
cp extra/linux/Alacritty.desktop $HOME/.local/share/applications/
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment