Sat Oct 27 13:36:23 2018 UTC

Scenario E

Introduction

In this Scenario we will have 2 different working Scenario environments. The first, is Scenario A containing the original NuTyX platform, and where you will create a dedicated folder (say /MyDownloads) in which you will produce your personal packages.

This scenario is the combination of TWO scenarios, one will be ... Scenario A ( Cool. The second scenario is that of your isolated environment, whre you create packages from Scenarios B, C and D, and this keeps the original NuTyX from becoming corrupted.

The correct technical term to gain access to this isolated working environment is chrooting. From now on the word chroot will refer to the isolated environment.

Some small benefits over the previous Scenarios:

  1. As you never install any development packages on your main NuTyX system, it will remain a reasonable size.
  2. You must provide some Gigabytes of storage for your chroot environment, but this can easily be deleted when required using:
    rm -r /<path-of-your-chroot>
    and you are safely back in your NuTyX without any chroot.
  3. All your packages will be compiled in the chroot environment, preventing any corruption of your main NuTyX system.
  4. You can gain access to your chroot via the X graphical interface, if you want, allowing for more flexibility. If you access the chroot environment using a console, you will be more restricted as you will not have the use of your mouse or access to your X-desktop.

In this exercise, my machine is 64-bit with 4 cores.

The /etc/cards.conf files

*** Main NuTyX ***
dir /mnt/hd/usr/ports/personal
dir /var/lib/pkg/depot/gui|http://downloads.nutyx.org
dir /var/lib/pkg/depot/gui-extra|http://downloads.nutyx.org
dir /var/lib/pkg/depot/cli|http://downloads.nutyx.org
dir /var/lib/pkg/depot/cli-extra|http://downloads.nutyx.org
dir /var/lib/pkg/depot/base|http://downloads.nutyx.org
dir /var/lib/pkg/depot/base-extra|http://downloads.nutyx.org
locale fr
base /var/lib/pkg/depot/base

You will notice that I intentionally add the line:

dir /chroot/usr/ports/personal

Continuing with the process of incorporating /chroot/usr/ports/personal, we want to install our packages from the chroot into the main NuTyX system.

I chose scenario C for my chroot *** NuTyX chroot *** Scenario C ***

dir /usr/ports/personal
dir /usr/ports/gui
dir /usr/ports/cli
dir /usr/ports/base
dir /var/lib/pkg/depot/base|http://downloads.nutyx.org
dir /var/lib/pkg/depot/base-extra|http://downloads.nutyx.org
logdir /var/log/pkgbuild
locale fr
base /usr/ports/base
base /usr/ports/tokeep

The /etc/pkgmk.conf file

As previously mentioned, Scenario A did not require the /etc/pkgmk.conf configuration file. However, as we do need it here to complete our task, the same /etc/pkgmk.conf file can be configured for our chroot environment. *** NuTyX chroot *** Scenario C ***

export CFLAGS="-O2 -pipe"
export CXXFLAGS="${CFLAGS}"
case ${PKGMK_ARCH} in
    "x86_64"|"")
       export MAKEFLAGS="-j4"
       ;;
    "i686")
       export CFLAGS="${CFLAGS} -m32"
       export CXXFLAGS="${CXXFLAGS} -m32"
       export LDFLAGS="${LDFLAGS} -m32"
       ;;
    *)
       echo "Unknown architecture selected! Exiting."
       exit 1
       ;;
esac
PKGMK_SOURCE_DIR="/srv/www/sources"
PKGMK_KEEP_SOURCES="yes"
PKGMK_WORK_DIR="$PWD/work"
PKGMK_IGNORE_REPO="no"
PKGMK_IGNORE_COLLECTION="no"
PKGMK_GROUPS=()
PKGMK_LOCALES=(fr)
PKGMK_COMPRESSION_PACKAGE="yes"
PKGMK_COMPRESSION_MODE="gz"
PKGMK_CLEAN="no"

Building inside an isolated environment (chrooting)

This method is not strictly required but it is highly recommended for safety reasons.

It prevents possible corruption of your regular NuTyX system. In an isolated environment, you are certain that your original NuTyX version is kept intact, even if you make errors in the chroot, and cause the entire system to crash.

We now call this isolated environment a chroot ("change root").

We start by install a chroot NuTyX:

install-nutyx

You can observe your installation beginning.

This installation will be on /mnt/hd                                     [ INFO ]
*******************************************
downloads of cards.devel1412543016x86_64.cards.tar.xz

.....
...
ADD: cards-0.10.81.3, 9 files: 100 %                                     [  OK  ]
Downloading ca-certificates...                                           [ INFO ]
Retrieve info about the 62 packages: 100 %
pre-install: start
pre-install: finish
ADD: ca-certificates-20141001, 323 files: 100 %                          [  OK  ]
"***************************************************"
"* Installation finish. Thanks for installing NuTyX *"
"*                                                 *"
"* Dont forget to choose a valid kernel before you *"
"*      want to boot on your install NuTyX         *"
"*                                                 *"
"*        For more info, come to visit us:         *"
"*                                                 *"
"*              http://www.nutyx.org               *"
"*                                                 *"
"***************************************************"

To also work in the chroot environment unimpeded, you must be able to enter and exit the chroot easily. A small but very powerful script below does the job. You must have root access for it to work:

install-nutyx -ec

That's absolutely brilliant :-). Just try doing that on other LFS installation systems! You will need to enter a lot of commands each time to do what this script does.

This is very helpful when you wish to power down to take time out.

!!!From now on, you should always use following command to enter your chroot:
install-nutyx -ec

The big advantage of working in a chroot is that if you make any errors, it will never be detrimental to your main NuTyX system.

!!! On the other hand, if you're not chrooting and you mistype some of the commands mentioned in this article, I cannot guarantee the end result and and perfect operation of your NuTyX system.

yippee Everything is now in its rightful place. We can now build a package with some dependencies.

Well done on your achievement so far!

clap That's really cool isnt it ? clap

Your first packet is compiled and installed. The package manager (in your chroot) integrated it into its database. Small note: if you followed this tutorial, you probably noticed that all terminal commands were made from the root of your chroot ... Cool.

I trust you have found the experience educationally stimulating and rewarding.

Now type the following command which will gather all the relevant info about the clipit package:

cards info clipit
Retrieve info about the 123 packages: 100 %
Name           : clipit
Description    : ClipIt is a lightweight GTK+ clipboard manager.
Maintainer     : Gilberto Xyhthyx <xyhthyx at gmail dot com>
Packager       : Fran├žois Perrin
Version        : 1.4.2
Release        : 1
Build date     : Sun Oct 26 22:27:45 2014
Size           : 1117696
Number of Files: 70
Arch           : x86_64

Install a package on the host (main) NuTyX

wall I am looking forward to installing a new package called clipit... .

? But now how do I install it in my NuTyX host system... ?

!! Easy, with just a few Linux+NuTyX commands!

We can now quit the chroot:

exit
!!! From this point, you are back on your host NuTyX.

Now enter:

cards info -b clipit
Name           : clipit
Description    : ClipIt is a lightweight GTK+ clipboard manager.
Maintainer     : Gilberto Xyhthyx <xyhthyx at gmail dot com>
Packager       : Fran├žois Perrin
Version        : 1.4.2
Release        : 1
Build date     : Sun Oct 26 23:27:45 2014
Arch           : x86_64
Url            :
Local Directory: /mnt/hd/usr/ports/personnal
CoolCoolCool

All that remains now, is the installation!

get clipit
Retrieve info about the 622 packages: 100 %
ADD: (personnal) clipit-1.4.2, 71 files: 100 %

CONGRATULATIONS! We at NuTyX trust you will continue to remain with us, and to please encourage your friends on line or work place, to investigate and sample the power and wonder of NuTyX.

Conclusion

In this scenario, (a little reminder is always good), these are the commands you will using within NuTyX:

cards install
cards install -u
cards remove
cards depends
cards depcreate
cards level
cards base -r