:: [DNG] How to integrate devuan-insta…
Etusivu
Poista viesti
Vastaa
Lähettäjä: aitor_czr
Päiväys:  
Vastaanottaja: Ozi Traveller, dng
Aihe: [DNG] How to integrate devuan-installer in an existing devuan based system
Hi all,

This example is for amd64 architecture.

I genuinely apologize for the length of the post !!


*1.-**_MODIFYING THE FILESYSTEM.SQUASHFS_*

Download the iso distribution: ExeGnuLinux, Refracta, Star... or
whatever you want, and extract the content.

You will find a squashfs file in it (there are exceptions like knoppix,
which uses loop). This file is named filesystem.squashfs in the most of
the cases.

Mount the file into a chroot jail and enter move up to it:

$ mkdir /tmp/squashfs
$ sudo su
# mount -t squashfs -o loop filesystem.squashfs /tmp/squashfs
# rsync -v -rlt -a /tmp/squashfs/ chroot
# umount /tmp/squashfs/
# mount -t none -o bind /proc chroot/proc
# mount -t none -o bind /sys chroot/sys
# mount -t none -o bind /dev/pts chroot/dev/pts
# xhost +

If you don't type xhost+, you will can't be able to run graphical
applications into the jail.

Copy the following files:

# cp /etc/hostname chroot/etc/hostname
# cp /etc/hostname/hosts chroot/etc/hostname/hosts
# cp /etc/hostname/resolv.conf chroot/etc/resolv.conf

Now you will have network connection into the jail.

Move up to the jail:

# chroot chroot

Do all the changes you want in the system. The following three points
are very important:

i) The kernel in the system and the kernel in the installer must be the
same.

ii) Install all the grub dependencies, but not the grub.

iii) Remove /etc/fstab... Yes, kick it! If you don't remove this file,
doing a manual partition during the installation, your personal folder
will not be created (this is a bug in debian-installer).

Install the following packages:

root@devuan:~# apt-get install live-boot live-boot-initramfs-tools
live-tools live-config live-config-sysvinit

Create a file "/etc/live/config.conf" containing something like that:

LIVE_HOSTNAME=devuan
LIVE_USERNAME=devuan
LIVE_USER_FULLNAME="Devuan"
LIVE_USER_DEFAULT_GROUPS="cdrom floppy audio dip video plugdev fuse
bluetooth netdev scanner"

Make a backup of your sources.list:

root@devuan:~# cp /etc/apt/sources.list /etc/apt/sources.list-back

Don't rename this file.

Create an executable /usr/bin/preseed-hack:

#! /bin/bash

dpkg --purge live-boot live-boot-initramfs-tools live-tools live-config
live-config-sysvinit
rm -rf /etc/live
rm -f /etc/apt/sources.list
mv /etc/apt/sources.list-back /apt/sources.list

FILE=/etc/fstab
if grep "^/dev/sd" ${FILE} | grep "/media/" | grep "auto"
then
     LINE1=`grep "^/dev/sd" ${FILE} | grep "/media/" | grep "auto"`
     LINE2="## ${LINE1}"
     rpl -q "${LINE1}" "${LINE2}" ${FILE}
fi
if grep "^/dev/sr" ${FILE} | grep "/media/cdrom"
then
     LINE3=`grep "^/dev/" ${FILE} | grep "/media/cdrom"`
     LINE4="## ${LINE3}"
     rpl -q "${LINE3}" "${LINE4}" ${FILE}
fi
exit 0


The above script fixes another bug in debian-installer.

Clean the system and exit:

root@devuan:~# apt-get autoremove --purge
root@devuan:~# apt-get autoclean

You can use 'mksquashfs' for getting the new filesystem.squashfs, but i
prefer to use live-build.

Using live-build we will get a better compression (Ozi and Frits are
working on that).


*2.- *_*GETTING THE NEW FILESYSTEM.SQUASHFS WITH LIVE-BUILD*_

Install 'live-build' and 'squashfs-tools' packages, and type:

$ mkdir live-build
$ cd live-build
$ sudo su
# lb init

Here you are an example for lb-config (choose your nearest mirror):

# lb config -a amd64 \
       --binary-images iso \
       --distribution jessie \
       --win32-loader false \
       --checksums md5 \
       --archive-areas "main" \
       --apt-recommends false \
       --apt aptitude \
       --apt-options --yes \
       --build-with-chroot false \
       --parent-mirror-bootstrap "deb http://es.mirror.devuan.org/merged/" \
       --parent-mirror-binary "deb http://es.mirror.devuan.org/merged/" \
       --mirror-bootstrap "deb http://es.mirror.devuan.org/merged/" \
       --mirror-binary "deb http://es.mirror.devuan.org/merged/"


# lb bootstrap && lb chroot

Now you will have the following folders:

.build
cache
chroot
config

Make a backup of the chroot folder and replace it by the chroot
containing your distribution, or create a simbolic link pointing to it.

Build the system:

# lb binary

And you will get your new filesystem.squashfs !!

Now we are going to include it in the iso.


*3.-**_GENERATING THE ISO_*

Install 'genisoimage', 'syslinux' and 'syslinux-utils' packages.

Download the following live image of Devuan:

gnuinos.org/devuan

Extract it with file-roller or isomaster in a file named 'DEVUAN', and
replace the following files:

live/filesystem.squashfs
live/initrd.img
live/vmlinuz

You can also customize the splash, etc...

The following script will generate the new *.iso image and the *.iso.md5:

#!/bin/sh

WORKDIR="$HOME"
ISOTMP="DEVUAN"

CREATEISO="`which mkisofs`"
if [ "$CREATEISO" = "" ]; then
CREATEISO="`which genisoimage`"
fi

LIVECDLABEL="unofficial Devuan 1.0 Alpha2"
CUSTOMISO="unofficial-Devuan-1.0-Alpha2_amd64.iso"

find $WORKDIR/$ISOTMP -xdev -type f -print0 | xargs -0 md5sum > md5sums
$CREATEISO    \
  -quiet \
  -r    \
  -V "$LIVECDLABEL"    \
  -cache-inodes    \
  -J    \
  -l    \
  -b isolinux/isolinux.bin    \
  -c isolinux/boot.cat    \
  -no-emul-boot    \
  -boot-load-size 4    \
  -boot-info-table    \
  -o $WORKDIR/$CUSTOMISO "$WORKDIR/$ISOTMP"


isohybrid $WORKDIR/$CUSTOMISO
md5sum $WORKDIR/$CUSTOMISO > $WORKDIR/$CUSTOMISO.md5

To sum up, i will explain how to customize the appearance of the installer.


4.- _*HOW TO CUSTOMIZE TE APPEARANCE OF d-i*_

We will do that using CPIO.

Copy 'install/gtk/initrd.gz' file in a new directory and move up to it.

Now type:

$ gunzip initrd.gz
$ mkdir tmp
$ cd tmp
$ sudo su
# cpio -id < ../initrd

Now you can customize the following folders (i will not go into details):

usr/share/themes
usr/share/graphics

Generate tne new initrd.gz:

# rm -f ../initrd
# find . | cpio --create --format='newc' > ../initrd
# cd ..
# gzip initrd

... And that's all :)

HTP

Aitor.

P.D.- I genuinely apologize again for the length of the post !!