Skip to content

Commit 59be938

Browse files
support for impish and other suites
1 parent 7a7425a commit 59be938

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

plugins/envsetup

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env bash
22

3+
export ROOT_DIR
4+
5+
ROOT_DIR="$(git rev-parse --show-toplevel)"
6+
37
# sudo check
48
if [ "$(id -u)" != "0" ]; then
59
if ! command -v sudo >/dev/null 2>&1; then
@@ -174,7 +178,24 @@ do_debootstrap() {
174178
export chroot_dir
175179
chroot_dir=$target_dir
176180

177-
suite="hirsute" #* need to add more logics for more suits
181+
if [ -n "$SUITE" ]; then
182+
supported_suites="$(ls "${ROOT_DIR}"/core/debootstrap/scripts)"
183+
suite_found=false
184+
for sts in $supported_suites; do
185+
if [ "$sts" == "$SUITE" ]; then
186+
suite="$SUITE"
187+
suite_found=true
188+
break
189+
fi
190+
done
191+
192+
if [ "$suite_found" == "false" ]; then
193+
die "Unsupported suite: $SUITE"
194+
fi
195+
else
196+
suite="hirsute"
197+
fi
198+
178199
shout "debootstraping $suite to $target_dir"
179200

180201
if [[ -n $OVERRIDER_MIRROR ]]; then
@@ -192,7 +213,7 @@ do_debootstrap() {
192213
--arch="$arch" \
193214
--no-check-gpg \
194215
--include="${include_final}" \
195-
$suite \
216+
"$suite" \
196217
"$target_dir" \
197218
$MIRROR
198219
) || die "Couldn't debootstrap..."

0 commit comments

Comments
 (0)