-
Notifications
You must be signed in to change notification settings - Fork 27
/
debian_script.bsh
executable file
·50 lines (40 loc) · 1.04 KB
/
debian_script.bsh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -eu
ARCH=amd64
case "$(uname -m)" in
arm64|aarch64)
ARCH=arm64;;
esac
REPO_DIR=${REPO_DIR:-/repo}
GIT_LFS_BUILD_DIR=${GIT_LFS_BUILD_DIR:-/tmp/docker_run/src/git-lfs}
SRC_DIR=${SRC_DIR:-/src}
REPO_CODENAME=${REPO_CODENAME:-$(source /etc/os-release; echo $VERSION | sed -r 's|.*\((.*)\)|\1|')}
process_architecture () {
local arch="$1"
cp -r -T "${SRC_DIR}" "${GIT_LFS_BUILD_DIR}/$arch"
cd "${GIT_LFS_BUILD_DIR}/$arch"
git clean -xdf .
git checkout-index --force --all
make vendor
dpkg-buildpackage -d -us -uc -b -a"$arch"
}
move_architecture () {
local arch="$1"
cp `find "${GIT_LFS_BUILD_DIR}/$arch/.." -maxdepth 1 -type f` "${REPO_DIR}/"
}
mkdir -p ${GIT_LFS_BUILD_DIR}
case "$ARCH" in
amd64)
process_architecture i386
process_architecture amd64
move_architecture i386
move_architecture amd64
;;
arm64)
process_architecture arm64
move_architecture arm64
;;
esac
if [ "${FINAL_UID-}:${FINAL_GID-}" != ":" ]; then
chown ${FINAL_UID-}:${FINAL_GID-} -R "${REPO_DIR}"
fi