HowtoBuildCD

From Paldo

Jump to: navigation, search

Contents

[edit] How to bootstrap your own ISO using upkg (the paldo package system)

written by Philip Müller in may 2007

[edit] Abstract

This howto should help you to build your own ISO using upkg. Upkg is the package management and build system used in the Paldo Linux distribution.

[edit] Introduction

Upkg you can use for building your own ISO (boostrapping). You can use the default packages you can find on the mainrepository of the Paldo Linux distribution. In this guide I show you how to build one of my XFCE-Installer-CDs yourself.

[edit] Create a local Paldo repository

Read this guide to know how to create your local Paldo repository: How to build a source package using upkg by Nicolas Christener

[edit] Download the Installer-CD-XFCE-Repo

Download the Installer-CD-XFCE-Repo from here: generic-xfce-repo.tar.bz2

[edit] Create the modified spec files

We don't want to use the package paldo-live so we have to create our own package called paldo-xfce-live. This it should look like:

    <?xml version="1.0"?>
        <package name="paldo-xfce-live">
        <description/>
            <releases>
                <release version="20070514" revision="1" branch="stable">
                    <deps>
                            <dep name="paldo-base"/>
                            <dep name="x-window-system"/>
                            <dep name="gamin"/>
                            <dep name="zenity"/>
                            <dep name="gnome-doc-utils"/>
                            <dep name="xfce-desktop"/>
                            <dep name="paldo-installer"/>
                            <dep name="paldo-installer-xfce-scripts"/>
                            <dep name="paldo-xfce-desktop-settings"/>
                            <dep name="glibc-de_CH"/>
                            <dep name="glibc-de_DE"/>
                            <dep name="glibc-en_GB"/>
                            <dep name="glibc-en_US"/>
                            <dep name="glibc-es_ES"/>
                            <dep name="glibc-fr_CH"/>
                            <dep name="glibc-fr_FR"/>
                            <dep name="glibc-it_CH"/>
                            <dep name="glibc-it_IT"/>
                            <dep name="glibc-pl_PL"/>
                            <dep name="glibc-pt_BR"/>
                            <dep name="glibc-pt_PT"/>
                            <dep name="glibc-tr_TR"/>
                    </deps>
                    <postbuild>
                        <cmd>cd $CHROOTDIR</cmd>
                        <!-- backup files for later install -->
                        <cmd>mkdir -p backup/etc</cmd>
                        <cmd>cp etc/passwd backup/etc/passwd</cmd>
                        <cmd>cp etc/group backup/etc/group</cmd>
                        <cmd>mkdir -p backup/etc/init.d</cmd>
                        <cmd>cp etc/init.d/nscd backup/etc/init.d/nscd</cmd>
                        <cmd>mkdir -p backup/etc/network/if-up.d</cmd>
                        <cmd>cp etc/network/if-up.d/nscd backup/etc/network/if-up.d/nscd</cmd>				
                        <!-- copy installer desktop file to the tmp/desktop -->
                        <cmd>mkdir -p $CHROOTDIR/etc/skel/Desktop</cmd>
                        <cmd>cp $CHROOTDIR/usr/share/applications/pinstaller.desktop $CHROOTDIR/etc/skel/Desktop/pinstaller.desktop</cmd>
                        <!-- create .gtkrc.mine file for livecd user -->
                        <text dest="$CHROOTDIR/etc/skel/.gtkrc.mine"><![CDATA[# -- THEME AUTO-WRITTEN DO NOT EDIT
    
    include "/usr/share/themes/Smooth-Winter/gtk/gtkrc"
    include "/home/paldo/.gtkrc.mine"
    
    # -- THEME AUTO-WRITTEN DO NOT EDIT
    ]]></text>
                        <text dest="$CHROOTDIR/etc/skel/.gtkrc-1.2-gnome2"><![CDATA[# Autowritten by gnome-settings-daemon. Do not edit
    
    include "/home/paldo/.gtkrc.mine"
    ]]></text>
                        <text dest="$CHROOTDIR/root/.gtkrc.mine"><![CDATA[# -- THEME AUTO-WRITTEN DO NOT EDIT
    
    include "/usr/share/themes/Smooth-Winter/gtk/gtkrc"
    include "/root/.gtkrc.mine"
    
    # -- THEME AUTO-WRITTEN DO NOT EDIT
    ]]></text>
                        <text dest="$CHROOTDIR/root/.gtkrc-1.2-gnome2"><![CDATA[# Autowritten by gnome-settings-daemon. Do not edit
    
    include "/root/.gtkrc.mine"
    ]]></text>
                        <cmd>chown -R 1000:1000 $CHROOTDIR/etc/skel/Desktop</cmd>
                        <!-- create livecd user paldo and let it autologin -->
                        <cmd>chown -R 1000:1000 $CHROOTDIR/home/paldo</cmd>
                        <cmd>echo "paldo:x:1000:1000::/home/paldo:/bin/bash" >> $CHROOTDIR/etc/passwd</cmd>
                        <cmd>echo "paldo:x:1000:" >> $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^wheel:.*/wheel:x:18:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^audio:.*/audio:x:6:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^cdrom:.*/cdrom:x:25:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>echo "paldo:paldo" | chroot $CHROOTDIR chpasswd --md5</cmd>
                        <text dest="$CHROOTDIR/etc/gdm/custom.conf">
    [daemon]
    AutomaticLoginEnable=true
    AutomaticLogin=paldo
    </text>
                        <cmd>cp $CHROOTDIR/usr/share/xsessions/xfce.desktop $CHROOTDIR/usr/share/gdm/BuiltInSessions/default.desktop</cmd>
                        <!-- fix gconf defaults permissions -->
                        <cmd>chmod -R a+r $CHROOTDIR/etc/gconf/gconf.xml.defaults</cmd>
                        <cmd>find $CHROOTDIR/etc/gconf/gconf.xml.defaults -type d | xargs chmod a+x</cmd>
                        <!-- deactivate unneeded daemons -->
                        <cmd>sed -i -e 's/: 2 3 4 5/:/' -e 's/: 0 1 6/: 0 1 2 3 4 5 6/' $CHROOTDIR/etc/init.d/hplip</cmd>
                        <!-- disable nscd, doesn't seem to work with unionfs -->
                        <cmd>rm -vf $CHROOTDIR/etc/init.d/nscd $CHROOTDIR/etc/network/if-up.d/nscd</cmd>
				
                        <!-- add some more possible mountpoints as /media is read-only -->
                        <cmd>mkdir -p $CHROOTDIR/media/{cdrecorder,usbdisk}</cmd>
				
                        <!-- update mime -->
                        <cmd>chroot $CHROOTDIR update-mime-database /usr/share/mime</cmd>
                        <!-- create fonts.dir files for modular xorg -->
                        <cmd>[ ! -x $CHROOTDIR/usr/bin/mkfontdir ] || chroot $CHROOTDIR bash -c "mkfontdir /usr/share/X11/fonts/*"</cmd>
                        <!-- strip binaries -->
                        <cmd>find $CHROOTDIR{,/usr}{/bin,/lib,/sbin} -name '*.a' -o -name '*.o' -o -name '*.ko' -type f -exec /usr/bin/strip --strip-debug '{}' \;</cmd>
                        <cmd>find $CHROOTDIR{,/usr}{/bin,/lib,/sbin} -not -name '*.a' -not -name '*.o' -not -name '*.ko' -not -name '*.exe' -not -name '*.dll' -type f -exec /usr/bin/strip --strip-unneeded '{}' \;</cmd>
                    </postbuild>
                </release>
                <release version="20070514" revision="2" branch="testing">
                    <deps>
                            <dep name="paldo-base"/>
                            <dep name="x-window-system"/>
                            <dep name="gamin"/>
                            <dep name="zenity"/>
                            <dep name="gnome-doc-utils"/>
                            <dep name="xfce-desktop"/>
                            <dep name="paldo-installer"/>
                            <dep name="paldo-installer-xfce-scripts"/>
                            <dep name="paldo-xfce-desktop-settings"/>
                            <dep name="glibc-de_CH"/>
                            <dep name="glibc-de_DE"/>
                            <dep name="glibc-en_GB"/>
                            <dep name="glibc-en_US"/>
                            <dep name="glibc-es_ES"/>
                            <dep name="glibc-fr_CH"/>
                            <dep name="glibc-fr_FR"/>
                            <dep name="glibc-it_CH"/>
                            <dep name="glibc-it_IT"/>
                            <dep name="glibc-pl_PL"/>
                            <dep name="glibc-pt_BR"/>
                            <dep name="glibc-pt_PT"/>
                            <dep name="glibc-tr_TR"/>
                    </deps>
                    <postbuild>
                        <cmd>cd $CHROOTDIR</cmd>
                        <!-- backup files for later install -->
                        <cmd>mkdir -p backup/etc</cmd>
                        <cmd>cp etc/passwd backup/etc/passwd</cmd>
                        <cmd>cp etc/group backup/etc/group</cmd>
                        <cmd>mkdir -p backup/etc/init.d</cmd>
                        <cmd>cp etc/init.d/nscd backup/etc/init.d/nscd</cmd>
                        <cmd>mkdir -p backup/etc/network/if-up.d</cmd>
                        <cmd>cp etc/network/if-up.d/nscd backup/etc/network/if-up.d/nscd</cmd>				
                        <!-- copy installer desktop file to the tmp/desktop -->
                        <!-- new way for aufs copy files to /home/paldo instead of /etc/skel-->
                        <cmd>mkdir -p $CHROOTDIR/home/paldo/Desktop</cmd>
                        <cmd>cp $CHROOTDIR/usr/share/applications/pinstaller.desktop $CHROOTDIR/home/paldo/Desktop/pinstaller.desktop</cmd>
                        <!-- create .gtkrc.mine file for livecd user -->
                        <text dest="$CHROOTDIR/home/paldo/.gtkrc.mine"><![CDATA[# -- THEME AUTO-WRITTEN DO NOT EDIT
    
    include "/usr/share/themes/Smooth-Winter/gtk/gtkrc"
    include "/home/paldo/.gtkrc.mine"
    
    # -- THEME AUTO-WRITTEN DO NOT EDIT
    ]]></text>
                        <text dest="$CHROOTDIR/home/paldo/.gtkrc-1.2-gnome2"><![CDATA[# Autowritten by gnome-settings-daemon. Do not edit

    include "/home/paldo/.gtkrc.mine"
    ]]></text>
                        <text dest="$CHROOTDIR/root/.gtkrc.mine"><![CDATA[# -- THEME AUTO-WRITTEN DO NOT EDIT
    
    include "/usr/share/themes/Smooth-Winter/gtk/gtkrc"
    include "/root/.gtkrc.mine"
    
    # -- THEME AUTO-WRITTEN DO NOT EDIT
    ]]></text>
                        <text dest="$CHROOTDIR/root/.gtkrc-1.2-gnome2"><![CDATA[# Autowritten by gnome-settings-daemon. Do not edit

    include "/root/.gtkrc.mine"
    ]]></text>
                        <!-- create livecd user paldo and let it autologin -->
                        <cmd>chown -R 1000:1000 $CHROOTDIR/home/paldo</cmd>
                        <cmd>echo "paldo:x:1000:1000::/home/paldo:/bin/bash" >> $CHROOTDIR/etc/passwd</cmd>
                        <cmd>echo "paldo:x:1000:" >> $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^wheel:.*/wheel:x:18:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^audio:.*/audio:x:6:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>sed -i -e 's/^cdrom:.*/cdrom:x:25:paldo/' $CHROOTDIR/etc/group</cmd>
                        <cmd>echo "paldo:paldo" | chroot $CHROOTDIR chpasswd --md5</cmd>
                        <text dest="$CHROOTDIR/etc/gdm/custom.conf">
    [daemon]
    AutomaticLoginEnable=true
    AutomaticLogin=paldo
    </text>
                        <cmd>cp $CHROOTDIR/usr/share/xsessions/xfce.desktop $CHROOTDIR/usr/share/gdm/BuiltInSessions/default.desktop</cmd>
                        <!-- fix gconf defaults permissions -->
                        <cmd>chmod -R a+r $CHROOTDIR/etc/gconf/gconf.xml.defaults</cmd>
                        <cmd>find $CHROOTDIR/etc/gconf/gconf.xml.defaults -type d | xargs chmod a+x</cmd>
                        <!-- deactivate unneeded daemons -->
                        <cmd>sed -i -e 's/: 2 3 4 5/:/' -e 's/: 0 1 6/: 0 1 2 3 4 5 6/' $CHROOTDIR/etc/init.d/hplip</cmd>
                        <!-- disable nscd, doesn't seem to work with unionfs -->
                        <cmd>rm -vf $CHROOTDIR/etc/init.d/nscd $CHROOTDIR/etc/network/if-up.d/nscd</cmd>
				
                        <!-- add some more possible mountpoints as /media is read-only -->
                        <cmd>mkdir -p $CHROOTDIR/media/{cdrecorder,usbdisk}</cmd>
				
                        <!-- update mime -->
                        <cmd>chroot $CHROOTDIR update-mime-database /usr/share/mime</cmd>
                        <!-- create fonts.dir files for modular xorg -->
                        <cmd>[ ! -x $CHROOTDIR/usr/bin/mkfontdir ] || chroot $CHROOTDIR bash -c "mkfontdir /usr/share/X11/fonts/*"</cmd>
                        <!-- strip binaries -->
                        <cmd>find $CHROOTDIR{,/usr}{/bin,/lib,/sbin} -name '*.a' -o -name '*.o' -o -name '*.ko' -type f -exec /usr/bin/strip --strip-debug '{}' \;</cmd>
                        <cmd>find $CHROOTDIR{,/usr}{/bin,/lib,/sbin} -not -name '*.a' -not -name '*.o' -not -name '*.ko' -not -name '*.exe' -not -name '*.dll' -type f -exec /usr/bin/strip --strip-unneeded '{}' \;</cmd>
                    </postbuild>
                </release>
            </releases>
    </package>

To change the packages, which will be installed on your new ISO, you have to change the dependencies:

      <dep name="paldo-base"/>
      <dep name="x-window-system"/>
      <dep name="gamin"/>
      <dep name="zenity"/>
      <dep name="gnome-doc-utils"/>
      <dep name="xfce-desktop"/>
      <dep name="paldo-installer"/>
      <dep name="paldo-installer-xfce-scripts"/>
      <dep name="paldo-xfce-desktop-settings"/>
      <dep name="glibc-de_CH"/>
      <dep name="glibc-de_DE"/>
      <dep name="glibc-en_GB"/>
      <dep name="glibc-en_US"/>
      <dep name="glibc-es_ES"/>
      <dep name="glibc-fr_CH"/>
      <dep name="glibc-fr_FR"/>
      <dep name="glibc-it_CH"/>
      <dep name="glibc-it_IT"/>
      <dep name="glibc-pl_PL"/>
      <dep name="glibc-pt_BR"/>
      <dep name="glibc-pt_PT"/>
      <dep name="glibc-tr_TR"/>

All my ISOs are based on the paldo-base package.

To run a desktop you have also to install x-window-system. The package xfce-desktop needs gamin and zenity. My installer is included in paldo-installer.

As we install XFCE in this example we add to the installer two more packages:

paldo-installer-xfce-scripts and paldo-xfce-desktop-settings.

paldo-installer-xfce-scripts includes the scripts we are using for installing paldo and paldo-xfce-desktop-settings includes the custom settings of your .config located in your home-folder.

In this guide only the script 08_fixbootstrap.sh is the key. For our example it would look like this:

      #!/bin/bash
      # expects <%TargetPart%> as 1st argument!
      #fix upkg-bootstrap
      echo "Package: xfce-desktop" > /root/mnt/$1/var/lib/upkg/packages/xfce-desktop.select
      echo "Package: paldo-base" > /root/mnt/$1/var/lib/upkg/packages/paldo-base.select
      #keep extra installed apps - 20070511
      echo "Package: gamin" > /root/mnt/$1/var/lib/upkg/packages/gamin.select
      echo "Package: zenity" > /root/mnt/$1/var/lib/upkg/packages/zenity.select
      echo "Package: gparted" > /root/mnt/$1/var/lib/upkg/packages/gparted.select
      #keep all languages
      echo "Package: glibc-de_CH" > /root/mnt/$1/var/lib/upkg/packages/glibc-de_CH.select
      echo "Package: glibc-de_DE" > /root/mnt/$1/var/lib/upkg/packages/glibc-de_DE.select
      echo "Package: glibc-en_GB" > /root/mnt/$1/var/lib/upkg/packages/glibc-en_GB.select
      echo "Package: glibc-en_US" > /root/mnt/$1/var/lib/upkg/packages/glibc-en_EN.select
      echo "Package: glibc-es_ES" > /root/mnt/$1/var/lib/upkg/packages/glibc-es_ES.select
      echo "Package: glibc-fr_CH" > /root/mnt/$1/var/lib/upkg/packages/glibc-fr_CH.select
      echo "Package: glibc-fr_FR" > /root/mnt/$1/var/lib/upkg/packages/glibc-fr_FR.select
      echo "Package: glibc-it_CH" > /root/mnt/$1/var/lib/upkg/packages/glibc-it_CH.select
      echo "Package: glibc-it_IT" > /root/mnt/$1/var/lib/upkg/packages/glibc-it_IT.select
      echo "Package: glibc-pl_PL" > /root/mnt/$1/var/lib/upkg/packages/glibc-pl_PL.select
      echo "Package: glibc-pt_BR" > /root/mnt/$1/var/lib/upkg/packages/glibc-pt_BR.select
      echo "Package: glibc-pt_PT" > /root/mnt/$1/var/lib/upkg/packages/glibc-pt_PT.select
      echo "Package: glibc-tr_TR" > /root/mnt/$1/var/lib/upkg/packages/glibc-tr_TR.select
      #keep gtk+1.2
      echo "Package: gdk-pixbuf" > /root/mnt/$1/var/lib/upkg/packages/gdk-pixbuf.select
      echo "Package: glib-1.2" > /root/mnt/$1/var/lib/upkg/packages/glib-1.2.select
      echo "Package: gtk+-1.2" > /root/mnt/$1/var/lib/upkg/packages/gtk+-1.2.select
      
      #remove paldo-desktop package
      
      touch /root/mnt/$1/etc/rc.d/runonce
      echo "#!/bin/bash" >> /root/mnt/$1/etc/rc.d/runonce
      echo "#" >> /root/mnt/$1/etc/rc.d/runonce
      echo "rm -f /var/lib/upkg/packages/paldo-desktop.select" >> /root/mnt/$1/etc/rc.d/runonce
      echo "rm -f /etc/rc.d/runonce" >> /root/mnt/$1/etc/rc.d/runonce
      chmod a+x /root/mnt/$1/etc/rc.d/runonce

So what does this script exactly?

It is simple. It adds the packages we installed during the bootstrap (will come later) to the upkg-cache on the paldo system we install with the paldo-installer on the harddrive.

The first part of the script adds all packages.

The second part deletes the package paldo-desktop.select on the first bootup of the harddrive installed paldo system. This is needed to get the upkg-cmd upkg-upgrade get working on the new ISO.

Save your modified 08_fixbootstrap.sh script and recreate the two tarballs paldo-installer-xfce-stable.tar.bz2 and paldo-installer-xfce-testing.tar.bz2.

[edit] Add the local repo to your upkg.conf file

When your local repo is finished you can add it to your local upkg.conf file:

    $ su
    Password: enter your root password
    #  sed -i -e 's%<repositories>%&\n<repository>PATH/TO/YOUR/LOCAL/REPO</repository>%' /etc/upkg.conf

[edit] Bootstrapping the ISO

Now we are on the final step. Creating the ISO. First we have to create a new folder:

    mkdir -p /upkg

Then we have to clear the upkg-cache:

    rm -rf /upkg/*
    rm -rf /var/cache/upkg/*

Finally we can bootstrap our new ISO with this command:

    upkg-bootstrap --verbose paldo-xfce-live-cd-installer

The final iso you can find in /var/cache/upkg. Burn it with your favorite burning app.

Personal tools