88 lines
2.9 KiB
Bash
Executable File
88 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -xeu
|
|
|
|
DEBIAN_FRONTEND=noninteractive
|
|
TARGET="$PWD"
|
|
|
|
export DEBIAN_FRONTEND
|
|
|
|
# dependencies {{{
|
|
dependencies() {
|
|
# Update system and install basic tools
|
|
apt-get update -yq && apt-get install -yq aptitude curl git patch wget
|
|
# Install dependencies for Eza .deb package
|
|
aptitude --quiet --assume-yes install gzip lintian pandoc
|
|
|
|
# Install just dependency to build manpages
|
|
aptitude --quiet --assume-yes install gpg lsb-release
|
|
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
|
|
echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | tee /etc/apt/sources.list.d/prebuilt-mpr.list
|
|
apt-get update -yq
|
|
aptitude --quiet --assume-yes install just
|
|
}
|
|
# }}}
|
|
|
|
# get_eza_sources {{{
|
|
get_eza_sources() {
|
|
# Clone Eza repo
|
|
cd "$(mktemp -d)"
|
|
git clone https://github.com/eza-community/eza
|
|
cd eza
|
|
}
|
|
# }}}
|
|
|
|
# Patch sample (from a PR…) {{{
|
|
patch_justfile() {
|
|
# If issue 458 is still open
|
|
gh_justfile_issue_opened=$(curl --location --no-progress-meter -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
|
|
"https://api.github.com/search/issues?q=repo:eza-community/eza+is:open+is:issue+author:gardouille" | \grep --extended-regexp --count '"url":.*issues/458",' \
|
|
|| echo "0")
|
|
|
|
if [ "${gh_justfile_issue_opened}" = "1" ]; then
|
|
echo "Patch Justfile to fix issue https://github.com/eza-community/eza/issues/458"
|
|
## Justfile
|
|
wget --quiet "https://git.101010.fr/gardouille/eza-docker-build/raw/branch/main/patch/Justfile.458.patch" --output-document=/tmp/Justfile.458.patch --
|
|
patch Justfile < /tmp/Justfile.458.patch --output=/tmp/Justfile.patched
|
|
|
|
## devtools script to be able to use Justfile after `git detach`
|
|
wget --quiet "https://git.101010.fr/gardouille/eza-docker-build/raw/branch/main/patch/devtools.deb-package.sh.458.patch" --output-document=/tmp/devtools.deb-package.sh.458.patch --
|
|
patch devtools/deb-package.sh < /tmp/devtools.deb-package.sh.458.patch
|
|
|
|
## Commit changes to avoid warning from `git detach`
|
|
git config --global user.email "ci@ci.ci"
|
|
git config --global user.name "CI me"
|
|
git commit -a -m "Fix #458 Patch Justfile and devtools script"
|
|
elif [ ! "${gh_justfile_issue_opened}" = "1" ]; then
|
|
echo "Justfile 458 patch section can be removed."
|
|
else
|
|
echo "Case that is not supposed to happen !"
|
|
fi
|
|
}
|
|
# }}}
|
|
|
|
# build_eza_deb_package {{{
|
|
build_eza_deb_package() {
|
|
# Build
|
|
./devtools/deb-package.sh
|
|
}
|
|
# }}}
|
|
|
|
# copy builded package {{{
|
|
copy() {
|
|
TARGET_UID="$(stat --printf %u "$TARGET")"
|
|
TARGET_GID="$(stat --printf %g "$TARGET")"
|
|
install -o "$TARGET_UID" -g "$TARGET_GID" -t "$TARGET/target" eza_*.deb
|
|
}
|
|
# }}}
|
|
|
|
main() {
|
|
dependencies
|
|
get_eza_sources
|
|
#patch_justfile
|
|
build_eza_deb_package
|
|
copy
|
|
}
|
|
|
|
main
|