File: debian.sh

package info (click to toggle)
crazy-complete 0.3.6-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 2,404 kB
  • sloc: python: 7,949; sh: 4,636; makefile: 74
file content (41 lines) | stat: -rwxr-xr-x 643 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

ARCH=amd64
RELEASE=bookworm
CACHE_DIR=/tmp/debian.cache

set -e

cd "$(dirname "$0")"

if [ "$EUID" -ne 0 ]; then
  echo "Please run as root"
  exit 1
fi

if [[ "$#" != 1 ]]; then
  echo "Usage: $0 <CHROOT_DIR>"
  exit 1
fi

CHROOT_DIR="$1"

if [[ "${CHROOT_DIR:0:1}" != '/' ]]; then
  echo "$0: <CHROOT_DIR> has to be an absolute path!"
  exit 1
fi

# Install debootstrap
pacman -S --needed debootstrap

# Make chroot dir
mkdir -p "$CHROOT_DIR"

# Make cache dir
mkdir -p "$CACHE_DIR"

# Install debian into chroot
debootstrap \
  --arch=$ARCH \
  --cache-dir="$CACHE_DIR" \
  $RELEASE "$CHROOT_DIR" http://deb.debian.org/debian