Permalink
Switch branches/tags
xlinux untagged-fc3b4e57fb78913ae8cf untagged-fbfc7c9d1fcb6b85664b untagged-f7672a8e7630a57fc7dd untagged-f991eeb8479a39a97f46 untagged-f891c7dc3c5229795410 untagged-f24c71a9f413aac14379 untagged-f8d86089a0cff6b365bc untagged-f6ba3f0efc76f0fbade1 untagged-f4ff58f869469d4fa019 untagged-f4efa58b22090aa15d28 untagged-f0bb56ae5a3a6aac585c untagged-ef2fd636a53f4d0268cb untagged-ef1db0730718e3c5b409 untagged-ec090eade53280435857 untagged-ec5d66b7f32c7c84ea2f untagged-eb1b481e94929155ecfb untagged-ea562913b05eaca76de8 untagged-ea0057e1c78fca0671a9 untagged-e337428be18400673be6 untagged-e59618dc3d4f847ef64d untagged-e971d8c8d321c8020b37 untagged-e42c17ffe32fc212fe2e untagged-e7b8d273fb43b0b5d4ba untagged-e6f7440d0ea02f69d730 untagged-e0eebfe62ffe70dc46b1 untagged-dfc392f811217ca080f0 untagged-ddff9871d6ce64f8015f untagged-dc118f785f3aef3f1931 untagged-d901ad5a3eb2764d9dba untagged-d45b1ff44344c76bdc66 untagged-d9e4bdae2b17afffec33 untagged-d9bde4d558f366501fdb untagged-d06c4c0c7336ed1a5627 untagged-d6bb204ca358e66ddc21 untagged-d5e2c6c033f70d784daa untagged-d2d24a29d354b9584184 untagged-d2c3d7386a7077f069cc untagged-d0c6dd4e745866e2b8cd untagged-ceb371622255d900d746 untagged-cb0716eb89be833817f8 untagged-cb7a0718b4ede25c8e41 untagged-ca738f17e2452ba2436b untagged-ca89ee0bb180bc6f6e19 untagged-c34172d14485d4562c5d untagged-c01252f230aa24c67d6c untagged-c924a69d12debe9b87e9 untagged-c383f82456d7ae13dc61 untagged-c9f68d2fa6b3d1cdbd99 untagged-c9c3672250b05fb2a368 untagged-c4ce5b88cf4c1f231995 untagged-c09465312927ca1df566 untagged-bfd6b432bb3d4b54104a untagged-bf7629974943c1a0dd2c untagged-bf632899bb44694fdcba untagged-bdf599bdde341689833e untagged-bd1005bc8c0941c5aa1f untagged-b702ca2caaec21ef49c4 untagged-b59e76c491d842193b00 untagged-b055ca44be9c84a5e832 untagged-b6ca7922991615282af1 untagged-b0bdd5c9b37fdcb4b158 untagged-af382b42357413ae502c untagged-aca74f8d626437a972ac untagged-ab1f7d5ecc590a802820 untagged-aad16586181ef7a87499 untagged-aa826effb032f92d11d7 untagged-a94f8fba43f289a7a700 untagged-a076db9c40f6c1e1d223 untagged-a76a08e81676508b9ef0 untagged-a30a37a6245b1fbae801 untagged-a9c41e36617cc36980fb untagged-a7b4b470724fb8f2dabb untagged-a6a33b65e9e332b99068 untagged-a1fbdd1b9d2c9367034a untagged-58270162303a4435efb7 untagged-0910134618cd496e35c5 untagged-94175521fba84cfbf0ea untagged-2334561c565ed80990a6 untagged-916180aa4894994b155c untagged-798935a935a09883dbce untagged-502724cac47061a9c6ef untagged-492306d63766738d5ab2 untagged-440940d17d6e03e8ce69 untagged-279789cb86e28e1c0249 untagged-85976ba9b9442e6d0e3c untagged-83860a0a79121f96b365 untagged-78575de7f5a30d3cd47b untagged-68874ccd56fa98cc639c untagged-61795d2bfb92e1c672f5 untagged-60475d519c62c6bc0c2f untagged-47926c1ccbcdf691120b untagged-10858c022d583d924224 untagged-9587c97b59c85186201c untagged-9403abae58a682f78f2e untagged-8878ade696a4063ece4a untagged-8289d7c53ff53f03d5f3 untagged-8088b9d40c390764dcc6 untagged-6486e79adde9f7183572 untagged-6341d78415c12fa04860
Nothing to show
Find file Copy path
230 lines (191 sloc) 8.17 KB
#!/bin/bash
# build.sh -- creates an Meilix LiveCD ISO
# Author: Team
# Based on HOWTO information by Julien Lavergne <gilir@ubuntu.com>
set -eu # Be strict
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
# Script parameters: arch mirror gnomelanguage release
# Arch to build ISO for, i386 or amd64
#arch=${1:-i386}
arch=${1:-amd64}
# Ubuntu mirror to use
mirror=${2:-"http://archive.ubuntu.com/ubuntu/"}
# Ubuntu release used as a base by debootstrap. Examples: lucid, maverick, natty.
# If you change the value here also adj́ust the sources.list file accordingly
release=${4:-xenial}
# Set of GNOME language packs to install.
# Use '\*' for all langs, 'en' for English.
# Install language with the most popcontt
gnomelanguage=${3:-'{en}'}
# Necessary data files
datafiles="image-${arch}.tar.lzma sources.list"
# Necessary development tool packages to be installed on build host
devtools="debootstrap genisoimage p7zip-full squashfs-tools ubuntu-dev-tools"
#url_wallpaper="https://meilix-generator.herokuapp.com/uploads/wallpaper" # url heroku wallpaper
#wget $url_wallpaper -P meilix-default-settings/usr/lxqt/themes/meilix/
# Make sure we have the data files we need
for i in $datafiles
do
if [ ! -f $i ]; then
echo "$0: ERROR: data file `pwd`/$i not found"
exit 1
fi
done
# Remove build fragments that are not needed during build
[ -d db ] && sudo rm -R db
[ -d pool ] && sudo rm -R pool
[ -d docs ] && sudo rm -R docs
[ -d dists ] && sudo rm -R dists/trusty
# Remove previus chroot if exists
[ -d chroot ] && sudo rm -R chroot/
# Make sure we have the tools we need installed
sudo apt-get clean
sudo apt-get update
sudo apt-get -qq install $devtools -y --no-install-recommends
sudo apt-get -qq install dpkg-dev debhelper fakeroot
sudo apt-get -qq install devscripts
sudo apt-get -qq install tree # for debugging
# Initram extraction, see https://unix.stackexchange.com/questions/163346/why-is-it-that-my-initrd-only-has-one-directory-namely-kernel
sudo apt-get -qq install binwalk
initramfs-extract() {
local target=$1
local offset=$(binwalk -y gzip $1 | awk '$3 ~ /gzip/ { print $1; exit }')
shift
dd if=$target bs=$offset skip=1 | zcat | cpio -id --no-absolute-filenames $@
}
# remove existing plymouth bootscreen packages and debuilding them again
# in the future the debuilding (=building deb packages) is to be done
# in the meilix-artwork repo and we will fetch the latest releases of the
# deb files here.
rm plymouth-meilix-logo_1.0-1_all.deb
rm plymouth-meilix-text_1.0-1_all.deb
chmod +x ./scripts/debuild.sh
./scripts/debuild.sh
# Create and populate the chroot using debootstrap
# Debootstrap installs a Linux in the chroot. The noisy output could be ignored
# arch, release, mirror see as set above.
sudo debootstrap --arch=${arch} ${release} chroot ${mirror} # 2>&1 |grep -v "^I: "
# Use /etc/resolv.conf from the host machine during the build
sudo cp -vr /etc/resolvconf chroot/etc/resolvconf
# Copy the sources.list in chroot which enables universe / multiverse, and eventually additional repos.
# The sources.list apt ppa sources should correspond to the ${release} version
sudo cp -v sources.list chroot/etc/apt/sources.list
# Copy our custom packages into the chroot
sudo cp -v meilix-default-settings_*_all.deb chroot
sudo cp -v systemlock_*_all.deb chroot
sudo cp -v plymouth-meilix-logo_*_all.deb chroot
sudo cp -v plymouth-meilix-text_*_all.deb chroot
sudo cp -v meilix-metapackage_*_all.deb chroot
# Mount needed pseudo-filesystems for the chroot
sudo mount --rbind /sys chroot/sys
sudo mount --rbind /dev chroot/dev
sudo mount -t proc none chroot/proc
#Section chroot - Work *inside* the chroot
chmod +x ./scripts/chroot.sh
./scripts/chroot.sh
#Section chroot finished, continue work outside the chroot,
###############################################################
#Preparing image
# ubiquity-slideshow slides for the installer, overwrite the chroot ones
sudo cp -vr ubiquity-slideshow chroot/usr/share/
# Unmount pseudo-filesystems for the chroot
sudo umount -lfr chroot/proc
sudo umount -lfr chroot/sys
sudo umount -lfr chroot/dev
echo $0: Preparing image...
# Clean leftovers in the image directory
[ -d image ] && sudo /bin/rm -r image
# Extract a new image folder
# lzma file is a zip compressed live cd image (without squasfs content)
# it it uncompressed into a folder image
tar image-${arch}.tar.lzma
#tar xvvf amd64.tar.lzma
# Copy the kernel from the chroot into the image folder for the LiveCD
sudo \cp --verbose -rf chroot/boot/vmlinuz-**-generic image/casper/vmlinuz
sudo \cp --verbose -rf chroot/boot/initrd.img-**-generic image/casper/initrd.lz
# Extract initrd (compressed in nonuniform ways) to update casper-uuid-generic
mkdir initrd_FILES && \
cp image/casper/initrd.lz initrd_FILES/initrd.lz && \
cd initrd_FILES && \
initramfs-extract initrd.lz -v && \
cd .. && \
cp initrd_FILES/conf/uuid.conf image/.disk/casper-uuid-generic && \
rm -R initrd_FILES/
# Fix old version and date info in .hlp files
newversion=$(date -u +%y.%m) # Should be derived from releasename $4 FIXME
for oldversion in 17.08
do
sed -i -e "s/${oldversion}/${newversion}/g" image/isolinux/*.hlp image/isolinux/f1.txt
done
newdate=$(date -u +%Y%m%d)
for olddate in 20100113 20100928
do
sed -i -e "s/${olddate}/${newdate}/g" image/isolinux/*.hlp image/isolinux/f1.txt
done
# Create filesystem manifests
sudo chroot chroot dpkg-query -W --showformat='${Package} ${Version}\n' >/tmp/manifest.$$
sudo cp -v /tmp/manifest.$$ image/casper/filesystem.manifest
sudo cp -v image/casper/filesystem.manifest image/casper/filesystem.manifest-desktop
rm /tmp/manifest.$$
# Remove packages from filesystem.manifest-desktop
# (language and extra for more hardware support)
REMOVE='gparted ubiquity ubiquity-frontend-gtk casper live-initramfs user-setup discover1
xresprobe libdebian-installer4 pptp-linux ndiswrapper-utils-1.9
ndisgtk linux-wlan-ng libatm1 setserial b43-fwcutter uterm
linux-headers-generic indicator-session indicator-application'
for i in $REMOVE
do
sudo sed -i "/${i}/d" image/casper/filesystem.manifest-desktop
done
# Now squash the live filesystem
echo "$0: Starting mksquashfs at $(date -u) ..."
sudo mksquashfs chroot image/casper/filesystem.squashfs -noappend -no-progress
echo "$0: Finished mksquashfs at $(date -u )"
# Generate md5sum.txt checksum file
cd image && sudo find . -type f -print0 |xargs -0 sudo md5sum |grep -v "\./md5sum.txt" >md5sum.txt
# Generate a small temporary ISO so we get an updated boot.cat
IMAGE_NAME=${IMAGE_NAME:-"Meilix ${release} $(date -u +%Y%m%d) - ${arch}"}
ISOFILE=meilix-${release}-$(date -u +%Y%m%d)-${arch}.iso
sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--publisher "Meilix Packaging Team" \
--volset "Ubuntu Linux http://www.ubuntu.com" \
-p "${DEBFULLNAME:-$USER} <${DEBEMAIL:-on host $(hostname --fqdn)}>" \
-A "$IMAGE_NAME" \
-m filesystem.squashfs \
-o ../$ISOFILE.tmp .
# Mount the temporary ISO and copy boot.cat out of it
tempmount=/tmp/$0.tempmount.$$
mkdir $tempmount
loopdev=$(sudo losetup -f)
sudo losetup $loopdev ../$ISOFILE.tmp
sudo mount -r -t iso9660 $loopdev $tempmount
sudo cp -vp $tempmount/isolinux/boot.cat isolinux/
sudo umount $loopdev
sudo losetup -d $loopdev
rmdir $tempmount
# Generate md5sum.txt checksum file (now with new improved boot.cat)
sudo find . -type f -print0 |xargs -0 sudo md5sum |grep -v "\./md5sum.txt" >md5sum.txt
# Remove temprary ISO file
sudo rm ../$ISOFILE.tmp
# Create an Meilix ISO from the image directory tree
sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l \
-allow-limited-size -udf \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--publisher "Meilix Packaging Team" \
--volset "Meilix Linux" \
-p "${DEBFULLNAME:-$USER} <${DEBEMAIL:-on host $(hostname --fqdn)}>" \
-A "$IMAGE_NAME" \
-o ../$ISOFILE .
# Fix up ownership and permissions on newly created ISO file
# On Travis $USER is travis.
sudo chown $USER:$USER ../$ISOFILE
chmod 0444 ../$ISOFILE
# Create the associated md5sum file
cd ..
md5sum $ISOFILE >${ISOFILE}.md5
# see travis confguration for the deployment that follows in case of a Travis build.