41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
echo "[+] trying to fetch main branch"
|
|
git fetch origin main
|
|
|
|
if [ $(git rev-list --count HEAD..origin/main) -gt 0 ]; then
|
|
echo "[+] pulling latest version of the main branch"
|
|
git pull origin main
|
|
else
|
|
echo "[+] nothing to update from the remote repository"
|
|
fi
|
|
|
|
REQUIRED_VERSION="1.91.0"
|
|
CURRENT_VERSION=$(cargo --version | awk '{print $2}')
|
|
|
|
HIGHEST=$(printf '%s\n%s' "$CURRENT_VERSION" "$REQUIRED_VERSION" | sort -rV | head -n1)
|
|
if [ "$HIGHEST" == "$REQUIRED_VERSION" ]; then
|
|
echo "[!] Need to update rustc compiler because of the vergen-gix dependency"
|
|
echo "[!] For more info: https://github.com/rustyhorde/vergen#msrv"
|
|
rustup update
|
|
echo "[+] Setting latest rustc compiler version as a default one"
|
|
rustup default stable
|
|
echo "[+] Cleaning previous targets"
|
|
cargo clean
|
|
fi
|
|
|
|
echo "[+] build for the new version starts in 3 seconds..."
|
|
sleep 3
|
|
cargo build --release
|
|
|
|
echo "[+] need to store the 'ghost-eye' binary to '/usr/local/bin/'"
|
|
sudo cp target/release/ghost-eye /usr/local/bin
|
|
|
|
if ! grep -Fxq "alias ge=\"ghost-eye\"" ~/.bashrc; then
|
|
echo "alias ge=\"ghost-eye\"" >> ~/.bashrc
|
|
source ~/.bashrc
|
|
echo "[+] alias 'ge' added, type 'ge' to run ghost-eye"
|
|
else
|
|
echo "[+] alias 'ge' already found"
|
|
fi
|