Debian Codegraph @

helpers/calamares-sources-media

raw
1 #!/bin/sh
2
3 CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
4 KNOWN_MEDIUM_PATHS="/run/live/medium /run/initramfs/live"
5 RELEASE="trixie"
6
7 # Support both dracut and initramfs configurations to avoid substitutions
8 # in live-build, see: #1089618
9 for path in $KNOWN_MEDIUM_PATHS; do
10 if [ "$(mount | grep $path | cut -f3 -d" ")" = "$path" ]; then
11 MEDIUM_PATH=$path
12 fi
13 done
14
15 if [ "$1" = "-u" ]; then
16 umount $CHROOT/$MEDIUM_PATH
17 rm $CHROOT/etc/apt/sources.list.d/debian-live-media.list
18 chroot $CHROOT apt-get update
19 exit 0
20 fi
21
22 # Remove the base sources, we will configure sources in a later phase
23 rm -f $CHROOT/etc/apt/sources.list.d/base.list
24
25 mkdir -p $CHROOT/$MEDIUM_PATH
26 mount --bind $MEDIUM_PATH $CHROOT/$MEDIUM_PATH
27 echo "deb [trusted=yes] file:$MEDIUM_PATH $RELEASE main" > $CHROOT/etc/apt/sources.list.d/debian-live-media.list
28 chroot $CHROOT apt-get update
29 # Attempt safest way to remove cruft
30 rmdir $CHROOT/run/live/medium
31 rmdir $CHROOT/run/live
32
33 exit 0