-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·44 lines (33 loc) · 1.07 KB
/
run.sh
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
#!/bin/bash
ARCHIVE_LIST=(wheezy)
ARCH=$1
DISTRO=$2
BUILD_DIR=/root/${ARCH}_${DISTRO}
DEB_URL="http://deb.debian.org/debian/"
DEB_SECURITY_URL="http://security.debian.org/debian-security/"
ARCHIVE_URL="http://archive.debian.org/debian/"
ARCHIVE_SECURITY_URL="http://archive.debian.org/debian-security"
export DEBIAN_FRONTEND="noninteractive"
export DEBCONF_NONINTERACTIVE_SEEN="true"
apt-get update
apt-get upgrade -y
apt-get install -y \
binfmt-support \
qemu-user-static \
debootstrap
service binfmt-support restart
mkdir -p "${BUILD_DIR}"
URL="${DEB_URL}"
SECURITY_URL="${DEB_SECURITY_URL}"
if [[ ${ARCHIVE_LIST[*]} =~ ${DISTRO} ]]; then
URL="${ARCHIVE_URL}"
SECURITY_URL="${ARCHIVE_SECURITY_URL}"
fi
LC_ALL=C LANGUAGE=C LANG=C \
qemu-debootstrap \
--variant=minbase \
--arch "${ARCH}" \
"${DISTRO}" "${BUILD_DIR}" "${URL}"
echo "deb ${URL} ${DISTRO} main contrib non-free" > "${BUILD_DIR}/etc/apt/sources.list"
echo "deb ${SECURITY_URL} ${DISTRO}/updates main contrib non-free" >> "${BUILD_DIR}/etc/apt/sources.list"
tar -C "${BUILD_DIR}" -f /root/build/image.tar -c .