apply all new patches of 3.0~a57-ok3

This commit is contained in:
谢炜 2022-09-30 16:00:10 +08:00
parent 0d3a3bbd29
commit 5a4152d2b7
33 changed files with 1501 additions and 161 deletions

View File

@ -0,0 +1,49 @@
netcfg
ethdetect
block-modules-3.16.0-23-generic-di
cdrom-checker
cdrom-retriever
crypto-modules-3.16.0-23-generic-di
debian-installer-udebs
di-utils-mapdevfs
download-installer
fat-modules-3.16.0-23-generic-di
fbset-udeb
file-preseed
fs-core-modules-3.16.0-23-generic-di
fs-secondary-modules-3.16.0-23-generic-di
hdparm-udeb
input-modules-3.16.0-23-generic-di
ipmi-modules-3.16.0-23-generic-di
irda-modules-3.16.0-23-generic-di
iso-scan
kernel-image-3.16.0-23-generic-di
libc6-udeb
libnss-dns-udeb
libnss-files-udeb
libpci3-udeb
linux-udebs-generic
live-installer
load-cdrom
load-iso
ltsp-client-builder
md-modules-3.16.0-23-generic-di
mouse-modules-3.16.0-23-generic-di
multipath-modules-3.16.0-23-generic-di
nfs-modules-3.16.0-23-generic-di
nic-modules-3.16.0-23-generic-di
nic-shared-modules-3.16.0-23-generic-di
parport-modules-3.16.0-23-generic-di
pciutils-udeb
plip-modules-3.16.0-23-generic-di
ppp-modules-3.16.0-23-generic-di
reiserfsprogs-udeb
sata-modules-3.16.0-23-generic-di
scsi-modules-3.16.0-23-generic-di
speakup-modules-3.16.0-23-generic-di
squashfs-modules-3.16.0-23-generic-di
storage-core-modules-3.16.0-23-generic-di
usb-discover
virtio-modules-3.16.0-23-generic-di
vlan-modules-3.16.0-23-generic-di

View File

@ -115,7 +115,7 @@ debian-edu-archive-keyring-udeb
ltsp-client-builder
autopartkit
# live CD stuff
live-installer
#live-installer
simple-cdd-profiles
# If needed, will be on the initrd already
module-init-tools-udeb

View File

@ -0,0 +1,91 @@
alsa-base-udeb
at-spi2-core-udeb
beep-udeb
bootstrap-base
cdebconf-gtk-entropy
cdebconf-gtk-udeb
cfdisk-udeb
console-keymaps-acorn
console-keymaps-amiga
console-keymaps-at
console-keymaps-atari
console-keymaps-dec
console-keymaps-mac
console-keymaps-sun
console-keymaps-usb
console-setup-amiga-ekmap
console-setup-ataritt-ekmap
console-setup-macintoshold-ekmap
console-setup-sun4-ekmap
console-setup-sun5-ekmap
dbus-udeb
debian-archive-keyring-udeb
debian-ports-archive-keyring-udeb
devio-udeb
di-utils-exit-installer
efi-reader
emdebian-archive-keyring-udeb
espeak-data-udeb
espeakup-udeb
flash-kernel-installer
fonts-dejavu-mono-udeb
fonts-dejavu-udeb
fonts-farsiweb-udeb
fonts-freefont-udeb
fonts-khmeros-udeb
fonts-knda-udeb
fonts-lao-udeb
fonts-lklug-sinhala-udeb
fonts-mlym-udeb
fonts-sil-abyssinica-udeb
fonts-sil-padauk-udeb
fonts-sil-scheherazade-udeb
fonts-taml-udeb
fonts-telu-udeb
fonts-thai-tlwg-udeb
fonts-tibetan-machine-udeb
fonts-ukij-uyghur-udeb
gnupg-udeb
libasound2-udeb
libatk-adaptor-udeb
libatk-bridge-2.0-0-udeb
libatspi0-udeb
libavahi-common3-udeb
libavahi-core7-udeb
libcrack2-udeb
libdbus-1-3-udeb
libdns-export100-udeb
libevdev2-udeb
libfakekey0-udeb
libffi6-udeb
libgdk-pixbuf2.0-0-udeb
libgtk2.0-0-udeb
libharfbuzz0-udeb
libirs-export91-udeb
libisccfg-export90-udeb
libisc-export95-udeb
libmtdev1-udeb
libsysfs2-udeb
libusb-0.1-udeb
libxml2-udeb
libxmlrpc-core-c3-udeb
libxshmfence1-udeb
libxtst6-udeb
lvmcfg
lvmcfg-utils
maas-enlist-udeb
matchbox-keyboard-udeb
matchbox-window-manager-udeb
mdcfg
mdcfg-utils
migration-assistant
mythbuntu-diskless-client-builder
netcfg-static
oldsys-preseed
partman-nbd
ppp-udeb
redboot-tools-udeb
squid-deb-proxy-client-udeb
system-integrity-check
userdevfs
wide-dhcpv6-client-udeb

View File

@ -0,0 +1,3 @@
choose-mirror
netcfg
ethdetect

View File

@ -0,0 +1,2 @@
netcfg
ethdetect

View File

@ -0,0 +1,2 @@
netcfg
ethdetect

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
live-build (3.0~a57-ok3) yangtze; urgency=medium
[ 谢炜 ]
* add kylin patches
-- Xie Wei <xiewei@kylinos.cn> Fri, 30 Sep 2022 15:49:37 +0800
live-build (3.0~a57-ok2) yangtze; urgency=medium
* update version info

3
debian/rules vendored
View File

@ -10,6 +10,7 @@ override_dh_auto_build:
override_dh_auto_install:
dh_auto_install -- DESTDIR=debian/live-build
chmod +x debian/live-build/usr/lib/live/build/*
chmod +x debian/live-build/usr/share/live/build/bin/*
# Removing unused files
rm -f debian/live-build/usr/share/doc/live-build/COPYING
@ -31,3 +32,5 @@ override_dh_link:
# workaround dh_link convertion of absolute symlinks to relvative symlinks
rm -rf debian/live-build/usr/share/live/build/bootloaders
cp -a share/bootloaders debian/live-build/usr/share/live/build/bootloaders
ln -sf /usr/lib/syslinux/modules/bios/vesamenu.c32 debian/live-build/usr/share/live/build/bootloaders/isolinux/vesamenu.c32
ln -sf /usr/lib/ISOLINUX/isolinux.bin debian/live-build/usr/share/live/build/bootloaders/isolinux/isolinux.bin

View File

@ -61,6 +61,10 @@ Check_crossarchitectures ()
CROSS="amd64 i386"
;;
arm64)
CROSS="arm64 armhf"
;;
powerpc|ppc64)
CROSS="powerpc ppc64"
;;

View File

@ -28,7 +28,7 @@ Set_defaults ()
_DISTRIBUTOR="$(lsb_release -is | tr [A-Z] [a-z])"
case "${_DISTRIBUTOR}" in
debian|progress|ubuntu)
debian|progress|ubuntu|kylin|openkylin)
LB_MODE="${LB_MODE:-${_DISTRIBUTOR}}"
;;
@ -197,7 +197,7 @@ Set_defaults ()
case "${LB_INITRAMFS}" in
auto)
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
LB_INITRAMFS="casper"
;;
@ -222,7 +222,7 @@ Set_defaults ()
# Setting initsystem
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
case "${LB_INITRAMFS}" in
live-boot)
LB_INITSYSTEM="${LB_INITSYSTEM:-upstart}"
@ -630,11 +630,16 @@ Set_defaults ()
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
;;
ubuntu|kubuntu)
ubuntu|kubuntu|kylin)
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main restricted}"
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
;;
openkylin)
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main cross pty}"
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
;;
*)
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
@ -685,6 +690,14 @@ Set_defaults ()
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-ubuntu-keyring}"
;;
kylin)
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-kylin-keyring}"
;;
openkylin)
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-openkylin-keyring}"
;;
*)
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
;;
@ -696,6 +709,10 @@ Set_defaults ()
# Assume we'll have a generic kernel for arm64 some day:
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
mips64el|loongarch64)
# Assume we'll have a generic kernel for mips64el some day:
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
armel)
case "${LB_MODE}" in
ubuntu|kubuntu)
@ -717,7 +734,7 @@ Set_defaults ()
amd64)
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
@ -741,7 +758,7 @@ Set_defaults ()
esac
;;
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
case "${LB_DISTRIBUTION}" in
precise)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic-pae}"
@ -823,6 +840,14 @@ Set_defaults ()
ppc64el)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
sw64)
# Assume we'll have a generic kernel for arm64 some day:
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
riscv64)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
;;
s390x)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
@ -862,7 +887,7 @@ Set_defaults ()
# Set linux packages
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux}"
;;
@ -1035,7 +1060,7 @@ Set_defaults ()
hdd*)
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
then
_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
@ -1095,6 +1120,14 @@ Set_defaults ()
kubuntu)
LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Kubuntu Live}"
;;
kylin)
LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Kylin Live}"
;;
openkylin)
LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-openKylin Live}"
;;
esac
# Set iso preparer
@ -1132,6 +1165,14 @@ Set_defaults ()
kubuntu)
LB_HDD_LABEL="${LB_HDD_LABEL:-KUBUNTU}"
;;
kylin)
LB_HDD_LABEL="${LB_HDD_LABEL:-Kylin}"
;;
openkylin)
LB_HDD_LABEL="${LB_HDD_LABEL:-openKylin}"
;;
esac
# Setting hdd size
@ -1158,6 +1199,14 @@ Set_defaults ()
kubuntu)
LB_ISO_VOLUME="${LB_ISO_VOLUME:-Ubuntu ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
;;
kylin)
LB_ISO_VOLUME="${LB_ISO_VOLUME:-Kylin ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
;;
openKylin)
LB_ISO_VOLUME="${LB_ISO_VOLUME:-openKylin ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
;;
esac
# Setting memtest option
@ -1227,7 +1276,7 @@ Set_defaults ()
# Setting firmware option
case "${LB_MODE}" in
ubuntu)
ubuntu|kylin|openkylin)
LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT:-false}"
LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-false}"
;;

View File

@ -10,20 +10,20 @@
Echo ()
{
STRING="${1}"
ABSTRACT="${1}"
shift
printf "${STRING}\n" "${@}"
printf "${ABSTRACT}\n" "${@}"
}
Echo_debug ()
{
if [ "${_DEBUG}" = "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
printf "D: ${STRING}\n" "${@}"
printf "D: ${ABSTRACT}\n" "${@}"
fi
}
@ -31,10 +31,10 @@ Echo_debug_running ()
{
if [ "${_DEBUG}" = "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
printf "D: ${STRING}" "${@}"
printf "D: ${ABSTRACT}" "${@}"
if [ "${_COLOR}" = "false" ]
then
@ -47,7 +47,7 @@ Echo_debug_running ()
Echo_error ()
{
STRING="${1}"
ABSTRACT="${1}"
shift
if [ "${_COLOR}" = "false" ]
@ -57,14 +57,14 @@ Echo_error ()
printf "${RED}E${NO_COLOR}:"
fi
printf " ${STRING}\n" "${@}" >&2
printf " ${ABSTRACT}\n" "${@}" >&2
}
Echo_message ()
{
if [ "${_QUIET}" != "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
if [ "${_COLOR}" = "false" ]
@ -74,7 +74,7 @@ Echo_message ()
printf "${WHITE}P${NO_COLOR}:"
fi
printf " ${STRING}\n" "${@}"
printf " ${ABSTRACT}\n" "${@}"
fi
}
@ -82,7 +82,7 @@ Echo_message_running ()
{
if [ "${_QUIET}" != "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
if [ "${_COLOR}" = "false" ]
@ -92,7 +92,7 @@ Echo_message_running ()
printf "${WHITE}P${NO_COLOR}:"
fi
printf " ${STRING}" "${@}"
printf " ${ABSTRACT}" "${@}"
if [ "${_COLOR}" = "true" ]
then
@ -107,10 +107,10 @@ Echo_verbose ()
{
if [ "${_VERBOSE}" = "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
printf "I: ${STRING}\n" "${@}"
printf "I: ${ABSTRACT}\n" "${@}"
fi
}
@ -118,10 +118,10 @@ Echo_verbose_running ()
{
if [ "${_VERBOSE}" != "true" ]
then
STRING="${1}"
ABSTRACT="${1}"
shift
printf "I: ${STRING}" "${@}"
printf "I: ${ABSTRACT}" "${@}"
if [ "${_COLOR}" = "true" ]
then
@ -134,7 +134,7 @@ Echo_verbose_running ()
Echo_warning ()
{
STRING="${1}"
ABSTRACT="${1}"
shift
if [ "${_COLOR}" = "false" ]
@ -144,7 +144,7 @@ Echo_warning ()
printf "${YELLOW}W${NO_COLOR}:"
fi
printf " ${STRING}\n" "${@}"
printf " ${ABSTRACT}\n" "${@}"
}
Echo_status ()

View File

@ -29,3 +29,8 @@ RELEASE_quantal="12.10" # 2014-04-01
RELEASE_raring="13.04" # 2014-01-01
RELEASE_saucy="13.10" # 2014-07-01
RELEASE_trusty="14.04" # LTS: 2019-04-01
RELEASE_utopic="14.10" #
RELEASE_ginkgo="4.0" # kylin ginkgo
RELEASE_xenial="16.04" # LTS
RELEASE_juniper="4.0" # kylin juniper
RELEASE_yakkety="16.10" # 2016-10-01

View File

@ -65,6 +65,7 @@ lb binary_debian-installer ${*}
lb binary_memtest ${*}
lb binary_grub ${*}
lb binary_grub2 ${*}
lb binary_grub2-efi ${*}
lb binary_syslinux ${*}
lb binary_yaboot ${*}
lb binary_silo ${*}

View File

@ -77,6 +77,19 @@ EOF
cd "${OLDPWD}"
done
#kylin add /md5sum.txt
cd binary
find . -type f \
\! -path './isolinux/isolinux.bin' \
\! -path './isolinux/boot.cat' \
\! -path './boot/boot.bin' \
\! -path './boot/grub/stage2_eltorito' \
\! -path './*SUMS' \
-print0 | sort -z | xargs -0 md5sum > ../md5sum.txt
mv ../md5sum.txt .
cd "${OLDPWD}"
#end kylin add /md5sum.txt
# File list
cd binary
find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.contents

View File

@ -338,16 +338,21 @@ if [ "${DI_IMAGE_TYPE}" != "netboot" ]
then
# Downloading additional packages
mkdir -p chroot/binary.deb/archives/partial
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
;;
esac
case "${LB_ARCHITECTURES}" in
amd64)
DI_REQ_PACKAGES="lilo grub grub-pc"
DI_REQ_PACKAGES="lilo grub-pc"
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic"
;;
@ -358,10 +363,10 @@ then
;;
i386)
DI_REQ_PACKAGES="elilo lilo grub grub-pc"
DI_REQ_PACKAGES="elilo lilo grub-pc"
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
case "${LB_DISTRIBUTION}" in
precise)
DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic-pae"
@ -483,22 +488,36 @@ then
# .debs must actually exist.
# Modify dpkg status to show the required packages are not installed.
cp chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
for PACKAGE in ${DI_REQ_PACKAGES}
do
awk -v f=0 '
f == 1 { print "Status: purge ok not-installed"; f=0; next }
/Package: '"${PACKAGE}"'/ { f=1; }
{ print }
' chroot/var/lib/dpkg/status > chroot/var/lib/dpkg/status.awk
mv chroot/var/lib/dpkg/status.awk chroot/var/lib/dpkg/status
done
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
cp chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
for PACKAGE in ${DI_REQ_PACKAGES}
do
awk -v f=0 '
f == 1 { print "Status: purge ok not-installed"; f=0; next }
/Package: '"${PACKAGE}"'/ { f=1; }
{ print }
' chroot/var/lib/dpkg/status > chroot/var/lib/dpkg/status.awk
mv chroot/var/lib/dpkg/status.awk chroot/var/lib/dpkg/status
done
;;
esac
# Download .deb's that we just marked as "purged" which caused broken dependencies
Chroot chroot ${_LB_APT_COMMAND} -f dist-upgrade
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
;;
esac
# Download .debs of the required packages
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES}
@ -507,7 +526,14 @@ then
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES}
# Revert dpkg status file
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
;;
esac
fi
mv chroot/binary.deb ./
@ -524,21 +550,27 @@ then
Install_file "${FILE}" "binary/pool"
done
fi
if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
then
# Including base debian packages
if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1
then
for FILE in cache/packages.bootstrap/*.deb
do
Install_file "${FILE}" "binary/pool"
done
else
Echo_error "Could not find packages in cache/packages.bootstrap."
Echo_error "You selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached - these are required when integrating the Debian Installer."
exit 1
fi
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not copy debootstrap debs"
;;
*)
# Including base debian packages
if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1
then
for FILE in cache/packages.bootstrap/*.deb
do
Install_file "${FILE}" "binary/pool"
done
else
Echo_error "Could not find packages in cache/packages.bootstrap."
Echo_error "You selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached - these are required when integrating the Debian Installer."
exit 1
fi
;;
esac
fi
# Including local debs
@ -578,7 +610,18 @@ then
gzip -9 -c binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages > binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages.gz
# Fetching release
Download_file binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Release "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/${_ARCHIVE_AREA}/binary-"${LB_ARCHITECTURES}"/Release
# kylin: not download component Release, but create locally
# Download_file binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Release "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/${_ARCHIVE_AREA}/binary-"${LB_ARCHITECTURES}"/Release
ORIGIN="$(echo $LB_ISO_VOLUME | cut -d '-' -f 1)"
eval _VERSION="$`echo RELEASE_${LB_PARENT_DISTRIBUTION}`"
cat > binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Release << EOF
Archive: ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}
Version: ${_VERSION}
Component: ${_ARCHIVE_AREA}
Origin: $ORIGIN
Label: $ORIGIN
Architecture: ${LB_ARCHITECTURES}
EOF
done
# Symlink firmware packages to /firmware
@ -599,50 +642,82 @@ then
fi
# Udeb handling
mkdir binary.udeb
cd binary.udeb
# Downloading udeb indices
Download_file Packages.gz "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz
gunzip -c Packages.gz > Packages
if [ "${LB_DERIVATIVE}" = "true" ]
if Find_files config/package-lists/*.list.udeb
then
Download_file Packages.derivative.gz "${LB_MIRROR_CHROOT}"/dists/"${LB_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz
gunzip -c Packages.derivative.gz > Packages.derivative
fi
# Sorting udebs
if [ "${LB_DERIVATIVE}" = true ]
then
UDEBS="$(awk '/Filename: / { print $2 }' Packages.derivative)"
fi
UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)"
# Downloading udebs packages
Echo_message "Downloading udebs..."
if [ "${LB_DERIVATIVE}" = "true" ]
then
Echo_message "Building in derivative mode in debian+ layout.. a lot of 404 errors are ok here."
fi
for UDEB in ${UDEBS}
do
if [ -f ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ]
then
# Copying cached udebs
cp ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ./
else
# Downloading udebs
if ! ls "$(basename ${UDEB} | awk -F_ '{ print $1 }')"_* > /dev/null 2>&1
cp /usr/share/live/build/bin/get-udeb chroot/bin
cp config/package-lists/*.list.udeb chroot/root/
Chroot chroot "/bin/get-udeb ${APT_OPTIONS}"
rm -f chroot/bin/get-udeb
rm -f chroot/root/*.list.udeb
mv chroot/root/binary.udeb ./
cd binary.udeb
UDEBS=""
for FILE in *.udeb
do
SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
if [ -z "${SOURCE}" ]
then
wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}"/${UDEB} || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}"/${UDEB}
SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
fi
case "${SOURCE}" in
lib?*)
LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')"
;;
*)
LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')"
;;
esac
UDEBS="${UDEBS} pool/main/${LETTER}/${SOURCE}/${FILE}"
done
else
mkdir binary.udeb
cd binary.udeb
# Downloading udeb indices
Download_file Packages.gz "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz
gunzip -c Packages.gz > Packages
if [ "${LB_DERIVATIVE}" = "true" ]
then
Download_file Packages.derivative.gz "${LB_MIRROR_CHROOT}"/dists/"${LB_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz
gunzip -c Packages.derivative.gz > Packages.derivative
fi
done
# Sorting udebs
if [ "${LB_DERIVATIVE}" = true ]
then
UDEBS="$(awk '/Filename: / { print $2 }' Packages.derivative)"
fi
UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)"
# Downloading udebs packages
Echo_message "Downloading udebs..."
if [ "${LB_DERIVATIVE}" = "true" ]
then
Echo_message "Building in derivative mode in debian+ layout.. a lot of 404 errors are ok here."
fi
for UDEB in ${UDEBS}
do
if [ -f ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ]
then
# Copying cached udebs
cp ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ./
else
# Downloading udebs
if ! ls "$(basename ${UDEB} | awk -F_ '{ print $1 }')"_* > /dev/null 2>&1
then
wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}"/${UDEB} || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}"/${UDEB}
fi
fi
done
fi
# Caching udebs
rm -rf ../cache/packages.binary_debian-installer.udeb
mkdir -p ../cache/packages.binary_debian-installer.udeb

View File

@ -78,6 +78,18 @@ case "${LB_MODE}" in
TRACE="project/trace/archive-master.progress-linux.org"
;;
kylin)
TITLE="Kylin"
STRING="Build ${ARCHITECTURE}"
TRACE=""
;;
openkylin)
TITLE="openKylin"
STRING="Build ${ARCHITECTURE}"
TRACE=""
;;
*)
TITLE="Debian GNU/Linux"
STRING="Snapshot ${ARCHITECTURE}"
@ -93,6 +105,10 @@ fi
case "${LB_INITRAMFS}" in
casper)
touch binary/.disk/base_installable
echo "full_cd/single" > binary/.disk/cd_type
for INITRD in binary/casper/initrd.img*
do
mkdir -p binary/uuid
@ -121,7 +137,7 @@ case "${LB_DEBIAN_INSTALLER}" in
touch binary/.disk/base_installable
echo "full_cd" > binary/.disk/cd_type
echo "full_cd/single" > binary/.disk/cd_type
echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info

408
scripts/build/lb_binary_grub2-efi Executable file
View File

@ -0,0 +1,408 @@
#!/bin/sh
set -e
# Including common functions
( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
# Setting static variables
DESCRIPTION="$(Echo 'installs grub2 efi into binary')"
HELP=""
USAGE="${PROGRAM} [--force]"
ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')"
ORIGIN="$(echo $LB_ISO_VOLUME | cut -d '-' -f 1)"
Arguments "${@}"
if [ -f .build/chroot_has_efi ] || [ -f .build/binary_has_efi ];then
Echo_message "Begin installing grub2 efi..."
else
Echo_message "Kylin add has .build/no_efi, exit grub2-efi"
exit 0
fi
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
Set_defaults
# Requiring stage file
Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/binary_grub2_efi
# Checking grub2 templates
Check_templates grub2
# Checking lock file
Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
# Check architecture
Check_architectures amd64 arm64 mips64el loongarch64 sw64
Check_crossarchitectures
# Checking depends
case ${ARCHITECTURE} in
'amd64'|'arm64'|'mips64el'|'loongarch64'|'sw64')
Check_package chroot/usr/bin/grub-mkimage grub-efi-${ARCHITECTURE}
Check_package chroot/sbin/mkfs.fat dosfstools
Check_package chroot/sbin/MAKEDEV makedev
;;
*)
Echo_message "not amd64 or arm64 or mips64el or loongarch64 or sw64, grub2-efi exit"
exit 0
;;
esac
# Restoring cache
Restore_cache cache/packages.binary
# Installing depends
Install_package
case ${LB_BINARY_IMAGES} in
iso*)
if [ ! -d chroot/usr/lib/grub/x86_64-efi ] && \
[ ! -d chroot/usr/lib/grub/arm64-efi ] && \
[ ! -d chroot/usr/lib/grub/mips64el-efi ] && \
[ ! -d chroot/usr/lib/grub/sw64-efi ] && \
[ ! -d chroot/usr/lib/grub/loongarch64-efi ];then
exit 0
fi
;;
*)
exit 0
;;
esac
Echo_message "Begin installing grub2 efi doing..."
# Local functions
Grub_live_entry ()
{
LABEL="${1}"
KERNEL="${2}"
INITRD="${3}"
APPEND="${4}"
DEVICETREE="${5}"
LINUX_LIVE="${LINUX_LIVE}\nmenuentry \"${LABEL}\" {"
LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} ${APPEND}"
LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}"
if [ -n "$DEVICETREE" ];then
LINUX_LIVE="${LINUX_LIVE}\ndevicetree\t\t/${DEVICETREE}"
fi
LINUX_LIVE="${LINUX_LIVE}\n}"
}
Grub_install_entry ()
{
LABEL="${1}"
KERNEL="${2}"
INITRD="${3}"
APPEND="${4}"
DEVICETREE="${5}"
if [ -e "${KERNEL}" ] && [ -e "${APPEND}" ];then
LINUX_INSTALL="${LINUX_INSTALL}\nmenuentry \"${LABEL}\" {"
LINUX_INSTALL="${LINUX_INSTALL}\nlinux\t\t/${KERNEL} ${APPEND} LB_BOOTAPPEND_INSTALL"
LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}"
if [ -n "$DEVICETREE" ];then
LINUX_INSTALL="${LINUX_INSTALL}\ndevicetree\t\t/${DEVICETREE}"
fi
LINUX_INSTALL="${LINUX_INSTALL}\n}"
fi
}
case "${LB_INITRAMFS}" in
casper)
INITFS="casper"
;;
live-boot)
INITFS="live"
;;
*)
INITFS=""
;;
esac
# Setting destination directory
case "${LB_BINARY_IMAGES}" in
iso*|tar)
case "${LB_INITRAMFS}" in
casper)
DESTDIR_LIVE="binary/casper"
;;
live-boot)
DESTDIR_LIVE="binary/live"
;;
*)
DESTDIR_LIVE="binary/live"
;;
esac
DESTDIR_INSTALL="binary/install"
;;
hdd*|netboot)
Echo_warning "Bootloader in this image type not yet supported by live-build."
Echo_warning "This would produce a not bootable image, aborting (FIXME)."
exit 1
;;
esac
Check_multiarchitectures
# Creating directory
mkdir -p "${DESTDIR_LIVE}"
# Setting boot parameters
if [ "${LB_UNION_FILESYSTEM}" != "aufs" ]
then
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}"
fi
if [ -n "${LB_NET_COW_PATH}" ]
then
Echo_error "Net cow not yet supported on grub"
exit 1
fi
if [ "${LB_EXPOSED_ROOT}" != "false" ]
then
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot"
fi
LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')"
# Assembling kernel configuration
# Default entries
DEFAULT_FLAVOUR="$(echo ${LB_LINUX_FLAVOURS} | awk '{ print $1 }')"
DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})"
DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')"
case ${ARCHITECTURE} in
'amd64')
Grub_live_entry "Try ${ORIGIN} without installing" "/casper/vmlinuz" "/casper/initrd.lz" "boot=casper locale=zh_CN quiet splash"
Grub_live_entry "Install ${ORIGIN}" "/casper/vmlinuz" "/casper/initrd.lz" "boot=casper only-ubiquity locale=zh_CN quiet splash"
;;
'arm64')
Grub_live_entry "Try ${ORIGIN} without installing" "/casper/Image" "/casper/initrd.img" "boot=casper rootwait ro locale=zh_CN KEYBOARDTYPE=pc KEYTABLE=us ignore_uuid quiet splash"
Grub_live_entry "Install ${ORIGIN}" "/casper/Image" "/casper/initrd.img" "boot=casper only-ubiquity rootwait ro locale=zh_CN KEYBOARDTYPE=pc KEYTABLE=us ignore_uuid quiet splash"
;;
'mips64el')
Grub_live_entry "Try ${ORIGIN} without installing" "/casper/vmlinuz" "/casper/initrd.img" "console=tty1 boot=casper quiet splash loglevel=0 audit=0"
Grub_live_entry "Install ${ORIGIN}" "/casper/vmlinuz" "/casper/initrd.img" "console=tty1 boot=casper quiet splash loglevel=0 only-ubiquity audit=0"
;;
'loongarch64')
Grub_live_entry "Try ${ORIGIN} without installing" "/casper/vmlinuz" "/casper/initrd.img" "console=ttyS0,115200 boot=casper loglevel=0 audit=0"
Grub_live_entry "Install ${ORIGIN}" "/casper/vmlinuz" "/casper/initrd.img" "console=ttyS0,115200 boot=casper loglevel=0 only-ubiquity audit=0"
;;
'sw64')
Grub_live_entry "Try ${ORIGIN} without installing" "/casper/vmlinuz" "/casper/initrd.img" "boot=casper loglevel=0 audit=0"
Grub_live_entry "Install ${ORIGIN}" "/casper/vmlinuz" "/casper/initrd.img" "boot=casper loglevel=0 only-ubiquity audit=0"
;;
esac
LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')"
# Assembling debian-installer configuration
if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
then
case ${ARCHITECTURE} in
'amd64')
LINUX_LIVE="#\t \"Live\"\n${LINUX_LIVE}"
LINUX_INSTALL="#\t \"Installer\"\n"
VMLINUZ_DI="install/vmlinuz"
INITRD_DI="install/initrd.gz"
APPEND_DI="vga=normal"
VMLINUZ_GI="install/gtk/vmlinuz"
INITRD_GI="install/gtk/initrd.gz"
APPEND_GI="video=vesa:ywrap,mtrr vga=788"
Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}"
Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}"
Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}"
;;
'arm64')
LINUX_LIVE="#\t \"Live\"\n${LINUX_LIVE}"
LINUX_INSTALL="#\t \"Installer\"\n"
VMLINUZ_DI="install/Image"
INITRD_DI="install/initrd.img"
APPEND_DI="vga=normal rootwait"
VMLINUZ_GI="install/gtk/vmlinuz"
INITRD_GI="install/gtk/initrd.img"
APPEND_GI="video=vesa:ywrap,mtrr vga=788 rootwait"
Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}"
Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}"
Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}"
Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}"
Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}"
Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}"
;;
esac
fi
LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')"
# Assembling memtest configuration
if [ -f "${DESTDIR_LIVE}"/memtest ]
then
MEMTEST="#\t \"Other\"\n"
MEMTEST="${MEMTEST}\nmenuentry\t\"${LB_MEMTEST}\" {\nlinux16\t$(basename ${DESTDIR_LIVE})/memtest\n}"
MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')"
fi
# Copying templates
mkdir -p binary/boot/grub
cp -r "${TEMPLATES}"/* binary/boot/grub
case ${LB_BINARY_IMAGES} in
iso*)
case ${ARCHITECTURE} in
'amd64')
FILES="chroot/usr/lib/grub/x86_64-efi chroot/usr/share/grub/*.pf2"
;;
'arm64'|'mips64el')
FILES="chroot/usr/lib/grub/${ARCHITECTURE}-efi chroot/usr/share/grub/*.pf2"
;;
'loongarch64')
FILES="chroot/usr/lib/grub/${ARCHITECTURE}-efi"
;;
'sw64')
FILES="chroot/usr/lib/grub/${ARCHITECTURE}-efi"
;;
esac
;;
esac
# Copying grub
cp -r ${FILES} binary/boot/grub
if [ "${LB_BUILD_WITH_CHROOT}" = "false" ]
then
FILES="$(echo ${FILES} | sed -e 's|chroot||g')"
fi
# Copying local configuration file
if [ -f config/binary_grub/grub.cfg ]
then
cp config/binary_grub/grub.cfg binary/boot/grub/grub.cfg
fi
sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/grub.cfg
sed -i -e "s|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_BOOTAPPEND_LIVE}|" binary/boot/grub/grub.cfg
sed -i -e 's|\ $||g' binary/boot/grub/grub.cfg
#kylin create efi.img
KY_EFI=""
KY_EFI_NAME=""
GRUB_MODS="ext2 fat part_msdos part_gpt search_fs_uuid search_label search_fs_file search normal linux font all_video reboot configfile test iso9660"
if [ -d chroot/usr/lib/grub/x86_64-efi ];then
KY_EFI="/usr/lib/grub/x86_64-efi"
KY_EFI_NAME="x86_64-efi"
KY_BOOT_EFI_NAME="BOOTX64.EFI"
KY_GRUB_EFI_NAME="grubx64.efi"
GRUB_MODS="${GRUB_MODS} linuxefi"
elif [ -d chroot/usr/lib/grub/arm64-efi ];then
KY_EFI="/usr/lib/grub/arm64-efi"
KY_EFI_NAME="arm64-efi"
KY_BOOT_EFI_NAME="BOOTAA64.EFI"
KY_GRUB_EFI_NAME="grubaa64.efi"
elif [ -d chroot/usr/lib/grub/mips64el-efi ];then
KY_EFI="/usr/lib/grub/mips64el-efi"
KY_EFI_NAME="mips64el-efi"
KY_BOOT_EFI_NAME="BOOTMIPS.EFI"
KY_GRUB_EFI_NAME="grubmips64.efi"
elif [ -d chroot/usr/lib/grub/loongarch64-efi ];then
KY_EFI="/usr/lib/grub/loongarch64-efi"
KY_EFI_NAME="loongarch64-efi"
KY_BOOT_EFI_NAME="BOOTLOONGARCH.EFI"
KY_GRUB_EFI_NAME="grubloongarch64.efi"
elif [ -d chroot/usr/lib/grub/sw64-efi ];then
KY_EFI="/usr/lib/grub/sw64-efi"
KY_EFI_NAME="sw64-efi"
KY_BOOT_EFI_NAME="BOOTLOONGARCH.EFI"
KY_GRUB_EFI_NAME="grubsw64.efi"
fi
mkdir -p binary/boot/grub
if [ -n "${KY_EFI}" ];then
cat > kylin_efi.sh << EOF
set -e
input_efi_dir=${KY_EFI}
core_efi_img=\$(mktemp)
efi_mount_tmp=\$(mktemp -d)
grub-mkimage -p /boot/grub -o \${core_efi_img} -O ${KY_EFI_NAME} -d \${input_efi_dir} ${GRUB_MODS}
dd if=/dev/zero of=efi.img bs=1M count=28
mkfs.fat -F12 efi.img
mount -o loop efi.img \${efi_mount_tmp}
mkdir -p \${efi_mount_tmp}/EFI/BOOT/
cp \${core_efi_img} \${efi_mount_tmp}/EFI/BOOT/${KY_BOOT_EFI_NAME}
cp \${core_efi_img} \${efi_mount_tmp}/EFI/BOOT/${KY_GRUB_EFI_NAME}
cp \${core_efi_img} \${efi_mount_tmp}/EFI/BOOT/BOOT.EFI
cp -r \${efi_mount_tmp}/EFI binary/
umount \${efi_mount_tmp}
rm -rf \${efi_mount_tmp}
rm -rf \${core_efi_img}
cp -rf \${input_efi_dir} binary/boot/grub
mv efi.img binary/boot/grub/
EOF
case "${LB_BUILD_WITH_CHROOT}" in
true)
# Moving image
mv kylin_efi.sh chroot
mv binary chroot
Chroot chroot "sh kylin_efi.sh"
# Move image
mv chroot/binary ./
;;
false)
sh kylin_efi.sh
;;
esac
fi
if [ -f chroot/boot/grub/grub_ba.efi ];then
cp chroot/boot/grub/grub_ba.efi binary/boot/grub/
fi
if [ -f chroot/boot/grub/grub_kl.efi ];then
cp chroot/boot/grub/grub_kl.efi binary/boot/grub/
fi
#end
# Saving cache
Save_cache cache/packages.binary
# Creating stage file
Create_stagefile .build/binary_grub2_efi

View File

@ -9,6 +9,7 @@
set -e
set -x
# Including common functions
( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
@ -23,6 +24,8 @@ Arguments "${@}"
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
Set_defaults
ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')"
case "${LB_BINARY_IMAGES}" in
iso)
@ -33,6 +36,10 @@ case "${LB_BINARY_IMAGES}" in
IMAGE="binary.hybrid.iso"
;;
iso-xorr)
IMAGE="binary.xorr.iso"
;;
*)
exit 0
;;
@ -58,6 +65,12 @@ Check_package chroot/usr/bin/genisoimage genisoimage
if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
then
Check_package chroot/usr/bin/isohybrid syslinux
Check_package chroot/usr/bin/isohybrid syslinux-utils
fi
if [ "${LB_BINARY_IMAGES}" = "iso-xorr" ]
then
Check_package chroot/usr/bin/xorriso xorriso
fi
# Restoring cache
@ -73,7 +86,8 @@ then
fi
# Handle genisoimage generic options
GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot"
GENISOIMAGE_OPTIONS="-J -r -T -joliet-long -allow-leading-dots -l"
XORRISO_OPTIONS=""
# Handle genisoimage live-build specific options
if [ "${_QUIET}" = "true" ]
@ -105,6 +119,10 @@ if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_ISO_VOLUME}\""
fi
if [ "${ARCHITECTURE}" = "sw64" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b efibootimg -no-emul-boot -R -hide efibootimg"
fi
# Handle genisoimage architecture specific options
case "${LB_BOOTLOADER}" in
@ -138,6 +156,7 @@ case "${LB_BOOTLOADER}" in
GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin"
;;
esac
XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin"
;;
yaboot)
@ -159,6 +178,22 @@ esac
# GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}"
#fi
# kylin uefi
if test -f "binary/images/efiboot.img"
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -eltorito-alt-boot -e images/efiboot.img -no-emul-boot"
XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0xef binary/images/efiboot.img -partition_cyl_align all"
elif test -f "binary/boot/grub/efi.img"
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot"
XORRISO_OPTIONS="${XORRISO_OPTIONS} -append_partition 2 0xef binary/boot/grub/efi.img -partition_cyl_align all"
fi
if [ "${ARCHITECTURE}" = "amd64" ]
then
XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat -isohybrid-apm-hfsplus"
fi
if [ "${LB_BOOTLOADER}" = "grub2" ]
then
@ -191,12 +226,20 @@ else
echo "#!/bin/sh" > binary.sh
fi
if [ "${LB_BINARY_IMAGES}" = "iso-xorr" ]
then
cat >> binary.sh << EOF
genisoimage ${GENISOIMAGE_OPTIONS} -o ${IMAGE} binary
xorriso -as genisoimage ${GENISOIMAGE_OPTIONS} -o ${IMAGE} binary ${XORRISO_OPTIONS}
EOF
else
cat >> binary.sh << EOF
if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
genisoimage ${GENISOIMAGE_OPTIONS} ${GENISOIMAGE_OPTIONS_EXTRA} -o ${IMAGE} binary
EOF
fi
if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ] && [ "${LB_DEBIAN_INSTALLER}" = "false" ]
then
cat >> binary.sh << EOF
@ -208,6 +251,11 @@ fi
case "${LB_BUILD_WITH_CHROOT}" in
true)
if [ "${LB_BINARY_IMAGES}" = "iso-xorr" ] && [ "${LB_BOOTLOADER}" = "syslinux" ]
then
Check_package chroot/usr/lib/ISOLINUX/isohdpfx.bin isolinux
Install_package
fi
# Moving image
mv binary.sh chroot
mv binary chroot
@ -216,7 +264,7 @@ case "${LB_BUILD_WITH_CHROOT}" in
# Move image
mv chroot/binary chroot/${IMAGE} ./
rm -f chroot/binary.sh
#rm -f chroot/binary.sh
;;
false)

View File

@ -38,6 +38,23 @@ Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
#kylin add efi
ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')"
case ${ARCHITECTURE} in
'arm64'|'amd64'|'mips64el'|'loongarch64')
ky_chroot_has_efi="$(cat binary/casper/filesystem.manifest | grep grub-efi- | wc -l)"
if [ "${ky_chroot_has_efi}" = "0" ];then
touch .build/chroot_no_efi
else
touch .build/chroot_has_efi
fi
;;
*)
touch .build/chroot_no_efi
;;
esac
#end kylin efi
if ls config/package-lists/*.list > /dev/null 2>&1 || \
ls config/package-lists/*.list.binary > /dev/null 2>&1
then
@ -77,8 +94,15 @@ then
fi
mkdir -p chroot/binary.deb/archives/partial
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp
touch chroot/var/lib/dpkg/status
esac
for LIST in config/package-lists/*.list \
config/package-lists/*.list.binary
@ -96,6 +120,22 @@ then
fi
done
#kylin add efi
case ${ARCHITECTURE} in
'arm64'|'amd64'|'mips64el'|'loongarch64')
efi_pkg_num="$(ls chroot/binary.deb/archives/grub-efi*.deb | wc -l)"
if [ "${efi_pkg_num}" = "0" ];then
touch .build/binary_no_efi
else
touch .build/binary_has_efi
fi
;;
*)
touch .build/binary_no_efi
;;
esac
#end kylin efi
for FILE in chroot/binary.deb/archives/*.deb
do
SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
@ -118,10 +158,33 @@ then
if echo "${SECTION}" | grep -qs contrib
then
SECTION="contrib"
case "${LB_MODE}" in
ubuntu|kylin)
SECTION="multiverse"
;;
openkylin)
SECTION="cross"
;;
*)
SECTION="contrib"
;;
esac
elif echo "${SECTION}" | grep -qs non-free
then
SECTION="non-free"
case "${LB_MODE}" in
ubuntu|kylin)
SECTION="multiverse"
;;
openkylin)
SECTION="pty"
;;
*)
SECTION="non-free"
esac
else
SECTION="main"
fi
@ -134,11 +197,26 @@ then
done
cd binary
case "${LB_MODE}" in
ubuntu|kylin)
# kylin archive standard
mkdir -p pool/main pool/restricted pool/universe pool/multiverse
# end
;;
esac
for SECTION in pool/*
do
SECTION="$(basename ${SECTION})"
if [ "${LB_ARCHITECTURES}" = "amd64" ]
then
mkdir -p dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-i386
touch dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-i386/Packages
gzip -9 -c dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-i386/Packages > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-i386/Packages.gz
fi
mkdir -p dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}
apt-ftparchive packages pool/${SECTION} > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages
gzip -9 -c dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages.gz
@ -149,7 +227,15 @@ then
rm -f chroot/bin/Packages
rm -rf chroot/binary.deb
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
case "$LB_STRIP_POOL" in
true)
Echo_message "Will not create new dpkg/status"
;;
*)
mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
;;
esac
case "${LB_BUILD_WITH_CHROOT}" in
true)

View File

@ -147,7 +147,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
mv chroot/filesystem.${LB_CHROOT_FILESYSTEM} binary/${INITFS}
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size
;;
esac
@ -364,7 +364,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
*)
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
;;
*)
@ -390,7 +390,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
rm -f chroot/chroot/excludes
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size
;;
esac
@ -455,7 +455,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS}
case "${LB_MODE}" in
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
du -B 1 -s chroot | cut -f1 > binary/${INITFS}/filesystem.size
;;
esac

View File

@ -91,16 +91,21 @@ case "${LB_BUILD_WITH_CHROOT}" in
case "${LB_SYSLINUX_THEME}" in
live-build)
Check_package chroot/usr/bin/rsvg librsvg2-bin
Check_package chroot/usr/bin/rsvg-convert librsvg2-bin
Check_package chroot/usr/lib/ISOLINUX/isolinux.bin isolinux
;;
*)
Check_package chroot/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} syslinux-themes-${LB_SYSLINUX_THEME}
case "${LB_MODE}" in
ubuntu)
ubuntu|kylin)
Check_package chroot/usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz gfxboot-theme-ubuntu
;;
openkylin)
Check_package chroot/usr/share/gfxboot-theme-openkylin/bootlogo.tar.gz gfxboot-theme-openkylin
;;
esac
;;
esac
@ -123,10 +128,10 @@ case "${LB_BUILD_WITH_CHROOT}" in
case "${LB_SYSLINUX_THEME}" in
live-build)
if [ ! -e /usr/bin/rsvg ]
if [ ! -e /usr/bin/rsvg-convert ]
then
# librsvg2-bin
Echo_error "/usr/bin/rsvg - no such file"
Echo_error "/usr/bin/rsvg-convert - no such file"
exit 1
fi
;;
@ -183,13 +188,17 @@ case "${LB_BUILD_WITH_CHROOT}" in
rm -rf chroot/$(basename ${_SOURCE})
else
Chroot chroot cp -aL ${_SOURCE} /root/$(basename ${_SOURCE}).tmp
fi
case "${LB_MODE}" in
ubuntu|kylin)
Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp"
;;
case "${LB_MODE}" in
ubuntu)
Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp"
;;
esac
openkylin)
Chroot chroot "tar xfz /usr/share/gfxboot-theme-openkylin/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp"
;;
esac
fi
mv chroot/root/$(basename ${_SOURCE}).tmp ${_TARGET}
;;
@ -200,9 +209,13 @@ case "${LB_BUILD_WITH_CHROOT}" in
cp -aL ${_SOURCE}/* ${_TARGET}
case "${LB_MODE}" in
ubuntu)
ubuntu|kylin)
tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C ${_TARGET}
;;
openkylin)
tar xfz /usr/share/gfxboot-theme-openkylin/bootlogo.tar.gz -C ${_TARGET}
;;
esac
;;
esac
@ -215,12 +228,12 @@ then
case "${_FLAVOURS}" in
1)
mv binary/live/vmlinuz-* binary/live/vmlinuz
mv binary/live/initrd.img-* binary/live/initrd.img
mv binary/casper/vmlinuz-* binary/casper/vmlinuz
mv binary/casper/initrd.img-* binary/casper/initrd.img
sed -e "s|@FLAVOUR@|${LB_LINUX_FLAVOUR}|g" \
-e "s|@KERNEL@|/live/vmlinuz|g" \
-e "s|@INITRD@|/live/initrd.img|g" \
-e "s|@KERNEL@|/casper/vmlinuz|g" \
-e "s|@INITRD@|/casper/initrd.img|g" \
-e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
-e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
"${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
@ -235,12 +248,12 @@ then
do
_NUMBER="$((${_NUMBER} + 1))"
mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER}
mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img
mv binary/casper/vmlinuz-*-${_FLAVOUR} binary/casper/vmlinuz${_NUMBER}
mv binary/casper/initrd.img-*-${_FLAVOUR} binary/casper/initrd${_NUMBER}.img
sed -e "s|@FLAVOUR@|${_FLAVOUR}|g" \
-e "s|@KERNEL@|/live/vmlinuz${_NUMBER}|g" \
-e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \
-e "s|@KERNEL@|/casper/vmlinuz${_NUMBER}|g" \
-e "s|@INITRD@|/casper/initrd${_NUMBER}.img|g" \
-e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
-e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
"${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg"
@ -289,6 +302,16 @@ then
fi
;;
kylin)
_PROJECT="Kylin Linux"
_DESCRIPTION=""
;;
openkylin)
_PROJECT="openKylin Linux"
_DESCRIPTION=""
;;
*)
_PROJECT="Debian GNU/Linux"
_DESCRIPTION=""
@ -334,13 +357,13 @@ then
case "${LB_BUILD_WITH_CHROOT}" in
true)
cp "${_TARGET}/splash.svg" chroot
Chroot chroot "rsvg --format png --height 480 --width 640 splash.svg splash.png"
Chroot chroot "rsvg-convert --format png --height 480 --width 640 splash.svg -o splash.png"
mv chroot/splash.png "${_TARGET}"
rm -f chroot/splash.svg
;;
false)
rsvg --format png --height 480 --width 640 "${_TARGET}/splash.svg" "${_TARGET}/splash.png"
rsvg-convert --format png --height 480 --width 640 "${_TARGET}/splash.svg" -o "${_TARGET}/splash.png"
;;
esac
@ -362,7 +385,10 @@ esac
# Hack around the removal of support in gfxboot for reading from outside
# the bootlogo archive. This makes customisation harder and is not ideal.
tmpdir="$(mktemp -d)"
if [ -e "${_TARGET}/bootlogo" ]
then
(cd "$tmpdir" && cpio -i) < ${_TARGET}/bootlogo
fi
cp -a -f ${_TARGET}/*.fnt \
${_TARGET}/*.hlp \
${_TARGET}/*.jpg \

View File

@ -61,6 +61,10 @@ case "${LB_BINARY_IMAGES}" in
_IMAGES="binary.hybrid.iso"
;;
iso-xorr)
_IMAGES="binary.xorr.iso"
;;
hdd)
_IMAGES="binary.img"
;;

View File

@ -52,9 +52,6 @@ Create_lockfile .lock
# Creating chroot directory
mkdir -p chroot
# Temporarily including bzip2 manually until #657560 has been fixed in unstable
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=bzip2"
# Setting debootstrap options
if [ -n "${LB_ARCHITECTURES}" ]
then

View File

@ -74,6 +74,7 @@ do
done
lb chroot_live-packages ${*}
lb chroot_snap ${*}
lb chroot_includes ${*}
lb chroot_hooks ${*}
lb chroot_hacks ${*}

View File

@ -131,7 +131,7 @@ case "${1}" in
case "${1}" in
install)
# Ensure local packages have priority
echo "Pin-Priority: 1001" >> chroot/etc/apt/preferences
echo "Pin-Priority: 2000" >> chroot/etc/apt/preferences
;;
install-binary)

View File

@ -131,7 +131,7 @@ EOF
fi
;;
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
@ -697,7 +697,7 @@ EOF
fi
;;
ubuntu|kubuntu)
ubuntu|kubuntu|kylin|openkylin)
echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE}
if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ]
@ -879,6 +879,15 @@ EOF
mkdir -p chroot/var/lib/apt/lists/partial
fi
# Remove non-release pocket lists
case "${LB_MODE}" in
ubuntu|kylin|openkylin)
rm -f chroot/var/lib/apt/lists/*-updates_*
rm -f chroot/var/lib/apt/lists/*-security_*
rm -f chroot/var/lib/apt/lists/*-proposed_*
;;
esac
# Remove local package repository
rm -f chroot/etc/apt/sources.list.d/packages.list
rm -rf chroot/root/packages

View File

@ -182,15 +182,23 @@ case "${SUBPROJECT}" in
;;
esac
if [ "${LB_INITRAMFS}" != "none" ]
then
if [ -n "${LB_INITRAMFS_COMPRESSION}" ]; then
echo "COMPRESS=${LB_INITRAMFS_COMPRESSION}" \
> chroot/etc/initramfs-tools/conf.d/live-build.conf
fi
Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
rm -f chroot//etc/initramfs-tools/conf.d/live-build.conf
fi
ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')"
case $ARCHITECTURE in
'sw64'|'sw_64')
;;
*)
if [ "${LB_INITRAMFS}" != "none" ]
then
if [ -n "${LB_INITRAMFS_COMPRESSION}" ]; then
echo "COMPRESS=${LB_INITRAMFS_COMPRESSION}" \
> chroot/etc/initramfs-tools/conf.d/live-build.conf
fi
Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
rm -f chroot//etc/initramfs-tools/conf.d/live-build.conf
fi
;;
esac
# Ensure readable permissions on initramfs. loop-aes-utils sets umask to
# protect GPG keys, which live-build does not support.
@ -206,7 +214,6 @@ rm -f chroot/etc/gshadow- chroot/etc/shadow-
rm -f chroot/var/cache/debconf/*-old
rm -f chroot/var/lib/dpkg/*-old
rm -f chroot/var/log/apt/term.log
rm -f chroot/etc/adjtime
# Delete and re-create temporary directories
TEMP_DIRS="/tmp /var/tmp"

373
scripts/build/lb_chroot_snap Executable file
View File

@ -0,0 +1,373 @@
#!/bin/sh
set -e
# Including common functions
( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
# Setting static variables
DESCRIPTION="$(Echo 'queue install of snap lists into chroot')"
HELP=""
USAGE="${PROGRAM}"
Arguments "${@}"
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
Set_defaults
Echo_message "Begin queueing pre installation of snap lists..."
# Requiring stage file
Require_stagefile .build/config .build/bootstrap
# Checking stage file
Check_stagefile .build/chroot_snap
_snap_post_process() {
# Look for the 'core' snap. If it is not present, assume that the image
# contains only snaps with bases >= core18. In that case snapd is
# preseeded. However, when 'core' is being installed and snapd has not
# been installed by a call to 'snap_preseed' (see below) then it is
# removed again.
local CHROOT_ROOT=$1
local SNAP_NAME=$2
local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
local snaps_dir="$seed_dir/snaps"
local seed_yaml="$seed_dir/seed.yaml"
local assertions_dir="$seed_dir/assertions"
local snapd_install_stamp="$seed_dir/.snapd-explicit-install-stamp"
case $SNAP_NAME in
core[0-9]*)
# If the 'core' snap is not present, assume we are coreXX-only and
# install the snapd snap.
if [ ! -f ${snaps_dir}/core_[0-9]*.snap ]; then
_snap_preseed $CHROOT_ROOT snapd stable
fi
;;
core)
# If the snapd snap has been seeded, but not marked as explicitly
# installed (see snap_preseed below), then remove it.
if [ -f ${snaps_dir}/snapd_[0-9]*.snap ] && \
[ ! -f "$snapd_install_stamp" ]
then
# Remove snap, assertions and entry in seed.yaml
rm -f ${snaps_dir}/snapd_[0-9]*.snap
rm -f ${assertions_dir}/snapd_[0-9]*.assert
sed -i -e'N;/name: snapd/,+2d' $seed_yaml
fi
;;
*)
# ignore
;;
esac
}
_snap_preseed() {
# Download the snap/assertion and add to the preseed
local CHROOT_ROOT=$1
local SNAP=$2
local SNAP_NAME=${SNAP%/*}
local CHANNEL=${3:?Snap channel must be specified}
local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
local snaps_dir="$seed_dir/snaps"
local seed_yaml="$seed_dir/seed.yaml"
local assertions_dir="$seed_dir/assertions"
# Download the snap & assertion
local snap_download_failed=0
# Preseed a snap only once
if [ -f ${snaps_dir}/${SNAP_NAME}_[0-9]*.snap ]; then
return
fi
sh -c "
set -x;
cd \"$CHROOT_ROOT/var/lib/snapd/seed\";
UBUNTU_STORE_ARCH=${ARCH:-} SNAPPY_STORE_NO_CDN=1 snap download \
--cohort="${COHORT_KEY:-}" \
--channel=\"$CHANNEL\" \"$SNAP_NAME\"" || snap_download_failed=1
if [ $snap_download_failed = 1 ] ; then
echo "If the channel ($CHANNEL) includes '*/ubuntu-##.##' track per "
echo "Ubuntu policy (ex. stable/ubuntu-18.04) the publisher will need "
echo "to temporarily create the channel/track to allow fallback during"
echo "download (ex. stable/ubuntu-18.04 falls back to stable if the"
echo "prior had been created in the past)."
exit 1
fi
mv -v $seed_dir/*.assert $assertions_dir
mv -v $seed_dir/*.snap $snaps_dir
# Pre-seed snap's base
case $SNAP_NAME in
snapd)
# snapd is self-contained, ignore base
;;
core|core[0-9][0-9])
# core and core## are self-contained, ignore base
;;
*)
# Determine which core snap is needed
local snap_info
# snap info doesn't have --channel, so must run agains the downloaded snap
snap_info=$(snap info --verbose ${snaps_dir}/${SNAP_NAME}_[0-9]*.snap)
if [ $? -ne 0 ]; then
echo "Failed to retrieve base of $SNAP_NAME!"
exit 1
fi
local snap_type=$(echo "$snap_info" | awk '/^type:/ { print $2 }')
if [ "$snap_type" != base ]; then
local core_snap=$(echo "$snap_info" | awk '/^base:/ {print $2}')
# If snap info does not list a base the default is 'core'
# which is now an error to use.
if [ -z "$core_snap" ]; then
if [ -z "$ALLOW_CORE_SNAP" ]; then
echo "Legacy snap with no base declaration found, refusing to install 'core' snap"
exit 1
else
echo "Legacy snap with no base declaration found, but \$ALLOW_CORE_SNAP set. continue (but FIX YOUR SNAPS!)"
core_snap=${core_snap:-core}
fi
fi
_snap_preseed $CHROOT_ROOT $core_snap stable
fi
;;
esac
# Add the snap to the seed.yaml
! [ -e $seed_yaml ] && echo "snaps:" > $seed_yaml
cat <<EOF >> $seed_yaml
-
name: ${SNAP_NAME}
channel: ${CHANNEL}
EOF
case ${SNAP} in */classic) echo " classic: true" >> $seed_yaml;; esac
echo -n " file: " >> $seed_yaml
(cd $snaps_dir; ls -1 ${SNAP_NAME}_*.snap) >> $seed_yaml
_snap_post_process $CHROOT_ROOT $SNAP_NAME
}
snap_prepare_assertions() {
# Configure basic snapd assertions
local CHROOT_ROOT=$1
# A colon-separated string of brand:model to be used for the image's model
# assertion
local CUSTOM_BRAND_MODEL=$2
local seed_dir="$CHROOT_ROOT/var/lib/snapd/seed"
local snaps_dir="$seed_dir/snaps"
local assertions_dir="$seed_dir/assertions"
local model_assertion="$assertions_dir/model"
local account_key_assertion="$assertions_dir/account-key"
local account_assertion="$assertions_dir/account"
local brand="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 1)"
local model="$(echo $CUSTOM_BRAND_MODEL | cut -d: -f 2)"
# Get existing model and brand assertions to compare with new parameters
# For customized images, snap_prepare_assertions is called several times
# with different brand or model. In this case we want to overwrite
# existing brand and models.
local override_model_branch="false"
if [ -e "$model_assertion" ] ; then
existing_model=$(awk '/^model: / {print $2}' $model_assertion)
existing_brand=$(awk '/^brand-id: / {print $2}' $model_assertion)
if [ "$existing_model" != "$model" ] || [ "$existing_brand" != "$brand" ]; then
override_model_branch="true"
fi
fi
# Exit if assertions dir exists and we didn't change model or brand
if [ -d "$assertions_dir" ] && [ "$override_model_branch" = "false" ]; then
return
fi
mkdir -p "$assertions_dir"
mkdir -p "$snaps_dir"
# Clear the assertions if they already exist
if [ -e "$model_assertion" ] ; then
echo "snap_prepare_assertions: replacing $existing_brand:$existing_model with $brand:$model"
rm "$model_assertion"
rm "$account_key_assertion"
rm "$account_assertion"
fi
if ! [ -e "$model_assertion" ] ; then
snap known --remote model series=16 \
model=$model brand-id=$brand \
> "$model_assertion"
fi
if ! [ -e "$account_key_assertion" ] ; then
local account_key=$(sed -n -e's/sign-key-sha3-384: //p' \
< "$model_assertion")
snap known --remote account-key \
public-key-sha3-384="$account_key" \
> "$account_key_assertion"
fi
if ! [ -e "$account_assertion" ] ; then
local account=$(sed -n -e's/account-id: //p' < "$account_key_assertion")
snap known --remote account account-id=$account \
> "$account_assertion"
fi
}
snap_prepare() {
# Configure basic snapd assertions and pre-seeds the 'core' snap
local CHROOT_ROOT=$1
# Optional. If set, should be a colon-separated string of brand:model to be
# used for the image's model assertion
local CUSTOM_BRAND_MODEL=${2:-generic:generic-classic}
snap_prepare_assertions "$CHROOT_ROOT" "$CUSTOM_BRAND_MODEL"
}
release_ver() {
# Return the release version number
distro-info --series="$LB_DISTRIBUTION" -r | awk '{ print $1 }'
}
snap_preseed() {
# Preseed a snap in the image (snap_prepare must be called once prior)
local CHROOT_ROOT=$1
# $2 can be in the form of snap_name/classic=track/risk/branch
local SNAP=$2
# strip CHANNEL specification
SNAP=${SNAP%=*}
# strip /classic confinement
local SNAP_NAME=${SNAP%/*}
# Seed from the specified channel (e.g. core18 latest/stable)
# Or Channel endcoded in the snap name (e.g. lxd=4.0/stable/ubuntu-20.04)
# Or Ubuntu policy default channel latest/stable/ubuntu-$(release_ver)
local CHANNEL=${3:-}
if [ -z "$CHANNEL" ]; then
case $2 in
*=*)
CHANNEL=${2#*=}
;;
*)
CHANNEL="stable/ubuntu-$(release_ver)"
;;
esac
fi
# At this point:
# SNAP_NAME is just the snap name
# SNAP is either $SNAP_NAME or $SNAP_NAME/classic for classic confined
# CHANNEL is the channel
if [ ! -e "$CHROOT_ROOT/var/lib/snapd/seed/assertions/model" ]; then
echo "ERROR: Snap model assertion not present, snap_prepare must be called"
exit 1
fi
_snap_preseed $CHROOT_ROOT $SNAP $CHANNEL
# Mark this image as having snapd installed explicitly.
case $SNAP_NAME in
snapd)
touch "$CHROOT_ROOT/var/lib/snapd/seed/.snapd-explicit-install-stamp"
;;
esac
# Do basic validation of generated snapd seed.yaml, doing it here
# means we catch all the places(tm) that snaps are added but the
# downside is that each time a snap is added the seed must be valid,
# i.e. snaps with bases need to add bases first etc
#
# Skip validation by setting SNAP_NO_VALIDATE_SEED=1.
if [ -z "${SNAP_NO_VALIDATE_SEED:-}" ]; then
snap_validate_seed "${CHROOT_ROOT}"
fi
}
snap_validate_seed() {
local CHROOT_ROOT=$1
if [ -e "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml" ]; then
snap debug validate-seed "${CHROOT_ROOT}/var/lib/snapd/seed/seed.yaml"
/usr/lib/snapd/snap-preseed --reset $(realpath "${CHROOT_ROOT}")
/usr/lib/snapd/snap-preseed $(realpath "${CHROOT_ROOT}")
chroot "${CHROOT_ROOT}" apparmor_parser --skip-read-cache --write-cache --skip-kernel-load --verbose -j `nproc` /etc/apparmor.d
fi
}
setup_mountpoint() {
local mountpoint="$1"
if [ ! -c /dev/mem ]; then
mknod -m 660 /dev/mem c 1 1
chown root:kmem /dev/mem
fi
mount --bind /dev "$mountpoint/dev"
# mount proc-live -t proc "$mountpoint/proc"
# mount sysfs-live -t sysfs "$mountpoint/sys"
mount securityfs -t securityfs "$mountpoint/sys/kernel/security"
# Provide more up to date apparmor features, matching target kernel
# mount -o bind /usr/share/livecd-rootfs/live-build/apparmor/generic "$mountpoint/sys/kernel/security/apparmor/features/"
# mount -o bind /usr/share/livecd-rootfs/live-build/seccomp/generic.actions_avail "$mountpoint/proc/sys/kernel/seccomp/actions_avail"
# cgroup2 mount for LP: 1944004
mount -t cgroup2 none "$mountpoint/sys/fs/cgroup"
# mount -t tmpfs none "$mountpoint/tmp"
# mv "$mountpoint/etc/resolv.conf" resolv.conf.tmp
# cp /etc/resolv.conf "$mountpoint/etc/resolv.conf"
# mv "$mountpoint/etc/nsswitch.conf" nsswitch.conf.tmp
# sed 's/systemd//g' nsswitch.conf.tmp > "$mountpoint/etc/nsswitch.conf"
}
teardown_mountpoint() {
# Reverse the operations from setup_mountpoint
local mountpoint=$(realpath "$1")
for submount in sys/fs/cgroup sys/kernel/security dev; do
mount --make-private $mountpoint/$submount
umount $mountpoint/$submount
done
# # ensure we have exactly one trailing slash, and escape all slashes for awk
# mountpoint_match=$(echo "$mountpoint" | sed -e's,/$,,; s,/,\\/,g;')'\/'
# # sort -r ensures that deeper mountpoints are unmounted first
# for submount in $(awk </proc/self/mounts "\$2 ~ /$mountpoint_match/ \
# { print \$2 }" | LC_ALL=C sort -r); do
# mount --make-private $submount
# umount $submount
# done
# mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
# mv nsswitch.conf.tmp "$mountpoint/etc/nsswitch.conf"
}
preinstall_snaps() {
setup_mountpoint chroot
snap_prepare chroot
for snap in "$@"; do
SNAP_NO_VALIDATE_SEED=1 snap_preseed chroot "${snap}"
done
snap_validate_seed chroot
teardown_mountpoint chroot
}
if [ -e "config/seeded-snaps" ]; then
snap_list=$(cat config/seeded-snaps)
preinstall_snaps $snap_list
Create_stagefile .build/chroot_snap
fi

View File

@ -27,7 +27,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--apt-secure true|false]\n\
\t [--apt-source-archives true|false]\n\
\t [-a|--architectures ARCHITECTURE]\n\
\t [-b|--binary-images iso|iso-hybrid|netboot|tar|hdd]\n\
\t [-b|--binary-images iso|iso-hybrid|iso-xorr|netboot|tar|hdd]\n\
\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\
\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\
\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\
@ -107,6 +107,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--mirror-binary-backports URL]\n\
\t [--mirror-debian-installer URL]\n\
\t [--mode debian|emdebian|ubuntu|kubuntu]\n\
\t [--strip-pool]\n\
\t [--system live|normal]\n\
\t [--net-root-filesystem nfs|cfs]\n\
\t [--net-root-mountoptions OPTIONS]\n\
@ -164,7 +165,7 @@ Local_arguments ()
net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
net-cow-server:,net-tarball:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:,syslinux-theme:,
win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force,
help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
help,ignore-system-defaults,strip-pool,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
bootstrap-qemu-exclude:"
# Remove spaces added by indentation
LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
@ -801,6 +802,11 @@ Local_arguments ()
shift 2
;;
--strip-pool)
LB_STRIP_POOL="true"
shift
;;
# config/source
--source)
LB_SOURCE="${2}"
@ -1107,6 +1113,7 @@ APT_OPTIONS="${APT_OPTIONS}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS}"
GZIP_OPTIONS="${GZIP_OPTIONS}"
ISOHYBRID_OPTIONS="${ISOHYBRID_OPTIONS}"
GENISOIMAGE_OPTIONS_EXTRA="${GENISOIMAGE_OPTIONS_EXTRA}"
EOF
# Creating lb_bootstrap_* configuration
@ -1489,6 +1496,10 @@ LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}"
# \$LB_SYSLINUX_THEME: set syslinux theme package
# (Default: ${LB_SYSLINUX_THEME})
LB_SYSLINUX_THEME="${LB_SYSLINUX_THEME}"
# \$LB_STRIP_POOL: don't include installed deb packages from pool/
# (Default: ${LB_STRIP_POOL})
LB_STRIP_POOL=${LB_STRIP_POOL}
EOF
# Creating lb_source_* configuration

View File

@ -78,6 +78,18 @@ case "${LB_MODE}" in
TRACE="project/trace/archive-master.progress-linux.org"
;;
kylin)
TITLE="Kylin"
STRING="Build ${ARCHITECTURE}"
TRACE=""
;;
openkylin)
TITLE="openKylin"
STRING="Build ${ARCHITECTURE}"
TRACE=""
;;
*)
TITLE="Debian GNU/Linux"
STRING="Snapshot ${ARCHITECTURE}"

32
share/bin/get-udeb Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
cd /root
APTDIR="`pwd`/udeb_tmp"
APT_OPTIONS=$*
rm -rf ${APTDIR}
mkdir -p $APTDIR/state/lists/partial
mkdir -p $APTDIR/state/mirrors/partial
mkdir -p $APTDIR/cache/archives/partial
echo -n > $APTDIR/state/status
APT_GET="apt-get --assume-yes \
-o Dir::State=$APTDIR/state \
-o Debug::NoLocking=false \
-o Debug::pkgDepCache::AutoInstall=true \
-o Dir::Cache=$APTDIR/cache \
-o Acquire::Retries=3 \
-o Dir::State::Status=$APTDIR/state/status \
$APT_OPTIONS \
"
set -e
${APT_GET} update
cat *.list.udeb | grep -v '^#' | xargs ${APT_GET} install -dy
# move
rm -rf binary.udeb
mkdir binary.udeb
mv $APTDIR/cache/archives/*.udeb binary.udeb
rm -rf $APTDIR

View File

@ -1,7 +1,5 @@
#!/bin/sh
set -e
# Update the Apt Xapian index.
#
# The package would do this itself, but (a) it checks policy-rc.d which says it
@ -11,4 +9,5 @@ set -e
if [ -x /usr/sbin/update-apt-xapian-index ]
then
PYTHONDONTWRITEBYTECODE=1 /usr/sbin/update-apt-xapian-index --force --quiet
exit 0
fi

View File

@ -1,9 +1,16 @@
set default=0
set timeout=3
insmod tga
background_image ($root)/boot/grub/xbmc.tga
set color_normal=cyan/blue
set color_highlight=white/blue
set color_normal=white/black
set color_highlight=black/light-gray
if loadfont /boot/grub/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
LINUX_LIVE