mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-09 01:41:31 +00:00
Moved reusable functions to functions
Moved functions to reuse in lb_binary and lb_chroot to functions
This commit is contained in:
parent
693e0a7360
commit
43ec452fa0
@ -311,6 +311,10 @@ EOF
|
|||||||
lb chroot "$@"
|
lb chroot "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Let all configuration non multi-layered project here.
|
||||||
|
# If those are moving to a multi-layer layout, this needs to be
|
||||||
|
# done in chroot hooks.
|
||||||
|
if [ -z "$PASSES" ]; then
|
||||||
if [ "${SUBPROJECT:-}" = minimized ]; then
|
if [ "${SUBPROJECT:-}" = minimized ]; then
|
||||||
# force removal of initramfs-tools, which we assert is not
|
# force removal of initramfs-tools, which we assert is not
|
||||||
# required for any minimized images but is still pulled in by
|
# required for any minimized images but is still pulled in by
|
||||||
@ -335,9 +339,8 @@ EOF
|
|||||||
apt-get -y --purge autoremove"
|
apt-get -y --purge autoremove"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove crufty files that shouldn't be left in an image
|
clean_debian_chroot
|
||||||
rm -f chroot/var/cache/debconf/*-old chroot/var/lib/dpkg/*-old
|
|
||||||
Chroot chroot apt clean
|
|
||||||
if [ "${PROJECT}:${SUBPROJECT:-}" = "ubuntu-base:minimized" ]; then
|
if [ "${PROJECT}:${SUBPROJECT:-}" = "ubuntu-base:minimized" ]; then
|
||||||
# Save even more size by removing apt lists (that are currently removed
|
# Save even more size by removing apt lists (that are currently removed
|
||||||
# downstream anyway)
|
# downstream anyway)
|
||||||
@ -349,65 +352,8 @@ EOF
|
|||||||
rm -rf chroot/dev/*
|
rm -rf chroot/dev/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f config/universe-enabled ]; then
|
configure_universe
|
||||||
|
|
||||||
# This is cargo-culted almost verbatim (with some syntax changes for
|
|
||||||
# preinstalled being slightly different in what it doesn't ask) from
|
|
||||||
# debian-installer's apt-setup:
|
|
||||||
|
|
||||||
cat > chroot/etc/apt/sources.list << EOF
|
|
||||||
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
|
|
||||||
# newer versions of the distribution.
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted
|
|
||||||
|
|
||||||
## Major bug fix updates produced after the final release of the
|
|
||||||
## distribution.
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted
|
|
||||||
|
|
||||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
|
||||||
## team. Also, please note that software in universe WILL NOT receive any
|
|
||||||
## review or updates from the Ubuntu security team.
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe
|
|
||||||
|
|
||||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
|
||||||
## team, and may not be under a free licence. Please satisfy yourself as to
|
|
||||||
## your rights to use the software. Also, please note that software in
|
|
||||||
## multiverse WILL NOT receive any review or updates from the Ubuntu
|
|
||||||
## security team.
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse
|
|
||||||
|
|
||||||
## N.B. software from this repository may not have been tested as
|
|
||||||
## extensively as that contained in the main release, although it includes
|
|
||||||
## newer versions of some applications which may provide useful features.
|
|
||||||
## Also, please note that software in backports WILL NOT receive any review
|
|
||||||
## or updates from the Ubuntu security team.
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse
|
|
||||||
|
|
||||||
## Uncomment the following two lines to add software from Canonical's
|
|
||||||
## 'partner' repository.
|
|
||||||
## This software is not part of Ubuntu, but is offered by Canonical and the
|
|
||||||
## respective vendors as a service to Ubuntu users.
|
|
||||||
# deb http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner
|
|
||||||
# deb-src http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner
|
|
||||||
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security main restricted
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security main restricted
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security universe
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security universe
|
|
||||||
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security multiverse
|
|
||||||
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security multiverse
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fi
|
|
||||||
if [ -d chroot/var/lib/preinstalled-pool ]; then
|
if [ -d chroot/var/lib/preinstalled-pool ]; then
|
||||||
cat > config/indices/apt.conf <<-EOF
|
cat > config/indices/apt.conf <<-EOF
|
||||||
Dir {
|
Dir {
|
||||||
@ -504,22 +450,7 @@ serial: $BUILDSTAMP
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the image pre-installs network-manager, let it manage all devices by
|
configure_network_manager
|
||||||
# default. Installing NM on an existing system only manages wifi and wwan via
|
|
||||||
# /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf. When setting
|
|
||||||
# the global backend to NM, netplan overrides that file.
|
|
||||||
if [ -e chroot/usr/sbin/NetworkManager ]; then
|
|
||||||
echo "===== Enabling all devices in NetworkManager ===="
|
|
||||||
mkdir -p chroot/etc/netplan
|
|
||||||
cat <<EOF > chroot/etc/netplan/01-network-manager-all.yaml
|
|
||||||
# Let NetworkManager manage all devices on this system
|
|
||||||
network:
|
|
||||||
version: 2
|
|
||||||
renderer: NetworkManager
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
echo "==== NetworkManager not installed ===="
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "===== Checking size of /usr/share/doc ====="
|
echo "===== Checking size of /usr/share/doc ====="
|
||||||
echo BEGIN docdirs
|
echo BEGIN docdirs
|
||||||
@ -527,6 +458,7 @@ EOF
|
|||||||
echo END docdirs
|
echo END docdirs
|
||||||
|
|
||||||
/usr/share/livecd-rootfs/minimize-manual chroot
|
/usr/share/livecd-rootfs/minimize-manual chroot
|
||||||
|
fi
|
||||||
|
|
||||||
lb binary "$@"
|
lb binary "$@"
|
||||||
|
|
||||||
|
@ -607,3 +607,89 @@ substract_package_lists() {
|
|||||||
rm list1
|
rm list1
|
||||||
rm list2
|
rm list2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_debian_chroot() {
|
||||||
|
# remove crufty files that shouldn't be left in an image
|
||||||
|
rm -f chroot/var/cache/debconf/*-old chroot/var/lib/dpkg/*-old
|
||||||
|
Chroot chroot apt clean
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_universe() {
|
||||||
|
if [ -f config/universe-enabled ]; then
|
||||||
|
# This is cargo-culted almost verbatim (with some syntax changes for
|
||||||
|
# preinstalled being slightly different in what it doesn't ask) from
|
||||||
|
# debian-installer's apt-setup:
|
||||||
|
|
||||||
|
cat > chroot/etc/apt/sources.list << EOF
|
||||||
|
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
|
||||||
|
# newer versions of the distribution.
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION main restricted
|
||||||
|
|
||||||
|
## Major bug fix updates produced after the final release of the
|
||||||
|
## distribution.
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates main restricted
|
||||||
|
|
||||||
|
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||||
|
## team. Also, please note that software in universe WILL NOT receive any
|
||||||
|
## review or updates from the Ubuntu security team.
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION universe
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates universe
|
||||||
|
|
||||||
|
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||||
|
## team, and may not be under a free licence. Please satisfy yourself as to
|
||||||
|
## your rights to use the software. Also, please note that software in
|
||||||
|
## multiverse WILL NOT receive any review or updates from the Ubuntu
|
||||||
|
## security team.
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION multiverse
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-updates multiverse
|
||||||
|
|
||||||
|
## N.B. software from this repository may not have been tested as
|
||||||
|
## extensively as that contained in the main release, although it includes
|
||||||
|
## newer versions of some applications which may provide useful features.
|
||||||
|
## Also, please note that software in backports WILL NOT receive any review
|
||||||
|
## or updates from the Ubuntu security team.
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY $LB_DISTRIBUTION-backports main restricted universe multiverse
|
||||||
|
|
||||||
|
## Uncomment the following two lines to add software from Canonical's
|
||||||
|
## 'partner' repository.
|
||||||
|
## This software is not part of Ubuntu, but is offered by Canonical and the
|
||||||
|
## respective vendors as a service to Ubuntu users.
|
||||||
|
# deb http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner
|
||||||
|
# deb-src http://archive.canonical.com/ubuntu $LB_DISTRIBUTION partner
|
||||||
|
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security main restricted
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security main restricted
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security universe
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security universe
|
||||||
|
deb $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security multiverse
|
||||||
|
# deb-src $LB_PARENT_MIRROR_BINARY_SECURITY $LB_DISTRIBUTION-security multiverse
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_network_manager() {
|
||||||
|
# If the image pre-installs network-manager, let it manage all devices by
|
||||||
|
# default. Installing NM on an existing system only manages wifi and wwan via
|
||||||
|
# /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf. When setting
|
||||||
|
# the global backend to NM, netplan overrides that file.
|
||||||
|
if [ -e chroot/usr/sbin/NetworkManager ]; then
|
||||||
|
echo "===== Enabling all devices in NetworkManager ===="
|
||||||
|
mkdir -p chroot/etc/netplan
|
||||||
|
cat <<EOF > chroot/etc/netplan/01-network-manager-all.yaml
|
||||||
|
# Let NetworkManager manage all devices on this system
|
||||||
|
network:
|
||||||
|
version: 2
|
||||||
|
renderer: NetworkManager
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "==== NetworkManager not installed ===="
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user