Files
rustbox-package-builder/scripts/init-storage.sh
T
2026-10-30 12:59:58 +01:00

33 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
source /opt/rustbox-package-builder/scripts/lib.sh
APTLY_CONF="$DATA_DIR/state/aptly.conf"
APTLY_ROOT="$DATA_DIR/aptly"
REPOSITORY="$DATA_DIR/repository"
mkdir -p "$APTLY_ROOT" "$REPOSITORY/releases" "$DATA_DIR/packages/deb" "$DATA_DIR/packages/rpm/x86_64" "$DATA_DIR/packages/suse/x86_64"
cat > "$APTLY_CONF" <<JSON
{
"rootDir": "$APTLY_ROOT",
"architectures": ["amd64"],
"dependencyFollowSuggests": false,
"dependencyFollowRecommends": false,
"gpgDisableSign": false,
"gpgDisableVerify": false,
"gpgProvider": "gpg",
"skipLegacyPool": true
}
JSON
export APTLY_CONF
if ! aptly -config="$APTLY_CONF" repo list -raw | grep -Fx rustbox >/dev/null; then
aptly -config="$APTLY_CONF" repo create -distribution="$REPO_DISTRIBUTION" -component="$REPO_COMPONENT" rustbox >/dev/null
fi
for item in apt rpm suse repo-key.gpg LINUX-BUILD-INFO.txt SUSE-BUILD-INFO.txt; do
[[ ! -e "$REPOSITORY/$item" || -L "$REPOSITORY/$item" ]] || fatal "$REPOSITORY/$item exists and is not a symlink"
done
ln -sfn current/apt "$REPOSITORY/apt"
ln -sfn current/rpm "$REPOSITORY/rpm"
ln -sfn current/suse "$REPOSITORY/suse"
ln -sfn current/repo-key.gpg "$REPOSITORY/repo-key.gpg"
ln -sfn current/LINUX-BUILD-INFO.txt "$REPOSITORY/LINUX-BUILD-INFO.txt"
ln -sfn current/SUSE-BUILD-INFO.txt "$REPOSITORY/SUSE-BUILD-INFO.txt"