forked from DGNum/infrastructure
Tom Hubrecht
88d9b8c3e3
Signed-off-by: Tom Hubrecht <tom.hubrecht@dgnum.eu> Acked-by: Ryan Lahfa <ryan.lahfa@dgnum.eu> Acked-by: Maurice Debray <maurice.debray@dgnum.eu> Acked-by: Lubin Bailly <lubin.bailly@dgnum.eu> Acked-by: Jean-Marc Gailis <jean-marc.gailis@dgnum.eu> as the legal authority, at the time of writing, in DGNum. Acked-by: Elias Coppens <elias.coppens@dgnum.eu> as a member, at the time of writing, of the DGNum executive counsel.
41 lines
810 B
Bash
Executable file
41 lines
810 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# SPDX-FileCopyrightText: 2024 Ryan Lahfa <ryan.lahfa@dgnum.eu>
|
|
#
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
shopt -s lastpipe
|
|
|
|
output_path="$1"
|
|
|
|
if [ "$STORE_ENDPOINT" == "" ]; then
|
|
echo "No endpoint given for the remote cache, uploading cannot take place."
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$STORE_USER" == "" ]; then
|
|
echo "No user given for the remote cache, uploading cannot take place."
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$STORE_PASSWORD" == "" ]; then
|
|
echo "No password given for the remote cache, uploading cannot take place."
|
|
exit 1
|
|
fi
|
|
|
|
cat <<EOF >.netrc
|
|
default
|
|
login $STORE_USER
|
|
password $STORE_PASSWORD
|
|
EOF
|
|
|
|
nix copy \
|
|
--extra-experimental-features nix-command \
|
|
--to "$STORE_ENDPOINT?compression=none" \
|
|
--netrc-file .netrc \
|
|
"$output_path"
|
|
|
|
rm .netrc
|