Skip to content
Myr

create-deb.sh

This file

Path

scripts/create-deb.sh

135 lines · 4.7 KiB · Shell

Last changed by

Merge pull request #1889 from skane-lukas/issue-1888-fix-symlink-bash-completionThayne McCombsbefore adoptiona7a67e4

History of this file

Take it

The walk stopped after 200 commits: lines older than 86d6e2d point at it.

Merge pull request #1657 from sharkdp/dependabot/cargo/clap-4.5.23Tavian Barnesbefore adoption86d6e2d

lines 1–59why, one step back
1#!/bin/bash
2COPYRIGHT_YEARS="2018 - "$(date "+%Y")3MAINTAINER="David Peter <mail@david-peter.de>"4REPO="https://github.com/sharkdp/fd"5DPKG_STAGING="${CICD_INTERMEDIATES_DIR:-.}/debian-package"6DPKG_DIR="${DPKG_STAGING}/dpkg"7mkdir -p "${DPKG_DIR}"89if [[ -z "$TARGET" ]]; then10 TARGET="$(rustc -vV | sed -n 's|host: \(.*\)|\1|p')"11fi1213case "$TARGET" in14 *-musl*)15 DPKG_BASENAME=fd-musl16 DPKG_CONFLICTS="fd, fd-find"17 ;;18 *)19 DPKG_BASENAME=fd20 DPKG_CONFLICTS="fd-musl, fd-find"21 ;;22esac2324if [[ -z "$DPKG_VERSION" ]]; then25 DPKG_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r .packages[0].version)26fi2728unset DPKG_ARCH29case "${TARGET}" in30 aarch64-*-linux-*) DPKG_ARCH=arm64 ;;31 arm-*-linux-*hf) DPKG_ARCH=armhf ;;32 i686-*-linux-*) DPKG_ARCH=i686 ;;33 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;34 *) DPKG_ARCH=notset ;;35esac;3637DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"3839BIN_PATH=${BIN_PATH:-target/${TARGET}/release/fd}4041# Binary42install -Dm755 "${BIN_PATH}" "${DPKG_DIR}/usr/bin/fd"4344# Man page45install -Dm644 'doc/fd.1' "${DPKG_DIR}/usr/share/man/man1/fd.1"46gzip -n --best "${DPKG_DIR}/usr/share/man/man1/fd.1"4748# Autocompletion files49install -Dm644 'autocomplete/fd.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fd"50install -Dm644 'autocomplete/fd.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fd.fish"51install -Dm644 'autocomplete/_fd' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fd"5253# README and LICENSE54install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"55install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"56install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"57install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"58gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"59

Merge pull request #1889 from skane-lukas/issue-1888-fix-symlink-bash-completionThayne McCombsbefore adoptiona7a67e4

line 60why, one step back
60# Create symlink and completions so fdfind can be used as well:

Merge pull request #1657 from sharkdp/dependabot/cargo/clap-4.5.23Tavian Barnesbefore adoption86d6e2d

line 61why, one step back
61ln -s "/usr/bin/fd" "${DPKG_DIR}/usr/bin/fdfind"

Merge pull request #1889 from skane-lukas/issue-1888-fix-symlink-bash-completionThayne McCombsbefore adoptiona7a67e4

lines 62–65why, one step back
62
63install -Dm644 'autocomplete/fdfind.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/fdfind"64install -Dm644 'autocomplete/fdfind.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fdfind.fish"65install -Dm644 'autocomplete/_fdfind' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fdfind"

Merge pull request #1657 from sharkdp/dependabot/cargo/clap-4.5.23Tavian Barnesbefore adoption86d6e2d

lines 66–135why, one step back
66
67cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF68Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/69Upstream-Name: fd70Source: ${REPO}7172Files: *73Copyright: ${MAINTAINER}74Copyright: $COPYRIGHT_YEARS ${MAINTAINER}75License: Apache-2.0 or MIT7677License: Apache-2.078 On Debian systems, the complete text of the Apache-2.0 can be found in the79 file /usr/share/common-licenses/Apache-2.0.8081License: MIT82 Permission is hereby granted, free of charge, to any83 person obtaining a copy of this software and associated84 documentation files (the "Software"), to deal in the85 Software without restriction, including without86 limitation the rights to use, copy, modify, merge,87 publish, distribute, sublicense, and/or sell copies of88 the Software, and to permit persons to whom the Software89 is furnished to do so, subject to the following90 conditions:91 .92 The above copyright notice and this permission notice93 shall be included in all copies or substantial portions94 of the Software.95 .96 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF97 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED98 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A99 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT100 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY101 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION102 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR103 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER104 DEALINGS IN THE SOFTWARE.105EOF106 chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"107108 # control file109 mkdir -p "${DPKG_DIR}/DEBIAN"110 cat > "${DPKG_DIR}/DEBIAN/control" <<EOF111Package: ${DPKG_BASENAME}112Version: ${DPKG_VERSION}113Section: utils114Priority: optional115Maintainer: ${MAINTAINER}116Homepage: ${REPO}117Architecture: ${DPKG_ARCH}118Provides: fd119Conflicts: ${DPKG_CONFLICTS}120Description: simple, fast and user-friendly alternative to find121 fd is a program to find entries in your filesystem.122 It is a simple, fast and user-friendly alternative to find.123 While it does not aim to support all of finds powerful functionality, it provides124 sensible (opinionated) defaults for a majority of use cases.125EOF126127DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"128129if [[ -n $GITHUB_OUTPUT ]]; then130 echo "DPKG_NAME=${DPKG_NAME}" >> "$GITHUB_OUTPUT"131 echo "DPKG_PATH=${DPKG_PATH}" >> "$GITHUB_OUTPUT"132fi133134# build dpkg135fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"