1
0
Fork 0
This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
exa-docker-build/entrypoint.sh

55 lines
953 B
Bash
Executable File

#!/bin/bash
set -xeu
DEBIAN_FRONTEND=noninteractive
TARGET="$PWD"
export DEBIAN_FRONTEND
dependencies() {
# Update system and install basic tools
apt-get update -yq && apt-get install -yq aptitude curl git wget
# Install dependencies for Exa
aptitude --quiet --assume-yes install gcc libgit2-dev
}
install_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-host x86_64-unknown-linux-gnu --default-toolchain nightly
. ~/.cargo/env
}
get_exa_sources() {
# Clone Exa repo
cd "$(mktemp -d)"
git clone https://github.com/ogham/exa
cd exa
}
build_exa() {
## Build
cargo build --release
# Test
cargo test
## Move to previous directory
cd -
}
copy() {
TARGET_UID="$(stat --printf %u "$TARGET")"
TARGET_GID="$(stat --printf %g "$TARGET")"
install -o "$TARGET_UID" -g "$TARGET_GID" -t "$TARGET/target" /*.tar.gz
}
main() {
dependencies
install_rust
get_exa_sources
build_exa
copy
}
main