summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:23 +0200
committerDaniel Baumann <daniel@debian.org>2007-09-23 10:04:23 +0200
commit873a8ac3d1221f47f695c8d89a63370296afffda (patch)
treed5ee5d0327d701406a8ffa9f00ac3ed04452c08b /src/scripts
parent4a992637066b9cb25b57b9122707e5e5ecfcaf0d (diff)
downloadvyos-live-build-873a8ac3d1221f47f695c8d89a63370296afffda.tar.gz
vyos-live-build-873a8ac3d1221f47f695c8d89a63370296afffda.zip
Adding live-package 0.99.8-1.
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/02defaults.sh2
-rw-r--r--src/scripts/12patch.sh56
-rw-r--r--src/scripts/14chroot.sh31
-rw-r--r--src/scripts/21image.sh24
-rw-r--r--src/scripts/22iso.sh65
-rw-r--r--src/scripts/23net.sh67
6 files changed, 204 insertions, 41 deletions
diff --git a/src/scripts/02defaults.sh b/src/scripts/02defaults.sh
index fd58883ee..d23c02135 100644
--- a/src/scripts/02defaults.sh
+++ b/src/scripts/02defaults.sh
@@ -219,7 +219,7 @@ Defaults ()
fi
# Set package indices
- if [ -z "${LIVE_GENERIC_INDICES}" ]
+ if [ -z "${LIVE_GENERIC_INDICES}" ] && [ "${LIVE_FLAVOUR}" != "minimal" ]
then
LIVE_GENERIC_INDICES="yes"
fi
diff --git a/src/scripts/12patch.sh b/src/scripts/12patch.sh
index 873865c36..7f072412f 100644
--- a/src/scripts/12patch.sh
+++ b/src/scripts/12patch.sh
@@ -58,16 +58,25 @@ Patch_network ()
case "${1}" in
apply)
- # Save host lookup table
- if [ -f "${LIVE_CHROOT}"/etc/hosts ]
+ # Save apt configuration
+ if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf ]
then
- cp "${LIVE_CHROOT}"/etc/hosts "${LIVE_CHROOT}"/etc/hosts.orig
+ cp "${LIVE_CHROOT}"/etc/apt/apt.conf "${LIVE_CHROOT}"/etc/apt/apt.conf.orig
fi
- # Save resolver configuration
- if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
+ # Configure apt.conf
+ if [ -n "${LIVE_PROXY_FTP}" ]
then
- cp "${LIVE_CHROOT}"/etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf.orig
+ echo "Acquire::ftp::Proxy \"${LIVE_PROXY_FTP}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ elif [ -n "${LIVE_PROXY_HTTP}" ]
+ then
+ echo "Acquire::http::Proxy \"${LIVE_PROXY_HTTP}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ fi
+
+ # Save host lookup table
+ if [ -f "${LIVE_CHROOT}"/etc/hosts ]
+ then
+ cp "${LIVE_CHROOT}"/etc/hosts "${LIVE_CHROOT}"/etc/hosts.orig
fi
# Copy host lookup table
@@ -76,6 +85,12 @@ Patch_network ()
cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts
fi
+ # Save resolver configuration
+ if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
+ then
+ cp "${LIVE_CHROOT}"/etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf.orig
+ fi
+
# Copy resolver configuration
if [ -f /etc/resolv.conf ]
then
@@ -84,16 +99,28 @@ Patch_network ()
;;
deapply)
+ # Restore apt configuration
+ if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.orig ]
+ then
+ mv "${LIVE_CHROOT}"/etc/apt/apt.conf.orig "${LIVE_CHROOT}"/etc/apt/apt.conf
+ else
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf
+ fi
+
# Restore host lookup table
if [ -f "${LIVE_CHROOT}"/etc/hosts.orig ]
then
mv "${LIVE_CHROOT}"/etc/hosts.orig "${LIVE_CHROOT}"/etc/hosts
+ else
+ rm -f "${LIVE_CHROOT}"/etc/hosts
fi
# Restore resolver configuration
if [ -f "${LIVE_CHROOT}"/etc/resolv.conf.orig ]
then
mv "${LIVE_CHROOT}"/etc/resolv.conf.orig "${LIVE_CHROOT}"/etc/resolv.conf
+ else
+ rm -f "${LIVE_CHROOT}"/etc/resolv.conf
fi
;;
esac
@@ -107,13 +134,24 @@ Patch_linux ()
case "${1}" in
apply)
- # Write configuration option
+ # Save kernel configuration
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf ]
+ then
+ cp "${LIVE_CHROOT}"/etc/kernel-img.conf "${LIVE_CHROOT}"/etc/kernel-img.conf.old
+ fi
+
+ # Configure kernel-img.conf
echo "do_initrd = Yes" >> "${LIVE_CHROOT}"/etc/kernel-img.conf
;;
deapply)
- # Remove configuration file
- rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
+ # Restore kernel configuration
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf.old ]
+ then
+ mv "${LIVE_CHROOT}"/etc/kernel-img.conf.old "${LIVE_CHROOT}"/etc/kernel-img.conf
+ else
+ rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
+ fi
;;
esac
}
diff --git a/src/scripts/14chroot.sh b/src/scripts/14chroot.sh
index 918e09a9e..356c1a2ec 100644
--- a/src/scripts/14chroot.sh
+++ b/src/scripts/14chroot.sh
@@ -33,7 +33,10 @@ Chroot ()
# Install secure apt
if [ "${LIVE_DISTRIBUTION}" = "testing" ] || [ "${LIVE_DISTRIBUTION}" = "unstable" ]
then
- Chroot_exec "apt-get install --yes --force-yes debian-archive-keyring"
+ if [ "${LIVE_FLAVOUR}" != "minimal" ]
+ then
+ Chroot_exec "apt-get install --yes --force-yes debian-archive-keyring"
+ fi
fi
# Update indices
@@ -43,7 +46,7 @@ Chroot ()
Patch_linux apply
# Install linux-image, modules and casper
- Chroot_exec "apt-get install --yes linux-image-2.6-${LIVE_KERNEL} squashfs-modules-2.6-${LIVE_KERNEL} unionfs-modules-2.6-${LIVE_KERNEL} casper"
+ Chroot_exec "apt-get install --yes --force-yes linux-image-2.6-${LIVE_KERNEL} squashfs-modules-2.6-${LIVE_KERNEL} unionfs-modules-2.6-${LIVE_KERNEL} casper"
# Deconfigure linux-image
Patch_linux deapply
@@ -52,14 +55,14 @@ Chroot ()
if [ -n "${LIVE_PACKAGE_LIST}" ]
then
grep -v "^#" "${LIVE_PACKAGE_LIST}" > "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
- Chroot_exec "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST}` apt-get install --yes"
+ Chroot_exec "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST}` apt-get install --yes --force-yes"
rm -f "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
fi
# Install extra packages
if [ -n "${LIVE_PACKAGES}" ]
then
- Chroot_exec "apt-get install --yes ${LIVE_PACKAGES}"
+ Chroot_exec "apt-get install --yes --force-yes ${LIVE_PACKAGES}"
fi
# Copy external directory into the chroot
@@ -70,6 +73,14 @@ Chroot ()
cd "${OLDPWD}"
fi
+ # Process flavour specific hooks
+ if [ -r "${BASE}"/hooks/"${LIVE_FLAVOUR}" ]
+ then
+ grep -v "^#" "${BASE}"/hooks/"${LIVE_FLAVOUR}" > "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
+ Chroot_exec "sh /root/${LIVE_FLAVOUR}"
+ rm -f "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
+ fi
+
# Execute extra command in the chroot
if [ -r "${LIVE_HOOK}" ]
then
@@ -88,16 +99,16 @@ Chroot ()
if [ ! -z "${LIVE_MANIFEST}" ]
then
- Chroot_exec "apt-get install --yes ${LIVE_MANIFEST}"
+ Chroot_exec "apt-get install --yes --force-yes ${LIVE_MANIFEST}"
Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest-desktop
fi
- # Clean apt packages cache
- rm -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb
- rm -f "${LIVE_CHROOT}"/var/cache/apt/archives/partial/*.deb
+ # Remove unused packages
+ Chroot_exec "apt-get remove --purge --yes cdebootstrap-helper-diverts"
- # Clean apt indices cache
- rm -f "${LIVE_CHROOT}"/var/cache/apt/*pkgcache.bin
+ # Clean apt packages cache
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
# Remove cdebootstrap packages cache
rm -rf "${LIVE_CHROOT}"/var/cache/bootstrap
diff --git a/src/scripts/21image.sh b/src/scripts/21image.sh
index 930315cc0..7258b6af1 100644
--- a/src/scripts/21image.sh
+++ b/src/scripts/21image.sh
@@ -138,7 +138,7 @@ Syslinux ()
then
# Install syslinux
Patch_network apply
- Chroot_exec "apt-get install --yes syslinux"
+ Chroot_exec "apt-get install --yes --force-yes syslinux"
case "${1}" in
iso)
@@ -188,14 +188,26 @@ Linuximage ()
case "${1}" in
iso)
# Copy linux-image
- cp "${LIVE_CHROOT}"/boot/vmlinuz-* "${LIVE_ROOT}"/binary/isolinux/vmlinuz
- cp "${LIVE_CHROOT}"/boot/initrd.img-* "${LIVE_ROOT}"/binary/isolinux/initrd.gz
+ if [ "${LIVE_FLAVOUR}" = "minimal" ]
+ then
+ mv "${LIVE_CHROOT}"/boot/vmlinuz-* "${LIVE_ROOT}"/binary/isolinux/vmlinuz
+ mv "${LIVE_CHROOT}"/boot/initrd.img-* "${LIVE_ROOT}"/binary/isolinux/initrd.gz
+ else
+ cp "${LIVE_CHROOT}"/boot/vmlinuz-* "${LIVE_ROOT}"/binary/isolinux/vmlinuz
+ cp "${LIVE_CHROOT}"/boot/initrd.img-* "${LIVE_ROOT}"/binary/isolinux/initrd.gz
+ fi
;;
net)
# Copy linux-image
- cp "${LIVE_ROOT}"/chroot/boot/vmlinuz-* "${LIVE_ROOT}"/tftpboot/vmlinuz
- cp "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz
+ if [ "${LIVE_FLAVOUR}" = "minimal" ]
+ then
+ mv "${LIVE_ROOT}"/chroot/boot/vmlinuz-* "${LIVE_ROOT}"/tftpboot/vmlinuz
+ mv "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz
+ else
+ cp "${LIVE_ROOT}"/chroot/boot/vmlinuz-* "${LIVE_ROOT}"/tftpboot/vmlinuz
+ cp "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz
+ fi
;;
esac
}
@@ -206,7 +218,7 @@ Memtest ()
then
# Install memtest
Patch_network apply
- Chroot_exec "apt-get install --yes memtest86+"
+ Chroot_exec "apt-get install --yes --force-yes memtest86+"
case "$1" in
iso)
diff --git a/src/scripts/22iso.sh b/src/scripts/22iso.sh
index d990e2417..508876847 100644
--- a/src/scripts/22iso.sh
+++ b/src/scripts/22iso.sh
@@ -13,26 +13,56 @@ Iso ()
{
if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ]
then
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
mkdir -p "${LIVE_ROOT}"/binary/casper
- for manifest in "${LIVE_ROOT}"/filesystem.manifest*
+ for MANIFEST in "${LIVE_ROOT}"/filesystem.manifest*
do
- mv "${manifest}" "${LIVE_ROOT}"/binary/casper/
+ mv "${MANIFEST}" "${LIVE_ROOT}"/binary/casper/
done
+ # Remove indices
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
+ rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists
+ mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
+
# Switching package indices to default
if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
then
Indices default
fi
-
+
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Generating rootfs image
Genrootfs
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
+ # Remove indices
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
+ rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists
+ mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
+
# Switching package indices to custom
- if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
- then
- Indices custom
- fi
+ Indices custom
# Installing syslinux
Syslinux iso
@@ -43,6 +73,13 @@ Iso ()
# Installing memtest
Memtest iso
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Installing templates
if [ "${LIVE_FLAVOUR}" != "minimal" ]
then
@@ -62,9 +99,23 @@ Iso ()
if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ]
then
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
# Downloading sources
Sources
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Creating image
Mkisofs source
diff --git a/src/scripts/23net.sh b/src/scripts/23net.sh
index c4169ecdd..02869dd9b 100644
--- a/src/scripts/23net.sh
+++ b/src/scripts/23net.sh
@@ -13,16 +13,23 @@ Net ()
{
if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ]
then
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
mkdir -p "${LIVE_ROOT}"/binary/casper
cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary
- for manifest in "${LIVE_ROOT}"/filesystem.manifest*
+ for MANIFEST in "${LIVE_ROOT}"/filesystem.manifest*
do
- mv "${manifest}" "${LIVE_ROOT}"/binary/casper/
+ mv "${MANIFEST}" "${LIVE_ROOT}"/binary/casper/
done
# Installing smbfs
- Chroot_exec "apt-get install --yes smbfs"
+ Chroot_exec "apt-get install --yes --force-yes smbfs"
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
@@ -40,20 +47,43 @@ EOF
Chroot_exec "update-initramfs -tu"
fi
+ # Remove indices
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
+ rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists
+ mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
+
# Switching package indices to default
if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
then
Indices default
fi
-
+
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Generating rootfs image
Genrootfs
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
+ # Remove indices
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
+ rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists
+ mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
+
# Switching package indices to custom
- if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
- then
- Indices custom
- fi
+ Indices custom
# Installing syslinux
Syslinux net
@@ -64,6 +94,13 @@ EOF
# Installing memtest
Memtest net
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Creating tarball
cd "${LIVE_ROOT}" && \
mv binary "`basename ${LIVE_SERVER_PATH}`" && \
@@ -79,9 +116,23 @@ EOF
if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ]
then
+ # Configure chroot
+ Patch_chroot apply
+ Patch_runlevel apply
+
+ # Configure network
+ Patch_network apply
+
# Downloading sources
Sources
+ # Deconfigure network
+ Patch_network deapply
+
+ # Deconfigure chroot
+ Patch_runlevel deapply
+ Patch_chroot deapply
+
# Creating tarball
tar cfz source.tar.gz "${LIVE_ROOT}"/source