-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen-livekit.sh
executable file
·113 lines (98 loc) · 3.56 KB
/
gen-livekit.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
# New LiveKit generator.
# This "new" LiveKit will use our dracut loader to load the LiveKit.
source lib.bash
# Config file for the dracut loader.
CONF="# AOSC OS LiveKit config for LiveKit loader.
# The LiveKit itself is the base layer.
# No more configuration required!
SYSROOT_DEP_base=('base')
"
# Set of '--topics TOPIC' options to be passed to aoscbootstrap.
TOPICS_OPT=
WORKDIR=${PWD}/work
ISODIR=${PWD}/iso
AOSCBOOTSTRAP=${AOSCBOOTSTRAP:-/usr/share/aoscbootstrap}
FSTYPE=${FSTYPE:-squashfs}
info "Generating LiveKit distribution ..."
info "Preparing ..."
rm -rf iso work
mkdir -p $WORKDIR/livekit
mkdir -p $ISODIR/$FSTYPE
# We have to pack up the dracut module and copy into the target sysroot
# where it will be untarred and installed into initrd.
tar cf $WORKDIR/livekit/dracut.tar dracut
info "Bootstrapping LiveKit tarball ..."
_cnt=0
if [ "x$TOPICS" != "x" ] ; then
for t in $TOPICS ; do
info "Will opt in Topic '$t'."
TOPIC_OPTS="$TOPIC_OPTS --topics $t"
_cnt=$(($cnt + 1))
done
fi
if [ "$_cnt" -gt 0 ] ; then
info "Opted in $_cnt topic(s)."
fi
info "Invoking aoscbootstrap ..."
if [[ "${ARCH}" = "loongarch64" ]]; then
echo "Generating LiveKit distribution (loongarch64) ..."
aoscbootstrap \
${BRANCH:-stable} $WORKDIR/livekit ${REPO:-https://repo.aosc.io/debs} \
--config /usr/share/aoscbootstrap/config/aosc-mainline.toml \
-x --force \
$TOPIC_OPTS \
--arch ${ARCH:-$(dpkg --print-architecture)} \
-s /usr/share/aoscbootstrap/scripts/reset-repo.sh \
-s /usr/share/aoscbootstrap/scripts/enable-nvidia-drivers.sh \
-s /usr/share/aoscbootstrap/scripts/enable-dkms.sh \
-s "$PWD/scripts/livekit.sh" \
-s "$PWD/scripts/loongarch64-tweaks.sh" \
--include-files "$PWD/recipes/livekit.lst"
elif [[ "${RETRO}" != "1" ]]; then
echo "Generating LiveKit distribution ..."
aoscbootstrap \
${BRANCH:-stable} ${WORKDIR}/livekit ${REPO:-https://repo.aosc.io/debs} \
--config /usr/share/aoscbootstrap/config/aosc-mainline.toml \
-x --force \
--arch ${ARCH:-$(dpkg --print-architecture)} \
$TOPIC_OPTS \
-s /usr/share/aoscbootstrap/scripts/reset-repo.sh \
-s /usr/share/aoscbootstrap/scripts/enable-nvidia-drivers.sh \
-s /usr/share/aoscbootstrap/scripts/enable-dkms.sh \
-s "$PWD/scripts/livekit.sh" \
--include-files "$PWD/recipes/livekit.lst"
else
echo "Generating Retro LiveKit distribution ..."
aoscbootstrap \
${BRANCH:-stable} ${WORKDIR}/livekit ${REPO:-https://repo.aosc.io/debs-retro} \
--config /usr/share/aoscbootstrap/config/aosc-retro.toml \
-x --force \
--arch ${ARCH:-$(dpkg --print-architecture)} \
$TOPIC_OPTS \
-s "$PWD/scripts/retro-livekit.sh" \
--include-files "$PWD/recipes/retro-livekit.lst"
fi
echo "Extracting LiveKit kernel/initramfs ..."
mkdir -pv "$ISODIR"/boot
cp -v "$WORKDIR"/livekit/kernel "$ISODIR"/boot/kernel
cp -v "$WORKDIR"/livekit/live-initramfs.img "$ISODIR"/boot/live-initramfs.img
rm -v "$WORKDIR"/livekit/kernel "$WORKDIR"/livekit/live-initramfs.img
if [[ "${RETRO}" != "1" ]]; then
echo "Copying LiveKit template ..."
chown -vR 0:0 templates/livekit/*
cp -av templates/livekit/* $WORKDIR/livekit/
chown -vR 1000:1001 $WORKDIR/livekit/home/live
if [ "$SUDO_UID" != 0 ] ; then
chown -vR $SUDO_UID:$SUDO_GID templates/livekit/*
fi
fi
info "Squashing rootfs ..."
packfs "$FSTYPE" "$ISODIR"/"$FSTYPE"/base.squashfs "$WORKDIR"/livekit
info "Installing GRUB config files ..."
make -C "$PWD"/boot/grub install TARGET=livekit
info "Writing config file ..."
echo "$CONF" > $ISODIR/$FSTYPE/layers.conf
info "Copying hooks ..."
cp -a "$PWD"/hooks $ISODIR/$FSTYPE/
info "Done generating the LiveKit image!"