xref: /aosp_15_r20/external/e2fsprogs/contrib/setup-schroot (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker#!/bin/bash
2*6a54128fSAndroid Build Coastguard Worker#
3*6a54128fSAndroid Build Coastguard Worker# This script sets up a schroot suitable for building e2fsprogs
4*6a54128fSAndroid Build Coastguard Worker# on a Debian portable box
5*6a54128fSAndroid Build Coastguard Worker
6*6a54128fSAndroid Build Coastguard Workerwhile [ "$1" != "" ];
7*6a54128fSAndroid Build Coastguard Workerdo
8*6a54128fSAndroid Build Coastguard Worker    case "$1" in
9*6a54128fSAndroid Build Coastguard Worker	--base)	shift
10*6a54128fSAndroid Build Coastguard Worker		BASE_CHROOT="$1"
11*6a54128fSAndroid Build Coastguard Worker		;;
12*6a54128fSAndroid Build Coastguard Worker	--chroot) shift
13*6a54128fSAndroid Build Coastguard Worker		  CHROOT="$1"
14*6a54128fSAndroid Build Coastguard Worker		  ;;
15*6a54128fSAndroid Build Coastguard Worker	--help|help)
16*6a54128fSAndroid Build Coastguard Worker	    echo "Usage: setup-schroot [--base <base_chroot>] [--chroot <chroot>]"
17*6a54128fSAndroid Build Coastguard Worker	    exit 0
18*6a54128fSAndroid Build Coastguard Worker	    ;;
19*6a54128fSAndroid Build Coastguard Worker	*)
20*6a54128fSAndroid Build Coastguard Worker	    echo "unknown option: $1"
21*6a54128fSAndroid Build Coastguard Worker	    exit 1
22*6a54128fSAndroid Build Coastguard Worker	    ;;
23*6a54128fSAndroid Build Coastguard Worker    esac
24*6a54128fSAndroid Build Coastguard Worker    shift
25*6a54128fSAndroid Build Coastguard Workerdone
26*6a54128fSAndroid Build Coastguard Worker
27*6a54128fSAndroid Build Coastguard Workerif test -z "$BASE_CHROOT" ; then
28*6a54128fSAndroid Build Coastguard Worker    BASE_CHROOT=sid
29*6a54128fSAndroid Build Coastguard Workerfi
30*6a54128fSAndroid Build Coastguard Worker
31*6a54128fSAndroid Build Coastguard Workerif test -z "$CHROOT" ; then
32*6a54128fSAndroid Build Coastguard Worker    CHROOT="$USER-$BASE_CHROOT"
33*6a54128fSAndroid Build Coastguard Workerfi
34*6a54128fSAndroid Build Coastguard Worker
35*6a54128fSAndroid Build Coastguard Workerecho "Setting up $CHROOT using $BASE_CHROOT..."
36*6a54128fSAndroid Build Coastguard Workerschroot -b -n "$CHROOT" -c "$BASE_CHROOT"
37*6a54128fSAndroid Build Coastguard Workerdd-schroot-cmd -c "$CHROOT" apt-get update
38*6a54128fSAndroid Build Coastguard Workerdd-schroot-cmd -c "$CHROOT" -y apt-get upgrade
39*6a54128fSAndroid Build Coastguard Workerdd-schroot-cmd -c "$CHROOT" -y apt-get build-dep e2fsprogs
40*6a54128fSAndroid Build Coastguard Workerdd-schroot-cmd -c "$CHROOT" -y apt-get install git gdb emacs-nox lintian \
41*6a54128fSAndroid Build Coastguard Worker	acl libreadline-dev dh-exec cron
42*6a54128fSAndroid Build Coastguard Workerdd-schroot-cmd -c "$CHROOT" -y apt-get install udev systemd
43*6a54128fSAndroid Build Coastguard Workerecho " "
44*6a54128fSAndroid Build Coastguard Workerecho "Start chroot by running: "
45*6a54128fSAndroid Build Coastguard Workerecho "schroot -r -c $CHROOT"
46*6a54128fSAndroid Build Coastguard Workerecho " "
47