#!/usr/bin/env bash set -euo pipefail # Root directory = the script's location SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" Version="$1" PackagePath="v2rayn-unofficial-repo" mkdir -p "${PackagePath}/DEBIAN" mkdir -p "${PackagePath}"/etc/apt/{keyrings,sources.list.d} curl -fsSLo "${PackagePath}/etc/apt/keyrings/v2rayn-unofficial.asc" "https://git.vlyaii.ru/api/packages/voronin9032/debian/repository.key" # basic cat >"${PackagePath}/DEBIAN/control" <<-EOF Package: v2rayn-unofficial-repo Version: $Version Maintainer: Vlyaii Homepage: https://git.vlyaii.ru/voronin9032/v2rayN Architecture: all Depends: ca-certificates Description: v2rayn-unofficial repository configuration EOF cat >"${PackagePath}/etc/apt/sources.list.d/v2rayn-unofficial.sources" <<-EOF Types: deb URIs: https://git.vlyaii.ru/api/packages/voronin9032/debian Suites: debian Components: stable Architectures: amd64 all Signed-By: /etc/apt/keyrings/v2rayn-unofficial.asc EOF # Patch # set owner to root:root sudo chown -R root:root "${PackagePath}" # set all directories to 755 (readable & traversable by all users) sudo find "${PackagePath}/etc" -type d -exec chmod 755 {} + # set all regular files to 644 (readable by all users) sudo find "${PackagePath}/etc" -type f -exec chmod 644 {} + # ensure main binaries are 755 (executable by all users) # build deb package sudo dpkg-deb -Zzstd -z19 --build "$PackagePath" sudo mv "${PackagePath}.deb" "v2rayn-unofficial-repo_${Version}_all.deb"