Debootstrap LSL to a directory
We're going to use the debootstrap.sh shell script (from syscore/naska package) to create a more or less minimal LsLinux tree in a directory of your choice. You may then chroot in this directory or use it as base to create filesystem images. Script is fully sh compliant so it should work with most of available Linux shells. Debootstrap.sh script is avaible from the downloads page, if you're already running a LsLinux system, this script should be installed with naska package.
How it works
Here are the main steps of the debootstrap process :
Core packages fetch and extraction : core packages are the minimal set of packages to be installed to get a functinnal LsLinux
environnement. Actually, core packages are : syscore/baselayout (filesystem baselayout), syscore/busybox (combines tiny versions of many common
UNIX utilities into a single small executable), syscore/shrc (init manager), syscore/naska (packages manager), syslibs/uClibc
(C library optimized for embedded systems) and syslibs/libgcc (GCC shared libraries). Debootstrap starts to fetch the list of core packages
and their actual versions, then each core package is downloaded. As no package manager is for now available in our empty tree, packages are
simply extracted.
Core packages installation : core packages are now present in our tree, but not fully installed as naska package manager
doesn't know about them. Debootstrap uses chroot to perform core packages installation using naska, postinstall/prerm... scripts are run and
packages are registered to naska database.
Additionnal packages installation : if you have specified to install additional packages, debootstrap will chroot to the new
tree and use naska to install them.
Tree customization : if specified, system settings such as hostname or network configuration are written to appropriate files
into the tree.
Script usage and options
Use './debootstrap.sh -h' to see available options (use debootstrap if running under LsLinux) :
root@lslinux ~ # ./debootstrap.sh -h Usage : debootstrap [options] directory debootstrap a LSL environnement into directory Options : -a 'arch' : install arch compiled packages [x86_64] -b 'branch' : use packages from 'branch' branch [stable] -m 'mirror' : download packages from mirror [http://packages.lslinux.org] -p 'packages list' : install specified additional packages -f : force mode, do not ask any question -v : increase verbosity level Sysconfig -hostname=hname : set hostname to 'hname' -ip='ip[:netmask[:broadcast]] : to use dhcp, set ip to 'dhcp'. Else, specify at least an ip, and optionally a netmask and a broadcast address. Additionally you may want to use the following options -gateway=gateway_ip : set default gateway ip adress to 'gateway_ip' -nameserver='ns1[:ns2] : set primary dns seerver to ns1, optionally secondary dns to ns2 -search=domain : set search domain to 'domain' -keymap=keycode : set default keymap to keycode. keycode is a two letter code, default value is 'us'. this feature requires at least keymap-base if keycode is one of fr,de,es,it, keymaps else root@lslinux ~ #
Create your customized debootstrap
Let's debootstrap a minimal Linux environnement, including dropbear and iptables as additional packages. In this example, debootstrap will be customized with 'mydbstrap' hostname, network will be set using dhcp, and keymap will be set to a french layout (needs keymap-base package). The debootstrap will be stored in the /boot/ramfs directory.
root@lslinux ~ # ./debootstrap.sh -p "dropbear iptables" -hostname=mydbstrap -ip=dhcp -keymap=fr /boot/ramfs >> Debootstraping LSL to /boot/ramfs ? /boot/ramfs, directory does not exist, create it? ([y]|n) >> Fetching core packages >> Extracting core packages Installing Busybox v1.20.2 links... 222 new links (222 created and 0 updated) 1 skipped links (0 already ok, 0 are files, 1 have no determined target) >> Initializing NaSKa >> Syncing repository main (prio 0, http://packages.lslinux.org/x86_64/stable/pkglist.csv) >> Installing core packages >> (1/6) fetching package syscore/baselayout Connecting to packages.lslinux.org (91.121.81.130:80) baselayout-1-1.nsk 100% |*******************************| 15327 0:00:00 ETA >> (2/6) fetching package syscore/busybox Connecting to packages.lslinux.org (91.121.81.130:80) busybox-1.20.2-1.nsk 100% |*******************************| 394k 0:00:00 ETA >> (3/6) fetching package syscore/naska Connecting to packages.lslinux.org (91.121.81.130:80) naska-0.1-1.nsk 100% |*******************************| 16306 0:00:00 ETA >> (4/6) fetching package syscore/shrc Connecting to packages.lslinux.org (91.121.81.130:80) shrc-0.1-1.nsk 100% |*******************************| 7753 0:00:00 ETA >> (5/6) fetching package syslibs/libgcc Connecting to packages.lslinux.org (91.121.81.130:80) libgcc-4.7.1-1.nsk 100% |*******************************| 711k 0:00:00 ETA >> (6/6) fetching package syslibs/uClibc Connecting to packages.lslinux.org (91.121.81.130:80) uClibc-0.9.33.2-1.ns 100% |*******************************| 343k 0:00:00 ETA >> checking dependencies... >> determining packages installation order... >> (1/6) installing package syscore/busybox [######################################################################] 100% Installing Busybox v1.20.2 links... 0 new links (0 created and 0 updated) 223 skipped links (222 already ok, 0 are files, 1 have no determined target) >> (2/6) installing package syscore/naska [######################################################################] 100% >> (3/6) installing package syscore/shrc [######################################################################] 100% >> (4/6) installing package syslibs/libgcc [######################################################################] 100% >> (5/6) installing package syslibs/uClibc [######################################################################] 100% >> (6/6) installing package syscore/baselayout [######################################################################] 100% >> Installing additional packages >> (1/4) fetching package dropbear Connecting to packages.lslinux.org (91.121.81.130:80) dropbear-2012.55-1.n 100% |*******************************| 158k 0:00:00 ETA >> (2/4) fetching package iptables Connecting to packages.lslinux.org (91.121.81.130:80) iptables-1.4.15-1.ns 100% |*******************************| 238k 0:00:00 ETA >> (3/4) fetching package keymaps-base Connecting to packages.lslinux.org (91.121.81.130:80) keymaps-base-0.1-1.n 100% |*******************************| 95085 0:00:00 ETA >> (4/4) fetching package syslibs/zlib Connecting to packages.lslinux.org (91.121.81.130:80) zlib-1.2.7-1.nsk 100% |*******************************| 49375 0:00:00 ETA >> checking dependencies... >> determining packages installation order... >> (1/4) installing package netapps/iptables [######################################################################] 100% >> (2/4) installing package syscore/keymaps-base [######################################################################] 100% Info : registered keymap service to 'boot' RC level >> (3/4) installing package syslibs/zlib [######################################################################] 100% >> (4/4) installing package netapps/dropbear [######################################################################] 100% >> Customizing debootstrap >> All done! Your LSL environnement is now available in /boot/ramfs (build time : 8s) root@lslinux ~ # cat /boot/ramfs/etc/hostname # Hostname hostname="mydbstrap" root@lslinux ~ #