[Ubuntu-us-ok] Howdy fellow Ubuntians

Israel israeldahl at gmail.com
Wed Sep 3 03:57:43 UTC 2014


Hi Patrick,
Basically I used
https://help.ubuntu.com/community/LiveCDCustomizationFromScratch
as a guide.
The main issue is making a script that goes into a chroot.
So before the chroot starts, you need to copy your chroot portion of the
script into the chroot itself, and then have the chroot execute it

here is a snippet of my code:
I'll bold in the most important parts to this..

# i386 or amd64
ARCH=i386
#Ubuntu version to build it from
RELEASE=precise
#Current Ubuntu version you are building from
CURRENTSYS=trusty

#The name of folder you want to build in
BUILDDIR=live_boot
#The name of the chroot directory
*CHROOTDIR=toriOS-chroot*

sudo rm -Rf ${BUILDDIR} &&

## make sure current system has what we need
if [ ! -x /usr/sbin/debootstrap ] || [ ! -x /usr/bin/genisoimage ] || [
! -x /usr/bin/mksquashfs ] || [ ! -x /usr/bin/lzma ] || [ ! -x
/usr/bin/rsync ]
    then
    sudo apt-get install debootstrap syslinux squashfs-tools genisoimage
memtest86+ rsync
fi
## make the build directory and change to it
mkdir ${BUILDDIR} && cd ${BUILDDIR} &&

## make the chroot UBUNTU
sudo debootstrap --arch=$ARCH $RELEASE ${CHROOTDIR} &&

## bind to dev so we can install things later
sudo mount --bind /dev ${CHROOTDIR}/dev &&

## use some system files to get internet
sudo cp /etc/hosts ${CHROOTDIR}/etc/hosts &&
sudo cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf &&

## copy the current sources over
sudo cp /etc/apt/sources.list ${CHROOTDIR}/etc/apt/sources.list &&
##  change them for the release targeted
sudo sed -i "s/${CURRENTSYS}/${RELEASE}/g"
${CHROOTDIR}/etc/apt/sources.list &&

### COPY the CHROOT scripts into the chroot
*sudo cp ../chroot.bash ${CHROOTDIR}/*

*sudo chroot ${CHROOTDIR} ./chroot.bash*

There is a lot more to the script, obviously, and I can tar.xz up the
entire folder if you want to use it... however I don't use Ubiquity, so
you will most likely want to modify it to your own likings.

That page gives a fairly good description of most everything...
Also, if you are popping in and out of chroot, MAKE SURE you
export HOME=root
and
export LC_ALL=C
when you get into the chroot :)
changing the host name is also good.

It is pretty nice to run one command to build a custom distro..

./ISObuilder (that is the name of my script)

I also have a few helper scripts for testing the configuration out
like mkISO to simply remake the squashfs and generate the ISO when I
tweak things in testing.



On 09/02/2014 10:46 PM, Patrick Vance wrote:
> I have been trying to figure out how to do this as well. I would be very
> interested in what you have figured out.
> On Sep 2, 2014 8:01 PM, "Israel" <israeldahl at gmail.com> wrote:
>
>> Hi Everyone,
>> I was wondering if any of you have ever tried building your own version
>> of Ubuntu in a chroot.
>> This is something I have been doing lately for ToriOS.  ToriOS
>> (torios.org <http://torios.org>) is an Ubuntu based distro for lower-end
>> hardware.  It is based off of 12.04, uses JWM/ Rox much likePuppy does,
>> but it is a full distro that is meant to be installed to the Hard
>> Drive... it does not use squashfs for the system like Puppy does (except
>> in the Live CD of course).  It has been designed with >128MB RAM in
>> mind, and a minimal set of applications so the user is free to customize
>> it in whatever way they choose.
>>
>> Anyhow, I have written a long Bash script to build the entire OS in a
>> chroot for the Live system.  The OS is installed on the HD through an
>> installer called OBI <https://help.ubuntu.com/community/OBI> made by Nio
>> Wiklund.  This installer is something some of you might find very
>> useful.  You can image your entire HD (as long as you do not have a
>> separate /home partition) and reinstall it on another computer.  It is
>> very handy for making a backup of your entire working system, as well as
>> making a portable USB system, since you can install the OS on a USB,
>> external HD, SD card, etc..
>>
>> If any one is interested in OBI or ToriOS e-mail me, or go to the Join
>> Us <http://torios.org/join.html> to find out more info, or just reply
>> back here :D
>>
>> I am specifically asking here in case anyone has had any experience
>> doing this, or was interested in doing this.  I'll be putting up the
>> script, and eventually I'd like to make something similar to uck, but
>> using dialog or zenity for the 'front-end'.  I also would like to make a
>> GUI for the 'mktbl' program... the program that makes a tarball of the
>> installed system.
>>
>> Thanks!
>>
>> --
>> Regards
>>
>> --
>> Ubuntu-us-ok mailing list
>> Ubuntu-us-ok at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-ok
>>


-- 
Regards



More information about the Ubuntu-us-ok mailing list