forked from lowRISC/lowrisc-toolchains
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-prefixed-archive.sh
More file actions
executable file
·34 lines (28 loc) · 967 Bytes
/
create-prefixed-archive.sh
File metadata and controls
executable file
·34 lines (28 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# This will tar-up $toolchain_dest into a tar called $toolchain_full_name.tar.xz
#
# All files in that tarball will be in a directory called $toolchain_full_name,
# not $(basename $toolchain_dest).
set -e
set -x
set -o pipefail
if ! [ "$#" = 2 ]; then
echo "Usage: $0 <toolchain_name> <artifact_dir>"
exit 2
fi;
repo_dir="$(git rev-parse --show-toplevel)"
build_dir="${repo_dir}/build"
dist_dir="${build_dir}/dist"
# These arguments are provided by `./build-*-with-args.sh`
toolchain_full_name="$1"
artifact_dir="${2:-.}"
tar -cJ \
--show-transformed-names --verbose \
--directory="$(dirname "$dist_dir")" \
-f "${artifact_dir}/${toolchain_full_name}.tar.xz" \
--transform="flags=rhS;s@^$(basename "$dist_dir")@${toolchain_full_name}@" \
--owner=0 --group=0 \
"$(basename "$dist_dir")"