Ajout de trunk, tags et branches.
authorhugo <hugo@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 25 Aug 2008 03:17:58 +0000 (03:17 +0000)
committerhugo <hugo@364a67c3-989e-7be9-548d-dae8560ea662>
Mon, 25 Aug 2008 03:17:58 +0000 (03:17 +0000)
308 files changed:
INSTALL [new file with mode: 0644]
NOTES [new file with mode: 0644]
QTP [new file with mode: 0644]
TODO [new file with mode: 0644]
functions [new file with mode: 0644]
functions-update [new file with mode: 0644]
packages-list [new file with mode: 0644]
stage1/INSTALL [new file with mode: 0644]
stage1/TODO [new file with mode: 0644]
stage1/cis-ac [new file with mode: 0755]
stage1/cis-bash [new file with mode: 0755]
stage1/cis-binutils-pass1 [new file with mode: 0755]
stage1/cis-binutils-pass2 [new file with mode: 0755]
stage1/cis-bzip2 [new file with mode: 0755]
stage1/cis-gcc-pass1 [new file with mode: 0755]
stage1/cis-gcc-pass2 [new file with mode: 0755]
stage1/cis-gettext [new file with mode: 0755]
stage1/cis-glibc [new file with mode: 0755]
stage1/cis-linux-api-headers [new file with mode: 0755]
stage1/cis-perl [new file with mode: 0755]
stage1/cis-stripping [new file with mode: 0755]
stage1/cis-toolchain-adjust [new file with mode: 0755]
stage1/cis-util-linux [new file with mode: 0755]
stage1/install-1 [new file with mode: 0755]
stage1/packages-update [new file with mode: 0755]
stage1/stage1-install [new file with mode: 0755]
stage2/INSTALL [new file with mode: 0644]
stage2/TODO [new file with mode: 0644]
stage2/bootscripts/checkfs [new file with mode: 0755]
stage2/bootscripts/dhcp [new file with mode: 0755]
stage2/bootscripts/functions [new file with mode: 0644]
stage2/bootscripts/halt [new file with mode: 0755]
stage2/bootscripts/ifdown [new file with mode: 0755]
stage2/bootscripts/ifup [new file with mode: 0755]
stage2/bootscripts/initlog [new file with mode: 0755]
stage2/bootscripts/keyboard [new file with mode: 0755]
stage2/bootscripts/modules [new file with mode: 0755]
stage2/bootscripts/mountfs [new file with mode: 0755]
stage2/bootscripts/mountkernfs [new file with mode: 0755]
stage2/bootscripts/mountnetfs [new file with mode: 0755]
stage2/bootscripts/network [new file with mode: 0755]
stage2/bootscripts/nfs [new file with mode: 0755]
stage2/bootscripts/portmap [new file with mode: 0755]
stage2/bootscripts/rc [new file with mode: 0755]
stage2/bootscripts/reboot [new file with mode: 0755]
stage2/bootscripts/sendsignals [new file with mode: 0755]
stage2/bootscripts/setclock [new file with mode: 0755]
stage2/bootscripts/sshd [new file with mode: 0755]
stage2/bootscripts/swap [new file with mode: 0755]
stage2/bootscripts/sysklogd [new file with mode: 0755]
stage2/bootscripts/udev [new file with mode: 0644]
stage2/bootscripts/udev_retry [new file with mode: 0755]
stage2/cis-ac [new file with mode: 0755]
stage2/cis-ac-nobuild [new file with mode: 0755]
stage2/cis-apr [new file with mode: 0755]
stage2/cis-binutils [new file with mode: 0755]
stage2/cis-bison [new file with mode: 0755]
stage2/cis-bootscripts [new file with mode: 0755]
stage2/cis-bzip2 [new file with mode: 0755]
stage2/cis-compressdoc [new file with mode: 0755]
stage2/cis-coreutils [new file with mode: 0755]
stage2/cis-db4 [new file with mode: 0755]
stage2/cis-dhcp [new file with mode: 0755]
stage2/cis-e2fsprogs [new file with mode: 0755]
stage2/cis-ed [new file with mode: 0755]
stage2/cis-emacs [new file with mode: 0755]
stage2/cis-findutils [new file with mode: 0755]
stage2/cis-flex [new file with mode: 0755]
stage2/cis-gcc [new file with mode: 0755]
stage2/cis-glibc [new file with mode: 0755]
stage2/cis-groff [new file with mode: 0755]
stage2/cis-grub [new file with mode: 0755]
stage2/cis-gzip [new file with mode: 0755]
stage2/cis-hv-utilities [new file with mode: 0755]
stage2/cis-iana [new file with mode: 0755]
stage2/cis-inetutils [new file with mode: 0755]
stage2/cis-iproute2 [new file with mode: 0755]
stage2/cis-kbd [new file with mode: 0755]
stage2/cis-kernel [new file with mode: 0755]
stage2/cis-man [new file with mode: 0755]
stage2/cis-man-pages [new file with mode: 0755]
stage2/cis-module-init-tools [new file with mode: 0755]
stage2/cis-ncurses [new file with mode: 0755]
stage2/cis-net-tools [new file with mode: 0755]
stage2/cis-nfs-utils [new file with mode: 0755]
stage2/cis-openssh [new file with mode: 0755]
stage2/cis-openssl [new file with mode: 0755]
stage2/cis-pam [new file with mode: 0755]
stage2/cis-pciutils [new file with mode: 0755]
stage2/cis-perl [new file with mode: 0755]
stage2/cis-pkg-config [new file with mode: 0755]
stage2/cis-popt [new file with mode: 0755]
stage2/cis-portmap [new file with mode: 0755]
stage2/cis-post-install [new file with mode: 0755]
stage2/cis-procps [new file with mode: 0755]
stage2/cis-psmisc [new file with mode: 0755]
stage2/cis-readline [new file with mode: 0755]
stage2/cis-reiserfsprogs [new file with mode: 0755]
stage2/cis-shadow [new file with mode: 0755]
stage2/cis-stripping [new file with mode: 0755]
stage2/cis-sudo [new file with mode: 0755]
stage2/cis-sysklogd [new file with mode: 0755]
stage2/cis-sysvinit [new file with mode: 0755]
stage2/cis-tcp-wrappers [new file with mode: 0755]
stage2/cis-texinfo [new file with mode: 0755]
stage2/cis-toolchain-adjust [new file with mode: 0755]
stage2/cis-udev [new file with mode: 0755]
stage2/cis-udev-config [new file with mode: 0755]
stage2/cis-util-linux [new file with mode: 0755]
stage2/cis-zlib [new file with mode: 0755]
stage2/create-config-files [new file with mode: 0755]
stage2/create-groups [new file with mode: 0755]
stage2/create-users [new file with mode: 0755]
stage2/hv-utilities/camera-download [new file with mode: 0755]
stage2/hv-utilities/cd-copy [new file with mode: 0755]
stage2/hv-utilities/cd-erase [new file with mode: 0755]
stage2/hv-utilities/crypt.pl [new file with mode: 0755]
stage2/hv-utilities/distro-backup [new file with mode: 0755]
stage2/hv-utilities/dos2unix [new file with mode: 0755]
stage2/hv-utilities/dvd-ram-format [new file with mode: 0755]
stage2/hv-utilities/fix-avi [new file with mode: 0755]
stage2/hv-utilities/gztobz2 [new file with mode: 0755]
stage2/hv-utilities/hv-backup [new file with mode: 0755]
stage2/hv-utilities/hv-video-dvd [new file with mode: 0755]
stage2/hv-utilities/mail-files [new file with mode: 0755]
stage2/hv-utilities/mail-if-fail [new file with mode: 0755]
stage2/hv-utilities/mail-statistics [new file with mode: 0755]
stage2/hv-utilities/media-write [new file with mode: 0755]
stage2/hv-utilities/pstopdf [new file with mode: 0755]
stage2/hv-utilities/replace.pl [new file with mode: 0755]
stage2/hv-utilities/rotatelogs [new file with mode: 0755]
stage2/hv-utilities/setdate [new file with mode: 0755]
stage2/hv-utilities/strip-debug-symbols [new file with mode: 0755]
stage2/hv-utilities/tildes-clean [new file with mode: 0755]
stage2/install-1 [new file with mode: 0755]
stage2/install-2 [new file with mode: 0755]
stage2/makedir [new file with mode: 0755]
stage2/misc/DIR_COLORS [new file with mode: 0644]
stage2/misc/compressdoc [new file with mode: 0755]
stage2/packages-update [new file with mode: 0755]
stage2/setup [new file with mode: 0755]
stage2/stage2-additions [new file with mode: 0755]
stage2/stage2-install [new file with mode: 0755]
stage2/symlinks [new file with mode: 0755]
stage3/INSTALL [new file with mode: 0644]
stage3/TODO [new file with mode: 0644]
stage3/bootscripts/alsa [new file with mode: 0755]
stage3/bootscripts/apache [new file with mode: 0755]
stage3/bootscripts/clamav [new file with mode: 0755]
stage3/bootscripts/cups [new file with mode: 0755]
stage3/bootscripts/dbus [new file with mode: 0755]
stage3/bootscripts/fcron [new file with mode: 0755]
stage3/bootscripts/firewall [new file with mode: 0755]
stage3/bootscripts/firewire [new file with mode: 0755]
stage3/bootscripts/fwplugd [new file with mode: 0755]
stage3/bootscripts/hald [new file with mode: 0755]
stage3/bootscripts/inetd [new file with mode: 0755]
stage3/bootscripts/mailman [new file with mode: 0755]
stage3/bootscripts/milter-greylist [new file with mode: 0755]
stage3/bootscripts/milter-spf [new file with mode: 0755]
stage3/bootscripts/mysql [new file with mode: 0755]
stage3/bootscripts/named [new file with mode: 0755]
stage3/bootscripts/openldap [new file with mode: 0755]
stage3/bootscripts/pulseaudio [new file with mode: 0755]
stage3/bootscripts/samba [new file with mode: 0755]
stage3/bootscripts/saslauthd [new file with mode: 0755]
stage3/bootscripts/sendmail [new file with mode: 0755]
stage3/cis-ac [new symlink]
stage3/cis-ac-nobuild [new symlink]
stage3/cis-alsa-lib [new file with mode: 0755]
stage3/cis-alsa-utils [new file with mode: 0755]
stage3/cis-apache [new file with mode: 0755]
stage3/cis-audacity [new file with mode: 0755]
stage3/cis-bind [new file with mode: 0755]
stage3/cis-boost [new file with mode: 0755]
stage3/cis-cdrtools [new file with mode: 0755]
stage3/cis-clamav [new file with mode: 0755]
stage3/cis-cups [new file with mode: 0755]
stage3/cis-dbus [new file with mode: 0755]
stage3/cis-ddclient [new file with mode: 0755]
stage3/cis-docbook-dsssl [new file with mode: 0755]
stage3/cis-docbook-utils [new file with mode: 0755]
stage3/cis-docbook-xml [new file with mode: 0755]
stage3/cis-docbook-xsl [new file with mode: 0755]
stage3/cis-dvd-rw-tools [new file with mode: 0755]
stage3/cis-emacs [new file with mode: 0755]
stage3/cis-espgs [new file with mode: 0755]
stage3/cis-fcron [new file with mode: 0755]
stage3/cis-firefox [new file with mode: 0755]
stage3/cis-firewire [new file with mode: 0755]
stage3/cis-flashplugin [new file with mode: 0755]
stage3/cis-fontconfig [new file with mode: 0755]
stage3/cis-fox [new file with mode: 0755]
stage3/cis-gcc3 [new file with mode: 0755]
stage3/cis-getdate [new file with mode: 0755]
stage3/cis-git-manpages [new file with mode: 0755]
stage3/cis-gsview [new file with mode: 0755]
stage3/cis-guile [new file with mode: 0755]
stage3/cis-hal [new file with mode: 0755]
stage3/cis-inetutils [new file with mode: 0755]
stage3/cis-iptables [new file with mode: 0755]
stage3/cis-jadetex [new file with mode: 0755]
stage3/cis-java [new file with mode: 0755]
stage3/cis-krb5 [new file with mode: 0755]
stage3/cis-libid3tag [new file with mode: 0755]
stage3/cis-libmad [new file with mode: 0755]
stage3/cis-libmng [new file with mode: 0755]
stage3/cis-libusb [new file with mode: 0755]
stage3/cis-ltsp [new file with mode: 0755]
stage3/cis-ltsp-utils [new file with mode: 0755]
stage3/cis-mailman [new file with mode: 0755]
stage3/cis-milter-greylist [new file with mode: 0755]
stage3/cis-milter-spf [new file with mode: 0755]
stage3/cis-mplayer [new file with mode: 0755]
stage3/cis-mplayer-codecs [new file with mode: 0755]
stage3/cis-mysql [new file with mode: 0755]
stage3/cis-nss [new file with mode: 0755]
stage3/cis-openjade [new file with mode: 0755]
stage3/cis-openldap [new file with mode: 0755]
stage3/cis-opensp [new file with mode: 0755]
stage3/cis-opera [new file with mode: 0755]
stage3/cis-php [new file with mode: 0755]
stage3/cis-pm [new file with mode: 0755]
stage3/cis-pm-net-dns [new file with mode: 0755]
stage3/cis-postinstall [new file with mode: 0755]
stage3/cis-procmail [new file with mode: 0755]
stage3/cis-pulseaudio [new file with mode: 0755]
stage3/cis-qt [new file with mode: 0755]
stage3/cis-samba [new file with mode: 0755]
stage3/cis-sane-backends [new file with mode: 0755]
stage3/cis-sasl2 [new file with mode: 0755]
stage3/cis-sendmail [new file with mode: 0755]
stage3/cis-sgml-common [new file with mode: 0755]
stage3/cis-sgml-dtd3 [new file with mode: 0755]
stage3/cis-sgml-dtd4 [new file with mode: 0755]
stage3/cis-sgml-spm [new file with mode: 0755]
stage3/cis-spamassassin [new file with mode: 0755]
stage3/cis-squirrelmail [new file with mode: 0755]
stage3/cis-subversion [new file with mode: 0755]
stage3/cis-t1lib [new file with mode: 0755]
stage3/cis-tcl [new file with mode: 0755]
stage3/cis-tetex [new file with mode: 0755]
stage3/cis-tftp-hpa [new file with mode: 0755]
stage3/cis-tk [new file with mode: 0755]
stage3/cis-uml-utilities [new file with mode: 0755]
stage3/cis-unzip [new file with mode: 0755]
stage3/cis-uw-imap [new file with mode: 0755]
stage3/cis-windowmaker [new file with mode: 0755]
stage3/cis-xfe [new file with mode: 0755]
stage3/cis-xfree86 [new file with mode: 0755]
stage3/cis-xmltoman [new file with mode: 0755]
stage3/cis-xsane [new file with mode: 0755]
stage3/cis-xvidcore [new file with mode: 0755]
stage3/cis-zip [new file with mode: 0755]
stage3/packages-update [new file with mode: 0755]
stage3/resources/ColorGNU.xpm [new file with mode: 0644]
stage3/resources/mail-files.sh [new file with mode: 0755]
stage3/stage3-additions [new file with mode: 0755]
stage3/stage3-install [new file with mode: 0755]
stage4/TODO [new file with mode: 0644]
stage4/cis-ac [new symlink]
stage4/cis-ac-nobuild [new symlink]
stage4/cis-evolution [new file with mode: 0755]
stage4/cis-evolution-data-server [new file with mode: 0755]
stage4/cis-evolution-exchange [new file with mode: 0755]
stage4/cis-gail [new file with mode: 0755]
stage4/cis-gal [new file with mode: 0755]
stage4/cis-gdm [new file with mode: 0755]
stage4/cis-gedit [new file with mode: 0755]
stage4/cis-gnome [new file with mode: 0755]
stage4/cis-gnome-applets [new file with mode: 0755]
stage4/cis-gnome-audio [new file with mode: 0755]
stage4/cis-gnome-config [new file with mode: 0755]
stage4/cis-gnome-media [new file with mode: 0755]
stage4/cis-gnome-mime-data [new file with mode: 0755]
stage4/cis-gnome-nobuild [new file with mode: 0755]
stage4/cis-gnumeric [new file with mode: 0755]
stage4/cis-iso-codes [new file with mode: 0755]
stage4/cis-libmusicbrainz [new file with mode: 0755]
stage4/cis-metacity [new file with mode: 0755]
stage4/cis-nautilus [new file with mode: 0755]
stage4/cis-pcre [new file with mode: 0755]
stage4/cis-scrollkeeper [new file with mode: 0755]
stage4/cis-vte [new file with mode: 0755]
stage4/packages-update [new file with mode: 0644]
stage4/stage4-additions [new file with mode: 0755]
stage4/stage4-install [new file with mode: 0755]
stage5/README [new file with mode: 0644]
stage5/TODO [new file with mode: 0644]
stage5/cis-ac [new symlink]
stage5/cis-ac-nobuild [new symlink]
stage5/cis-avr-libc [new file with mode: 0755]
stage5/cis-avrdude [new file with mode: 0755]
stage5/cis-binutils [new file with mode: 0755]
stage5/cis-gcc1 [new file with mode: 0755]
stage5/cis-gcc2 [new file with mode: 0755]
stage5/cis-gdb [new file with mode: 0755]
stage5/cis-glibc [new file with mode: 0755]
stage5/cis-kernel [new file with mode: 0755]
stage5/cis-newlib [new file with mode: 0755]
stage5/packages-update [new file with mode: 0755]
stage5/stage5-additions [new file with mode: 0755]
stage5/stage5-install-arm [new file with mode: 0644]
stage5/stage5-install-avr [new file with mode: 0755]
stage5/stage5-install-geda [new file with mode: 0755]
stage5/stage5-install-ppc [new file with mode: 0755]
sysinfos.server [new file with mode: 0644]
sysinfos.workstn [new file with mode: 0644]

diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..1f5c3f2
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,43 @@
+
+Installation instructions
+-------------------------
+
+The installation is done in 3 steps:
+
+   Stage1: Creation of a 'static' directory to contain
+           only the minimal tools required to build our
+           minimal Linux system, using only static linking.
+   Stage2: This will build a minimal Linux system, which is
+           bootable and configured for network operations.
+   Stage3: This adds all the tools and programs to build a
+           complete Linux system. This means X support for
+           workstations, and web and mail servers support
+           when installing for a server.
+
+This is the directory structure you must have to begin with:
+
+sources/
+|--packages
+\--scripts
+
+The "packages" directory must contain all the source code packages, with
+the ".tar.bz2" extensions, as well as all the patches.
+
+You can create the directory structure by using these commands:
+
+     mkdir -p sources/packages
+     mv hvlinux sources/scripts
+
+To begin the installation, enter the "sources/scripts" directory. You
+must first create a file called 'sysinfos' in this directory,
+containing informations about your hardware, network  settings and
+installation type among other things.
+You can use the following two files as templates:
+   Server installation:      use the sample file 'sysinfos.server'
+   Workstation installation: use the sample file 'sysinfos.workstn'
+
+Next, enter each of the stages directories starting with 'stage1',  and
+read the INSTALL file for how to start the installation for that stage.
+
+Hugo Villeneuve
+hugo@hugovil.com
diff --git a/NOTES b/NOTES
new file mode 100644 (file)
index 0000000..511979e
--- /dev/null
+++ b/NOTES
@@ -0,0 +1,31 @@
+
+August 30th, 2004 [matt]: -funit-at-a-time is implied by -O2, and it was this specific option that was causing the runtime problems with sfdisk. Instead of dropping to -O1 optimisation, we simply prevent the problematic optimisation by specifying -fno-unit-at-a-time.
+
+------------------------------------------
+
+Reduces-size hvlinux
+
+-Compile not often used packages with -Os instead of -O2 or -O3
+-Remove vim documentation (/usr/share/vim)
+-Remove grub support files (/usr/share/grub)
+-Remove kernel sources after compilation.
+-Compress man and info pages.
+-Strip all programs and libraries.
+-Don't install man pages and man packages.
+-Don't install texinfo
+-Remove /usr/share/zoneinfo (copy timezone directly to /etc).
+-
+
+
+-Remove /bin/{bashbug,head,lesskey}
+
+-Remove /sbin/{mkfs.bfs,mkfs.cramfs,mkfs.minix,resize*,sfdisk,reiserfstune,elvtune}
+-Remove /sbin/{cfdisk,blockdev,fsck.cramfs,fsck.minix}
+-Remove /usr/sbin/{nfsstat,nhfs*,readprofile,tunelp,zdump,zic}
+
+-Remove /usr/bin/{afmtodit,bzcmp,bzdiff...,c2ph,capinfo,chkdupexe,dprofpp,
+       znew,zmore,zgrep,zless,zforce,zdiff,xxd,vimtutor,glibcbug,h2ph,h2xs,hpftodit
+       pfbtops,pic,pic2graph,piconv,pl2pm,pod*,post-gro...,pre-gro...,psf*,gccbug,
+       perlbug,grolj4,perldoc,a2p,addtinfo,addr2line,cytune,enc2xs,eqn,eqn2graph,
+       infotocap,neonconfig
+-Remove /usr/lib//*.{a,la}
diff --git a/QTP b/QTP
new file mode 100644 (file)
index 0000000..170b355
--- /dev/null
+++ b/QTP
@@ -0,0 +1,26 @@
+
+QTP (Quality Test Procedure) for server
+
+1. Tester update de l'adresse IP dynamique (ddclient)
+
+2. Tester serveur IMAP (créer des répertoires)
+
+3. Tester Sendmail
+
+4. Tester Clam AV
+
+5. Tester clamupdate
+
+6. Tester SquirrelMail
+
+7. Tester MyOrgBook avec les notifications
+
+8. Tester Subversion + websvn
+
+9. Tester BIND DNS server
+
+10. Tester NFS serveur et client
+
+11. Tester proxy (JunkBuster)
+
+12. Tester Firewall
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..b729b1e
--- /dev/null
+++ b/TODO
@@ -0,0 +1,118 @@
+
+                      TODO
+
+-tar -tf $tarball | head -n1 --> pour extraire le nom du répertoire root
+ du package automatiquement...
+
+basename $(tar -tf mozilla-3.0.1.tar.bz2 | head -n1)
+
+
+-Dans le fichier packages-list, utiliser un array pour
+ définir le nom du module et l'hyperlien pour le télécharger:
+    BASH[0]=bash-3.0.2
+    BASH[1]=gnu
+    BZIP2[0]=bzip2-1.0.1
+    BZIP2[1]=http://www.bzip.org/$(get_pkg_ver ${BZIP2})
+
+-Enlever automatiquement les patches antérieures du style:
+ [module]-[version]-[nom_patch]-[version_patch]
+
+-DBUS: Chaque usager doit ajouter 'dbus-launch' dans son
+       fichier ~/.xsession ou ~/.xinitrc
+
+-webalizer: needs gd-2.0.33
+
+-install guitartex et lilypond automatiquement:
+
+-lilypond:
+  -fontforge
+  -mftrace -> t1utils
+           -> autotrace
+
+-installer modes emacs: php, html, css, etc.
+
+-cur_dir: set automatically in install_package() (see cis-mailman)
+
+-install gdb.
+
+-syslog -r est nécessaire pour LTSP:
+ revenir Ã  syslog-ng pour avoir un répertoire
+ séparé pour chaque host?
+-newsyslog: vérifier if newsyslog is activated in fcrontab.
+ check for syntax errors lines 46 & 57
+
+-nfs-bootscript: vérifier et simplifier
+
+-problème en lançant telinit 5 --> vérifier les bootscripts?
+
+-uw-imap: use config files instead of modifying Makefiles.
+
+-Automatically install Acrobat Reader?
+
+SPIP: mysql database name:
+  localhost :(
+  localhost.localdomain :)
+
+-bc-1.06 : plus de patches disponibles sur le site lfs (ils ont
+ seulement la nouvelle version)...
+
+-Compiler certains packages en parallèle (système de dependences)
+
+-packages-list: prefixer chaque variabler avec "HVPKG_" pour eviter les bugs
+
+-Combiner stageX-install et packages-update. stageX-install devrait accepter
+ les arguments:
+   fetch : download packages
+   "PACKAGE" : only install or fetch PACKAGE
+   CHECK: Check if a package is installed/fetched and report version.
+  En mode fetch, cela va permettre de ne downloader que les packages nécessaires
+  selon le type d'installation (workstation ou serveur). Par contre, certains
+  packages décompressent certains fichiers automatiquement, donc il faudrait trouver
+  une façon de les downloader aussi.
+
+-ldconfig et source /etc/profile: Ã©xécuter automatiquement après chaque installation
+ d'un package.
+
+-stageX-install: si un package n'est pas disponible, le downloader automatiquement?
+
+-Mettre "local" devant chaque variable des fonctions dans functions et functions-update.
+
+-BIND: run in IPV4 mode only (option "-4")
+-Remove /home/named/var/run/named.run dans le start/stop script au début?
+
+-installer libcroco pour librsvg?
+
+Mounting network volumes: check if networking is up.
+
+Check if reinstall of inetd at stage3 is necessary?
+
+Octave: install gnuplot
+        f2c --> install src/f2c /usr/bin
+                install src/f2c.h /usr/include
+                install libf2c/libf2c.a /usr/lib
+       flex-2.5.4? --> temporarirement dans /opt...
+
+reboot ne fonctionne pas... (must be superuser) même avec l'usager
+dans /etc/shutdown.allow
+Permettre aux usagers de rebooter (sauf pour serveur):
+  chmod u+s /sbin/halt
+
+Simplifier fonction 'var_add()'
+
+Simplify scanner support in sysinfos
+
+Copier sysinfos dans "/etc/sysinfos" par exemple pour permettre
+l'installation Ã  partir d'un CD. Cela implique que l'usager
+doit définir la variable d'environnement LFS et que les scripts
+doivent l'exporter automatiquement (ne doit plus Ãªtre lue Ã  partir
+du fichier sysinfos).
+
+Ajouter une variable "package_location" dans sysinfos
+
+Faire un script de test (tester la présence de certains programmes Ã  la
+toute fin de l'installation (ou dans chaque script d'installation)
+
+Vérifier si tous les packages acceptent correctement les CFLAGS. Sinon, les passer
+directement au script...
+
+"ls --timestyle=long-iso" --> /etc/bashrc ???
diff --git a/functions b/functions
new file mode 100644 (file)
index 0000000..a986466
--- /dev/null
+++ b/functions
@@ -0,0 +1,1108 @@
+#!/bin/sh
+# This file is 'sourced' by other scripts, therefore the above line is of no
+# use, except when modifying the file in emacs to have syntax highlighting.
+
+# Constants for return codes
+EXIT_SUCCESS=0
+EXIT_WARNING=1
+EXIT_FAILURE=2
+
+# The starting position for displaying the "X" sign inside the check box [ ]
+CHECK_POSITION=2
+SET_CHECK_POSITION="echo -en \\033[${CHECK_POSITION}G"
+
+# NORMAL prints text in normal color
+NORMAL="echo -en \\033[0;39m"
+# SUCCESS prints text in a green colour
+SUCCESS="echo -en \\033[1;32m"
+# WARNING prints text in a yellow colour
+WARNING="echo -en \\033[1;33m"
+# FAILURE prints text in a red colour
+FAILURE="echo -en \\033[1;31m"
+
+
+# Extracting the version number from a complete package name.
+# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4.4)
+get_pkg_ver()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    echo ${1} | sed "s!^.*-\(.*\)!\1!g"
+}
+
+
+# Extracting the base version number from a complete package name.
+# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4)
+get_pkg_ver_base()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\).*!\1!g"
+}
+
+
+# Extracting the base version number from a complete package name.
+# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3)
+get_pkg_ver_major()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g"
+}
+
+
+# Extracting the name from a complete package name.
+# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output gcc)
+get_pkg_name()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    echo ${1} | sed "s!^\(.*\)-.*!\1!g"
+}
+
+
+# Saves the content of CFLAGS and CXXFLAGS environment variables.
+save_flags()
+{
+    export OLDCFLAGS=${CFLAGS}
+    export OLDCXXFLAGS=${CXXFLAGS}
+
+    return ${EXIT_SUCCESS}
+}
+
+
+# Saves the content of CFLAGS and CXXFLAGS environment variables, and then
+# set them to empty strings.
+save_flags_no_optimizations()
+{
+    export OLDCFLAGS=${CFLAGS}
+    export OLDCXXFLAGS=${CXXFLAGS}
+    export CFLAGS=""
+    export CXXFLAGS=""
+
+    return ${EXIT_SUCCESS}
+}
+
+
+# Restores the previous values of CFLAGS and CXXFLAGS environment variables. These
+# must have been saved first using save_flags().
+restore_flags()
+{
+    export CFLAGS=${OLDCFLAGS}
+    export CXXFLAGS=${OLDCXXFLAGS}
+
+    return ${EXIT_SUCCESS}
+}
+
+
+# Create log directory and log file for current stage if necessary
+# This should be done automatically...
+init_log_file()
+{
+    mkdir -p ${LFS_LOG_DIR} &&
+    if [ ! -f ${LFS_LOG_FILE} ]; then
+        touch ${LFS_LOG_FILE} || exit 1
+    fi
+}
+
+
+# Create symbolic links for start/stop scripts in /etc/rc.d
+#
+# Arg #1: script name
+# Arg #2: start number
+# Arg #3: stop number
+# Arg #4: level
+static_bootscript_add()
+{
+    local SCRIPTNAME=${1}
+    local START=${2}
+    local STOP=${3}
+    local RCLEVEL=${4}
+
+    local START_LEVELS=""
+    local STOP_LEVELS=""
+
+    if [ "x${RCLEVEL}" = "xS" ]; then
+       START_LEVELS="S"
+       STOP_LEVELS="0 6"
+    elif [ "x${RCLEVEL}" = "x3" ]; then
+       START_LEVELS="3 4 5"
+       STOP_LEVELS="0 1 2 6"
+    else
+       echo "${FUNCNAME}(), invalid level argument : ${*}"
+       return 1
+    fi
+    
+    # Making sure bootscript has correct permissions
+    chmod -v 740 /etc/rc.d/init.d/${SCRIPTNAME} &&
+
+    # Removing any old links
+    for level in S 0 1 2 3 4 5 6; do
+        cd /etc/rc.d/rc${level}.d &&
+       rm -v -f $(find . -name "???${SCRIPTNAME}") || exit 1
+    done &&
+
+    if [ ${START} -ne 0 ]; then
+       # Creating new start links
+       for level in ${START_LEVELS}; do
+           cd /etc/rc.d/rc${level}.d &&
+           ln -v -s ../init.d/${SCRIPTNAME} S${START}${SCRIPTNAME} || exit 1
+       done
+    fi &&
+
+    if [ ${STOP} -ne 0 ]; then
+       # Creating new stop links
+       for level in ${STOP_LEVELS}; do
+           cd /etc/rc.d/rc${level}.d &&
+           ln -v -s ../init.d/${SCRIPTNAME} K${STOP}${SCRIPTNAME} || exit 1
+       done
+    fi
+}
+
+
+# Create symbolic links for start/stop scripts in /etc/rc.d
+#
+# Arg #1: level
+# Arg #2: script name
+# Arg #3: start number
+# Arg #4: stop number
+bootscript_add_manual()
+{
+    local RCLEVEL=${1}
+    local SCRIPTNAME=${2}
+    local START=${3}
+    local STOP=${4}
+
+    # Making sure bootscript has correct permissions
+    chmod 740 /etc/rc.d/init.d/${SCRIPTNAME} &&
+
+    # Removing any old links
+    cd /etc/rc.d/rc${RCLEVEL}.d &&
+    rm -v -f $(find . -name "???${SCRIPTNAME}") &&
+
+    if [ ${START} -ne 0 ]; then
+       # Creating new start link
+       cd /etc/rc.d/rc${RCLEVEL}.d &&
+       ln -v -s ../init.d/${SCRIPTNAME} S${START}${SCRIPTNAME} || exit 1
+    fi &&
+
+    if [ ${STOP} -ne 0 ]; then
+       # Creating new stop link
+       cd /etc/rc.d/rc${RCLEVEL}.d &&
+       ln -v -s ../init.d/${SCRIPTNAME} K${STOP}${SCRIPTNAME} || exit 1
+    fi
+}
+
+
+# Create symbolic links for start/stop scripts in /etc/rc.d
+#
+# Arg #1: script name
+# Arg #2: start number
+# Arg #3: stop number
+bootscript_add_rc3()
+{
+    static_bootscript_add ${*} 3
+}
+
+
+# Create symbolic links for start/stop scripts in /etc/rc.d
+#
+# Arg #1: script name
+# Arg #2: start number
+# Arg #3: stop number
+bootscript_add_rcS()
+{
+    static_bootscript_add ${*} S
+}
+
+
+# Add "export" before the variable name
+#
+# Arg #1: variable name
+# Arg #2: filename where the variable is located
+var_export()
+{
+    VARIABLE=${1}
+    FILE=${2}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+    
+    # Checking if file exists
+    if [ ! -f ${FILE} ]; then
+       echo "${FUNCNAME}(), file not found: ${FILE}"
+       return 1
+    fi
+
+    # Checking if variable exists
+    if ! grep "${VARIABLE}=" ${FILE} 1> /dev/null 2>&1; then
+       echo "${FUNCNAME}(), variable not found: ${VARIABLE}"
+       return 1
+    fi
+
+    # Checking if variable is already exported when it is defined
+    if grep "${VARIABLE}=" ${FILE} | grep "export " 1> /dev/null 2>&1; then
+       echo "${FUNCNAME}(), variable already exported in definition: ${VARIABLE}"
+       return 0
+    fi
+
+    # Checking if variable is already exported, in
+    # a "export VARIABLE1 VARIABLE2..." statement
+    if grep "export " ${FILE} | grep " ${VARIABLE}" 1> /dev/null 2>&1; then
+       echo "${FUNCNAME}(), variable already exported in export list: ${VARIABLE}"
+       return 0
+    fi
+
+    sed -i "s!\(^${VARIABLE}=.*\)!export \1!" ${FILE}
+}
+
+
+# Adding a new environment variable to a file.
+#
+# Arg #1: variable name
+# Arg #2: filename where the variable is located
+# Arg #3: new variable value
+# Arg #4: separator string (usually a " " or ":")
+var_add()
+{
+    VARIABLE=${1}
+    FILE=${2}
+    VALUE="${3}"
+    SEP="${4}"
+
+    # Checking for correct number of arguments
+    if [ $# -ne 4 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+    
+    # Checking if file exists
+    if [ ! -f ${FILE} ]; then
+       echo "${FUNCNAME}(), file not found: ${FILE}"
+       return 1
+    fi
+
+    # Checking if variable exists
+    if ! grep "${VARIABLE}=" ${FILE} 1> /dev/null 2>&1; then
+       echo "${VARIABLE}=\"${VALUE}\"" >> ${FILE}
+       return $?
+    fi
+
+    # Checking if variable contains the new value
+    if grep "${VARIABLE}=" ${FILE} | grep "${VALUE}" 1> /dev/null 2>&1; then
+       echo "${FUNCNAME}(), variable ${VARIABLE} already contains value: ${VALUE}"
+       return 0
+    fi
+
+    # Adding new value to variable (case where no export before)
+    # We search for the variable name starting at the beginning of the line
+    # For example, this ensures that if the variable name is PATH, then
+    # PATH=... matches but not MANPATH=...
+    if grep "^${VARIABLE}=\"" ${FILE} 1> /dev/null 2>&1; then
+       # Variable value is enclosed by double-quotes
+       sed -i "s!\(^${VARIABLE}=\".*\)\(\"\)!\1${SEP}${VALUE}\"!" ${FILE}
+    else
+       # Variable value is NOT enclosed by double-quotes
+       sed -i "s!\(^${VARIABLE}=.*\)!\1${SEP}${VALUE}!" ${FILE}
+    fi
+    evaluate_retval
+
+    # Adding new value to variable (case with export before)
+    # We search for the variable name starting after an export statement,
+    # at the beginning of a line.
+    # For example, this ensures that if the variable name is PATH, then
+    # PATH=... matches but not MANPATH=...
+    if grep "^export ${VARIABLE}=\"" ${FILE} 1> /dev/null 2>&1; then
+       # Variable value is enclosed by double-quotes
+       sed -i "s!\(^export ${VARIABLE}=\".*\)\(\"\)!\1${SEP}${VALUE}\"!" ${FILE}
+    else
+       # Variable value is NOT enclosed by double-quotes
+       sed -i "s!\(^export ${VARIABLE}=.*\)!\1${SEP}${VALUE}!" ${FILE}
+    fi
+    
+    return $?
+}
+
+
+# Adding a new path environment variable to a file.
+#
+# Arg #1: variable name
+# Arg #2: filename where the variable is located
+# Arg #3: new variable value
+var_add_path()
+{
+    var_add ${1} ${2} "${3}" ":" 1>> ${LFS_LOG_FILE} 2>&1
+}
+
+
+# Adding a new string environment variable to a file.
+#
+# Arg #1: variable name
+# Arg #2: filename where the variable is located
+# Arg #3: new variable value
+var_add_str()
+{
+    var_add ${1} ${2} "${3}" " "
+}
+
+
+# Adding a new string to a file.
+#
+# Arg #1: string
+# Arg #2: filename where the variable is located
+string_add()
+{
+    STRING="${1}"
+    FILE=${2}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+    
+    # Checking if file exists
+    if [ ! -f ${FILE} ]; then
+       echo "${FUNCNAME}(), file not found: ${FILE}"
+       return 1
+    fi
+
+    # Checking if string exists
+    if grep "${STRING}" ${FILE} 1> /dev/null 2>&1; then
+       echo "${FUNCNAME}(), string already defined: ${STRING}"
+       return 0
+    fi
+    
+    echo "${STRING}" >> ${FILE}
+}
+
+
+# Adding a new environment variable to a shadow password suite file (login.defs)
+#
+# Arg #1: variable name
+# Arg #2: filename where the variable is located
+# Arg #3: new variable value
+var_add_shadow()
+{
+    VARIABLE=${1}
+    FILE=${2}
+    VALUE="${3}"
+
+    # Checking for correct number of arguments
+    if [ $# -ne 3 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+    
+    # Checking if file exists
+    if [ ! -f ${FILE} ]; then
+       echo "${FUNCNAME}(), file not found: ${FILE}"
+       return 1
+    fi
+
+    # Checking if variable contains the new value
+    if egrep "^${VARIABLE}" ${FILE} | grep "${VALUE}" 1> /dev/null 2>&1; then
+       echo "variable ${VARIABLE} already contains value: ${VALUE}"
+       exit 0
+    fi
+
+    # Adding new value to variable
+    # We search for the variable name starting at the beginning of the line
+    # For example, this ensures that if the variable name is PATH, then
+    # PATH... matches but not MANPATH...
+    sed -i "s!\(^${VARIABLE}.*\)!\1:${VALUE}!" ${FILE}
+}
+
+
+# Adding a new group, checking if it already exist before.
+# Arguments: same arguments as for standard groupadd command.
+hv_groupadd()
+{
+    arguments=${*}
+
+    while [ $# -ne 0 ]; do
+       last_argument=${*}
+       shift
+    done
+    
+    groupadd ${arguments}
+
+    if [ $? -eq 0 -o $? -eq 9 ]; then
+        # 9 means the group already exists
+        return ${EXIT_SUCCESS}
+    else
+        exit ${EXIT_FAILURE}
+    fi
+}
+
+# Adding a new user, checking if it already exist before
+# Arguments: same arguments as for standard useradd command.
+hv_useradd()
+{
+    arguments="${*}"
+
+    # The last argument is the username
+    while [ $# -ne 0 ]; do
+       last_argument=${*}
+       shift
+    done
+
+    useradd ${arguments}
+
+    if [ $? -eq 0 -o $? -eq 9 ]; then
+        # 9 means the user already exists
+        return ${EXIT_SUCCESS}
+    else
+        exit ${EXIT_FAILURE}
+    fi
+}
+    
+
+# Evaluates the return value of the process that was run just before this
+# function was called.
+evaluate_retval()
+{
+    if [ $? -ne 0 ]; then
+       echo "*************"
+       echo "*   ERROR   *"
+       echo "*************"
+       exit 1
+    fi
+}
+
+# Evaluates the return value of the process that was run just before this
+# function was called.
+eval_retval2()
+{
+    if [ $? -ne 0 ]; then
+        ${SET_CHECK_POSITION}
+       print_status failure
+       echo
+       exit ${EXIT_FAILURE}
+    fi
+}
+
+
+
+
+# Obtain the name of the base directory for the decompressed package.
+# First argument: package name
+static_decompressed_dirname()
+{
+    local PACKAGE=${1}
+
+    local DIRNAME=$(dirname $(tar -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1))
+
+    if [ "x${DIRNAME}" == "x." ]; then
+        DIRNAME=$(basename $(tar -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1))
+    fi
+
+    echo ${DIRNAME}
+}
+
+
+# Applying any patch(es) found for the current package.
+# Will work only if patches have the same base name as
+# the package, followed by a dash:
+#    ${1}-*.patch
+#
+# 1st argument: Package name
+# 2: optional target directory.
+apply_patches()
+{
+    PACKAGE=${1}
+    local TARGET_DIR=${PACKAGE}
+
+    # Checking for correct number of arguments
+    if [ $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       echo "Usage: ${FUNCNAME} PACKAGE-NAME"
+       exit ${EXIT_FAILURE}
+    fi
+    
+    if [ $# -eq 2 ]; then
+       TARGET_DIR=${2}
+    else
+       TARGET_DIR=$(static_decompressed_dirname ${PACKAGE})
+    fi
+    
+    # Checking if we can find at least one patch.
+    if ls ${LFS_PKG_DIR}/${1}-*.patch 1> /dev/null 2>&1; then
+       cd ${LFS_PKG_DIR}
+       for patch in ${1}-*.patch; do
+           echo "******************************"
+           echo "* Applying patch: ${patch}"
+           echo "******************************"
+           patch -Np1 -d ${LFS_TMP}/${TARGET_DIR} -i ${LFS_PKG_DIR}/${patch} || exit 1
+       done
+    fi
+
+    return $?
+}
+
+
+# Applying patch
+# First argument is the name of the patch
+# Second argument is the package name
+apply_patch()
+{
+    PATCH_FILE=${1}
+    PACKAGE=${2}
+
+    if [ -z "${PATCH_FILE}" ]; then
+        echo
+       echo "apply_patch(): no patch specified."
+       return ${EXIT_FAILURE}
+    fi
+
+    if [ ! -f ${LFS_PKG_DIR}/${PATCH_FILE} ]; then
+        echo
+       echo "${FUNCNAME}(): patch file '${PATCH_FILE}' not found."
+       return ${EXIT_FAILURE}
+    fi
+
+    echo "******************************"
+    echo "* Applying patch: ${PATCH_FILE}"
+    echo "******************************"
+    patch -Np1 -d ${LFS_TMP}/${PACKAGE} -i ${LFS_PKG_DIR}/${PATCH_FILE}
+}
+
+
+# Decompression of a package
+# First argument: package name
+# Second argument: directory where decompressing (optional)
+decompress_package()
+{
+    # Checking for correct number of arguments
+    if [ $# -eq 1 ]; then
+       local TOPDIR=${LFS_TMP}
+    elif [ $# -eq 2 ]; then
+       local TOPDIR=${2}
+    else
+       echo
+       echo "${FUNCNAME}(): Incorrect number of arguments (must be 1 or 2)"
+       return ${EXIT_FAILURE}
+    fi
+
+    local PACKAGE=${1}
+
+    if [ ! -f ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 ]; then
+       echo "${FUNCNAME}(): Missing source package: \"${PACKAGE}.tar.bz2\""
+       return ${EXIT_FAILURE}
+    fi
+    
+    local DECOMPRESSED_DIRNAME=$(static_decompressed_dirname ${PACKAGE})
+
+    if [ -d ${TOPDIR}/${DECOMPRESSED_DIRNAME} ]; then
+       # Removing old source directory (if any)
+       rm -v -rf ${TOPDIR}/${DECOMPRESSED_DIRNAME} || exit 1
+    fi
+
+    # Decompressing package
+    # Option 'U' of tar is to remove each file prior to extracting over it
+    cd ${TOPDIR} &&
+    tar -jxvf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 &&
+    cd - 1> /dev/null 2>&1
+}
+
+
+# Installation of a package, removing source and build directories after.
+#
+# First argument:  package name
+# Second argument: script name
+# Remaining arguments: additional configure options
+ipkg()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    static_ipkg ${1} ${2} ${1}
+}
+
+
+# Installation of a package conforming to GNU autotools.
+# The package must be able to be built outside the
+# source directory.
+#
+# First argument:      package name
+# Remaining arguments: additional configure options
+ipkg_ac()
+{
+    # Checking for correct number of arguments
+    if [ $# -lt 1 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    local PACKAGE=${1}
+    shift
+    local CONFIGURE_OPTS=${*}
+
+    static_ipkg ${PACKAGE} cis-ac ${PACKAGE} ${CONFIGURE_OPTS}
+}
+
+
+# Installation of a package conforming to GNU autotools,
+# but that must be built inside the source directory.
+#
+# First argument:      package name
+# Remaining arguments: additional configure options
+ipkg_ac_nb()
+{
+    # Checking for correct number of arguments
+    if [ $# -lt 1 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    local PACKAGE=${1}
+    shift
+    local CONFIGURE_OPTS=${*}
+
+    static_ipkg ${PACKAGE} cis-ac-nobuild ${PACKAGE} ${CONFIGURE_OPTS}
+}
+
+
+# Installation of a GNOME package.
+#
+# First argument:  package name
+ipkg_gnome()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    static_ipkg ${1} cis-gnome ${1}
+}
+
+
+# Installation of a PERL module
+#
+# First argument:  package name
+ipkg_pm()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    static_ipkg ${1} cis-pm ${1}
+}
+
+
+# Multiple installation of a package. This is usefull for packages
+# that may need to be installed multiple times, at different
+# times of the build process, like for GCC pas 1 and GCC pass 2.
+#
+# First argument:  Real package name
+# Second argument: Installation script name
+# Third argument:  Unique identification label in 'install.log'
+ipkg_mult()
+{
+    # Checking for correct number of arguments
+    if [ $# -ne 3 ]; then
+        echo
+       echo "${FUNCNAME}(): Wrong number of arguments"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    static_ipkg ${1} ${2} ${3}
+}
+
+
+# Installation of a package
+#
+# First argument:      Real package name
+# Second argument:     Installation script name
+# Third argument:      Unique identification label in 'install.log'
+# Remaining arguments: Additional configure options
+static_ipkg()
+{
+    local START_TIME=$(echo `date +%s`)
+    local PACKAGE_NAME=${1}
+    local SCRIPT=./${2}
+    local LABEL=${3}
+    # Checking for correct number of arguments
+    if [ $# -lt 3 ]; then
+        echo
+       echo "${FUNCNAME}(): Missing argument"
+       echo "  command was: \"${FUNCNAME}() $*\""
+       exit ${EXIT_FAILURE}
+    fi
+
+    shift
+    shift
+    shift
+    local CONFIGURE_OPTS=${*}
+
+    # Checking if script is valid and executable
+    if [ ! -x ${SCRIPT} ]; then
+        echo
+       echo "${FUNCNAME}(): script not found: ${SCRIPT}"
+       exit ${EXIT_FAILURE}
+    fi
+
+    PACKAGE_LOG=${LFS_LOG_DIR}/${PACKAGE_NAME}.log
+
+    # Checking if package was previously successfully installed
+    if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} \
+      1> /dev/null 2>&1; then
+       return $EXIT_SUCCESS
+    fi
+    
+    # Displaying label
+    echo -n "[ ] Installing" ${LABEL}" "
+
+    echo "------------------------" 1>> ${LFS_LOG_FILE}
+    echo "Installing" ${LABEL} 1>> ${LFS_LOG_FILE}
+
+    decompress_package ${PACKAGE_NAME} 1>> ${PACKAGE_LOG} 2>&1
+    eval_retval2
+
+    # Get the name of the decompressed directory
+    local DECOMPRESSED_DIRNAME=$(static_decompressed_dirname ${PACKAGE_NAME})
+
+    # Displaying package source size in log file
+    echo "  Source size:" $(du -h -s ${LFS_TMP}/${DECOMPRESSED_DIRNAME} | awk '{ print $1 }') 1>> ${LFS_LOG_FILE}
+
+    # Removing old build directory (if any)
+    if [ -d ${LFS_TMP}/${PACKAGE_NAME}-build ]; then
+       rm -v -rf ${LFS_TMP}/${PACKAGE_NAME}-build 1>> ${PACKAGE_LOG} 2>&1
+        eval_retval2
+    fi
+
+    # Creating build directory
+    mkdir -v ${LFS_TMP}/${PACKAGE_NAME}-build 1>> ${PACKAGE_LOG} 2>&1
+    eval_retval2
+
+    # Executing script.
+    ${SCRIPT} ${PACKAGE_NAME} ${CONFIGURE_OPTS} 1>> ${PACKAGE_LOG} 2>&1
+    eval_retval2
+
+    # Displaying package build size in log file
+    BUILD_SIZE=$(du -h -s -c ${LFS_TMP}/${DECOMPRESSED_DIRNAME} ${LFS_TMP}/${PACKAGE_NAME}-build | grep total | awk '{ print $1 }')
+    echo "  Build size : ${BUILD_SIZE}" 1>> ${LFS_LOG_FILE}
+
+    # Some scripts need to preserve the source or build directory. They can
+    # do so by renaming them.
+    if [ -d ${LFS_TMP}/${DECOMPRESSED_DIRNAME} ]; then
+       # Removing source directory
+       rm -v -rf ${LFS_TMP}/${DECOMPRESSED_DIRNAME} 1>> ${PACKAGE_LOG} 2>&1
+        eval_retval2
+    fi
+    if [ -d ${LFS_TMP}/${PACKAGE_NAME}-build ]; then
+       # Removing build directory
+       rm -v -rf ${LFS_TMP}/${PACKAGE_NAME}-build 1>> ${PACKAGE_LOG} 2>&1
+        eval_retval2
+    fi
+
+    # Writing success string to the end of the log file
+    echo "${LABEL} successfully installed" 1>> ${LFS_LOG_FILE}
+
+    # Displaying build time after the package name
+    display_build_time ${START_TIME}
+
+    ${SET_CHECK_POSITION}
+    print_status success
+
+    return $EXIT_SUCCESS
+}
+
+
+# Display the action name, run a command, log its output and display it's
+# status
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+action_checkbox()
+{
+    # Displaying script name
+    echo -n "[ ]" $1
+    $SET_CHECK_POSITION
+    shift
+    echo $* 1>> ${LFS_LOG_FILE}
+
+    # Executing command
+    $* 1>> ${LFS_LOG_FILE} 2>&1
+    if [ $? -ne 0 ]; then
+       print_status failure
+       echo
+       exit ${EXIT_FAILURE}
+    fi
+
+    print_status success
+
+    return $EXIT_SUCCESS
+}
+
+
+# Display the action name, run a command, log its output and display it's
+# status and the time it took to execute.
+# Note: In case of errors, this function returns an error code instead
+#       of exiting.
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+action_checkbox_time()
+{
+    START_TIME=$(echo `date +%s`)
+
+    # Displaying script name
+    echo -n "[ ]" $1" "
+    shift
+    echo $* 1>> ${LFS_LOG_FILE}
+
+    # Executing command
+    $* 1>> ${LFS_LOG_FILE} 2>&1
+    if [ $? -ne 0 ]; then
+       ${SET_CHECK_POSITION}
+       print_status failure
+
+       return ${EXIT_FAILURE}
+    else
+       # Displaying build time after the package name
+       display_build_time ${START_TIME}
+       
+       ${SET_CHECK_POSITION}
+       print_status success
+       
+       return $EXIT_SUCCESS
+    fi
+}
+
+
+# Display the action name, run a command, log its output and display it's
+# status. Write to install log file when successfully completed so it
+# won't be called again after a successfull installation.
+# First argument:  label (string)
+# Second argument: script name
+run_script_log()
+{
+    LABEL=${1}
+    SCRIPT=${2}
+
+    # Checking for correct number of arguments
+    if [ $# -lt 2 ]; then
+       echo "${FUNCNAME}(): Missing argument"
+       exit ${EXIT_FAILURE}
+    fi
+
+    shift
+    shift
+    SCRIPT_ARGS=${*}
+
+    # Checking if script is valid and executable
+    if [ ! -x ./${SCRIPT} ]; then
+       echo "${FUNCNAME}(): script not found: ${SCRIPT}"
+       exit ${EXIT_FAILURE}
+    fi
+
+    PACKAGE_LOG=${LFS_LOG_DIR}/${LABEL}.log
+
+    # Checking if package was previously successfully installed
+    if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} 1> /dev/null 2>&1;
+       then
+       return $EXIT_SUCCESS
+    fi
+    
+    # Displaying script name
+    echo -n "[ ] ${LABEL}"
+    echo "------------------------" 1>> ${LFS_LOG_FILE}
+    echo "Running " ${LABEL} 1>> ${LFS_LOG_FILE}
+    echo 1>> ${LFS_LOG_FILE}
+
+    # Executing command
+    ./${SCRIPT} ${SCRIPT_ARGS} 1>> ${PACKAGE_LOG} 2>&1
+    eval_retval2
+
+    # Writing success string to the end of the log file
+    echo "${LABEL} successfully installed" 1>> ${LFS_LOG_FILE}
+
+    $SET_CHECK_POSITION
+    print_status success
+
+    return $EXIT_SUCCESS
+}
+
+
+# Display the action name, run a command, log its output and display it's
+# status. Write to install log file when successfully completed so it
+# won't be called again after a successfull installation.
+# First argument:  label (string)
+# Second argument: script name
+run_cmd_log()
+{
+    # Checking for correct number of arguments
+    if [ $# -lt 2 ]; then
+       echo "${FUNCNAME}(): Missing argument"
+       exit ${EXIT_FAILURE}
+    fi
+
+    LABEL=${1}
+    shift
+    SCRIPT=${*}
+
+    # Checking if package was previously successfully installed
+    if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} 1> /dev/null 2>&1;
+       then
+       return $EXIT_SUCCESS
+    fi
+    
+    # Displaying script name
+    echo -n "[ ] ${LABEL}"
+    echo "------------------------" 1>> ${LFS_LOG_FILE}
+    echo "${LABEL}" 1>> ${LFS_LOG_FILE}
+    echo 1>> ${LFS_LOG_FILE}
+
+    # Executing command
+    ${SCRIPT} 1>> ${LFS_LOG_FILE} 2>&1
+    eval_retval2
+
+    # Writing success string to the end of the log file
+    echo "${LABEL} successfully installed" 1>> ${LFS_LOG_FILE}
+
+    $SET_CHECK_POSITION
+    print_status success
+
+    return $EXIT_SUCCESS
+}
+
+
+get_total_build_time()
+{
+    INFILE=${1}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       echo "Usage: ${FUNCNAME} LOGFILE"
+       exit ${EXIT_FAILURE}
+    fi
+
+    TIMES=$(cat ${INFILE} | grep "Build time:" | sed "s!Build time: \(.*\)h!\1!g")
+
+    for time in ${TIMES}; do
+       HOURS=$(( $HOURS + $(echo ${time} | sed "s!^\([0-9]*\)\..*!\1!g") ))
+       
+       # The first SED command extracts the minutes (fractions of an hour).
+       # The second SED command removed the leading zero, if applicable.
+       MIN=$(( $MIN + $(echo ${time} | sed "s!.*\.\([0-9][0-9]\)!\1!g" | sed "s!^0\([0-9]\)!\1!g" ) ))
+    done
+    
+    HOURS=$(( ${HOURS} + ( ${MIN} / 100 ) ))
+    MIN=$(( ${MIN} % 100 ))
+    
+    echo "${HOURS}.${MIN}"
+}
+
+
+display_build_time()
+{
+    END_TIME=$(echo `date +%s`)
+
+    HOURS=$(( ( ${END_TIME} - ${START_TIME} ) / 3600 ))
+    echo -n "("${HOURS}"."
+    echo -n "  Build time: ${HOURS}." 1>> ${LFS_LOG_FILE}
+
+    # Time is inferior to 1 hour...
+    MINUTES=$(( ( ( ${END_TIME} - ${START_TIME} ) % 3600 ) / 36 ))
+
+    if [ ${MINUTES} -lt 10 ]; then
+       echo -n "0"
+       echo -n "0" 1>> ${LFS_LOG_FILE}
+    fi
+
+    if [ ${MINUTES} -eq 0 ]; then
+       echo -n "1"
+       echo -n "1" 1>> ${LFS_LOG_FILE}
+    else
+       echo -n ${MINUTES}
+       echo -n ${MINUTES} 1>> ${LFS_LOG_FILE}
+    fi
+
+    echo -n "h)"
+    echo "h" 1>> ${LFS_LOG_FILE}
+}
+
+
+# The print_status prints a coloured "X" letter inside the checkbox to the left
+# of the screen (the checkbox is displayed with the action_checkbox function).
+print_status()
+{
+    if [ $# = 0 ]; then
+        # If no parameters are given to the print_status function, print usage
+        # information.
+       echo "Usage: ${FUNCNAME}() {success|warning|failure}"
+       return ${EXIT_FAILURE}
+    fi
+    
+    case "$1" in
+       success)
+           $SUCCESS
+           ;;
+       warning)
+           $WARNING
+           ;;
+       failure)
+           $FAILURE
+           ;;
+       *)
+           echo "Usage: ${FUNCNAME}() {success|warning|failure}"
+           return ${EXIT_FAILURE}
+           ;;
+    esac
+    echo "X"
+    $NORMAL 
+}
+
+
+# Testing GCC toolchain
+gcc_toolchain_test_stage1()
+{
+    cd ${LFS_TMP} &&
+    echo 'main(){}' > dummy.c &&
+    cc dummy.c &&
+    readelf -l a.out | grep ': /tools' 1> /dev/null 2>&1
+
+    if [ $? -ne 0 ]; then
+        echo "Testing toolchain failed..."
+        exit 1
+    fi
+
+    rm dummy.c a.out
+}
diff --git a/functions-update b/functions-update
new file mode 100644 (file)
index 0000000..1fe40ed
--- /dev/null
@@ -0,0 +1,427 @@
+#!/bin/sh
+
+LFS_PKG_BASE="$(dirname $(dirname $(pwd)))/packages"
+LFS_PKG_DIR="${LFS_PKG_BASE}/${LFS_STAGE}"
+LFS_LOG_DIR="${LFS}/var/log/hvlinux-install/${LFS_STAGE}"
+LFS_LOG_FILE="${LFS_LOG_DIR}/pkg-update.log"
+WGET_LOG_FILE="${LFS_LOG_DIR}/pkg-wget.log"
+
+# URL
+LFS_BASE_URL="http://www.linuxfromscratch.org"
+LFS_PATCHES_URL="${LFS_BASE_URL}/patches/lfs/development"
+LFS_PACKAGES_URL="ftp://ftp.osuosl.org/pub/lfs/lfs-packages/conglomeration"
+BLFS_PATCHES_URL="${LFS_BASE_URL}/patches/blfs/svn"
+HV_BASE_URL="http://www.hugovil.com/hvlinux-repository"
+HV_PACKAGES_URL="${HV_BASE_URL}/packages"
+HV_PATCHES_URL="${HV_BASE_URL}/patches"
+SOURCEFORGE_URL="http://internap.dl.sourceforge.net/sourceforge"
+GNOME_URL="http://ftp.gnome.org/pub/gnome/sources"
+GNU_URL="http://ftp.gnu.org/pub/gnu"
+TETEX_URL="http://www.tug.org/ftp/tex-archive/systems/unix/teTeX"
+
+WGETCMD="wget --directory-prefix=${LFS_PKG_DIR} --timeout=5 --tries=3 -o ${WGET_LOG_FILE}"
+
+LFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-lfs.html
+BLFS_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-blfs.html
+HV_PATCHES_LIST=${LFS_PKG_DIR}/patches-list-hv.html
+
+
+# Arg. #1: URL for patches repository.
+# Arg. #2: Destination filename.
+static_fetch_patches_list() {
+    PATCHES_URL=${1}
+    PATCHES_LIST_FILENAME=${2}
+
+    ${WGETCMD} "${PATCHES_URL}/" &&
+    mv ${LFS_PKG_DIR}/index.html ${PATCHES_LIST_FILENAME}
+}
+
+
+# Arg. #1: URL for patches repository. The trailing
+#          slash is absolutely necessary for this to work.
+update_packages_init() {
+    # First create log directory if it does not exists.
+    if [ ! -d ${LFS_LOG_DIR} ]; then
+       install -m755 -d ${LFS_LOG_DIR} || exit 1
+    fi
+
+    # Then create destination directory if it does not exists.
+    if [ ! -d ${LFS_PKG_DIR} ]; then
+       install -v -m755 -d ${LFS_PKG_DIR} 1> ${LFS_LOG_FILE} 2>&1 || exit 1
+    fi
+
+    # Getting list of all patches from LFS server.
+    ##action_checkbox "Fetching LFS patches list"
+    static_fetch_patches_list ${LFS_PATCHES_URL} ${LFS_PATCHES_LIST}
+
+    # Getting list of all patches from BLFS server.
+    action_checkbox "Fetching BLFS patches list" static_fetch_patches_list ${BLFS_PATCHES_URL} ${BLFS_PATCHES_LIST}
+
+    # Getting list of all patches from hugovil.com server.
+    action_checkbox "Fetching hugovil.com patches list" static_fetch_patches_list ${HV_PATCHES_URL} ${HV_PATCHES_LIST}
+}
+
+
+# Get patch package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: Patches list file (HTML)
+# Arg. #3: Patches URL
+static_checkpatch() {
+    local PACK=${1}
+    local PATCHES_LIST=${2}
+    local PATCHES_URL=${3}
+
+    local PATCHES_FOUND=$(cat ${PATCHES_LIST} | grep "${PACK}-" | sed "s/.*\(${PACK}-.*\.patch\).*/\1/")
+    if [ -n "${PATCHES_FOUND}" ]; then
+       for p in ${PATCHES_FOUND}; do
+           if [ ! -f ${LFS_PKG_DIR}/${p} ]; then
+               action_checkbox_time "Fetching ${p}" ${WGETCMD} ${PATCHES_URL}/${p}
+           fi
+       done
+    fi
+}
+
+
+# Get patch package if it is not in the repository
+# Arg. #1: Package name and version
+static_getpatch() {
+    PACK=${1}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 1 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    # Checking if patch is available from LFS.
+    static_checkpatch ${PACK} ${LFS_PATCHES_LIST} ${LFS_PATCHES_URL}
+
+    # Checking if patch is available from BLFS.
+    static_checkpatch ${PACK} ${BLFS_PATCHES_LIST} ${BLFS_PATCHES_URL}
+
+    # Checking if patch is available from hugovil.com.
+    static_checkpatch ${PACK} ${HV_PATCHES_LIST} ${HV_PATCHES_URL}
+}
+
+
+# Convert multiple compressed gzip files to bzip2.
+# Usage: gztobz2 [FILES]
+gztobz2()
+{
+    if [ $# = 0 ]; then
+       echo "$0: -- Convert multiple compressed gzip files to bzip2."
+       echo "Usage: $0: [FILES]"
+       return 1
+    fi
+    
+    while [ $# -ne 0 ]; do
+       local ORIG_GZIPPED_FILENAME=${1}
+       
+       # Checking if input file exist.
+       if [ ! -f $1 ]; then
+           echo "$0: File ${ORIG_GZIPPED_FILENAME} not found."
+           return 1
+       fi
+       
+       # Checking if input file is a valid gzipped file.
+       gzip -t ${ORIG_GZIPPED_FILENAME}
+       if [ $? -ne 0 ] ; then
+           echo "$0: File ${ORIG_GZIPPED_FILENAME} is not a valid gzip file."
+           return 1
+       fi
+       
+       # Obtaining uncompressed name of file
+       local FILENAME=$(gunzip -l ${ORIG_GZIPPED_FILENAME} | sed '1d' | sed 's/\(.*\)% \(.*\)/\2/')
+       
+       # Decompressing file to standard output and piping result to bzip2
+       gunzip ${ORIG_GZIPPED_FILENAME} --stdout | bzip2 --best > ${FILENAME}.bz2
+       if [ $? -ne 0 ] ; then
+           echo "$0: Error converting file ${ORIG_GZIPPED_FILENAME} to bzip2."
+           return 1
+       fi
+       
+       # Keeping the original file's timestamp
+       touch --reference=${ORIG_GZIPPED_FILENAME} ${FILENAME}.bz2
+       
+       # Deleting original gzipped file
+       if [ -f ${FILENAME}.bz2 ]; then
+           rm ${ORIG_GZIPPED_FILENAME}
+       fi
+       
+       shift
+    done
+}
+
+
+detect_file_not_found()
+{
+    # HTTP: will return error code 404.
+    # FTP: will say "File not found"
+    if grep "404 Not Found" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then
+        return 0
+    elif grep "No such file" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then
+        return 0
+    else
+        return 1
+    fi
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: URL
+static_getpkg() {
+    PACK=${1}
+    URL=${2}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    ${WGETCMD} ${URL}/${PACK}.tar.bz2 && return 0
+
+    # Failure: if it was a connection timeout, don't try for other file extensions.
+    if grep "failed: Connection timed out" ${WGET_LOG_FILE} 1> /dev/null 2>&1; then
+        echo "Error, wget reported: Connection timed out"
+        return 1
+    fi
+
+    if detect_file_not_found; then
+        # If file was not found, maybe a .tar.gz file exist...
+       ${WGETCMD} ${URL}/${PACK}.tar.gz
+       if [ ${?} -eq 0 ]; then
+           gztobz2 ${LFS_PKG_DIR}/${PACK}.tar.gz || return 1
+            return 0
+       else
+            if detect_file_not_found; then
+                # If file was not found, maybe a .tgz file exist...
+               ${WGETCMD} ${URL}/${PACK}.tgz
+               if [ ${?} -eq 0 ]; then
+                   gztobz2 ${LFS_PKG_DIR}/${PACK}.tgz || return 1
+                    return 0
+               else
+                    if detect_file_not_found; then
+                        # If file was not found, maybe a .tar.Z file exist... (uw-imap...)
+                       ${WGETCMD} ${URL}/${PACK}.tar.Z
+                       if [ ${?} -eq 0 ]; then
+                           gztobz2 ${LFS_PKG_DIR}/${PACK}.tar.Z || return 1
+                            return 0
+                       fi
+                   fi
+                fi
+            fi
+        fi
+    fi
+
+    # Failure...
+    return 1
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: URL
+fpkg() {
+    PACK=${1}
+    URL=${2}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    if [ ! -f ${LFS_PKG_DIR}/${PACK}.tar.bz2 ]; then
+       action_checkbox_time "Fetching ${PACK}" static_getpkg ${PACK} ${URL}
+    fi
+
+    # Check if a patch is available.
+    static_getpatch ${PACK}
+}
+
+
+# Get package if it is not in the repository.
+# This function is used if the source and target names for the
+# package are different (name mismatch).
+# Arg. #1: Target package name and version (on disk)
+# Arg. #2: Source package name and version (on internet)
+# Arg. #3: URL
+fpkg_mis() {
+    TARGET=${1}
+    SOURCE=${2}
+    URL=${3}
+
+    # Checking for correct number of arguments
+    if [ $# -ne 3 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    if [ ! -f ${LFS_PKG_DIR}/${TARGET}.tar.bz2 ]; then
+       fpkg ${SOURCE} ${URL}
+       
+       if [ -f ${LFS_PKG_DIR}/${SOURCE}.tar.bz2 ]; then
+           mv ${LFS_PKG_DIR}/${SOURCE}.tar.bz2 ${LFS_PKG_DIR}/${TARGET}.tar.bz2
+       fi
+    fi
+
+    # Check for available patches with TARGET name.
+    static_getpatch ${TARGET}
+
+    # Check for available patches with SOURCE name.
+    static_getpatch ${SOURCE}
+
+    # Rename any patch fetched (in fpkg call) and replace SOURCE by TARGET in
+    # patch name.
+    if ls ${LFS_PKG_DIR}/${SOURCE}-*.patch 1> /dev/null 2>&1; then
+       rename ${SOURCE} ${TARGET} ${LFS_PKG_DIR}/${SOURCE}-*.patch
+    fi
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: Directory name (optional)
+fpkg_gnu() {
+    PACK=${1}
+
+    if [ $# -eq 2 ]; then
+       NAME=${2}
+    else
+       NAME=$(get_pkg_name ${PACK})
+    fi
+
+    # Checking for correct number of arguments
+    if [ $# -lt 1 -o $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    fpkg ${PACK} "${GNU_URL}/${NAME}"
+}
+
+
+# Fetch Gnome package (if it is not in the repository).
+# Arg. #1: Package name and version
+# Arg. #2: Directory name (optional)
+fpkg_gnome() {
+    PACK=${1}
+
+    if [ $# -eq 2 ]; then
+       NAME=${2}
+    else
+       NAME=$(get_pkg_name ${PACK})
+    fi
+
+    # Checking for correct number of arguments
+    if [ $# -lt 1 -o $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    fpkg ${PACK} "${GNOME_URL}/${NAME}/$(get_pkg_ver_base ${PACK})"
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: Directory name (optional)
+fpkg_sf() {
+    PACK=${1}
+
+    if [ $# -eq 2 ]; then
+       NAME=${2}
+    else
+       NAME=$(get_pkg_name ${PACK})
+    fi
+    
+    # Checking for correct number of arguments
+    if [ $# -lt 1 -o $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    fpkg ${PACK} ${SOURCEFORGE_URL}/${NAME}
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: Directory name (optional)
+fpkg_hv() {
+    PACK=${1}
+
+    # Checking for correct number of arguments
+    if [ $# -lt 1 -o $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    if [ $# -eq 2 ]; then
+       fpkg ${PACK} "${HV_PACKAGES_URL}/${2}"
+    else
+       fpkg ${PACK} ${HV_PACKAGES_URL}
+    fi
+}
+
+
+# Get package if it is not in the repository
+# Arg. #1: Package name and version
+# Arg. #2: Directory name (optional)
+fpkg_lfs() {
+    PACK=${1}
+
+    # Checking for correct number of arguments
+    if [ $# -lt 1 -o $# -gt 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    if [ $# -eq 2 ]; then
+       fpkg ${PACK} "${LFS_PACKAGES_URL}/${2}"
+    else
+       fpkg ${PACK} ${LFS_PACKAGES_URL}
+    fi
+}
+
+
+# Create a symbolic link to a package that is located in another stage
+# repository (to not have the same file twice).
+# Arg. #1: Source stage number (1, 2, 3, etc)
+# Arg. #2: Package name
+lpkg() {
+    SRCSTAGE="stage${1}"
+    FILE="${2}.tar.bz2"
+    PACKAGE_NAME="${2}"
+
+    # Checking for correct number of arguments
+    if [ $# -ne 2 ]; then
+       echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+       return 1
+    fi
+
+    if [ ! -h ${LFS_PKG_DIR}/${FILE} ]; then
+       # The link does not exist. First check if source file exist.
+       if [ ! -f ${LFS_PKG_BASE}/${SRCSTAGE}/${FILE} ]; then
+           echo "${FUNCNAME} ${*}"
+           echo "Missing source file..."
+           exit 1
+       fi
+
+       # Create link if it doesn't exist
+       ln -s ../${SRCSTAGE}/${FILE} ${LFS_PKG_DIR}/${FILE}
+    fi
+
+    # Create link for patches corresponding to that package:
+    if ls ${LFS_PKG_BASE}/${SRCSTAGE}/${PACKAGE_NAME}-*.patch 1> /dev/null 2>&1; then
+       for patch in ${LFS_PKG_BASE}/${SRCSTAGE}/${PACKAGE_NAME}-*.patch; do
+           PATCHFILE=$(basename ${patch})
+           if [ ! -h ${LFS_PKG_DIR}/${PATCHFILE} ]; then
+               # Create link if it doesn't exist
+               ln -s ../${SRCSTAGE}/${PATCHFILE} ${LFS_PKG_DIR}/${PATCHFILE}
+           fi
+       done
+    fi
+}
diff --git a/packages-list b/packages-list
new file mode 100644 (file)
index 0000000..0bfc907
--- /dev/null
@@ -0,0 +1,430 @@
+#!/bin/sh
+
+# This file contains the name and version of all packages,
+# as well the corresponding patches, if needed.
+
+HV_FONTS_PATH="/usr/share/fonts"
+
+ABIWORD="abiword-2.6.4"
+ALSA_DRIVER="alsa-driver-1.0.15"
+ALSA_LIB="alsa-lib-1.0.15"
+ALSA_PLUGINS="alsa-plugins-1.0.15"
+ALSA_UTILS="alsa-utils-1.0.15"
+ALSA_OSS="alsa-oss-1.0.15"
+
+APR="apr-1.2.12"
+APR_UTIL="apr-util-1.2.12"
+AVR_GDB="gdb-6.4"
+AVRDUDE="avrdude-5.1"
+ATK="atk-1.18.0"
+AUDACIOUS="audacious-1.5.1"
+AUDACIOUS_PLUGINS="audacious-plugins-1.5.1"
+AUDACITY="audacity-src-1.3.5"
+AUDIOFILE="audiofile-0.2.6"
+AUTOCONF="autoconf-2.61"
+AUTOMAKE="automake-1.10.1"
+
+BASH="bash-3.2"
+BC="bc-1.06"
+BISON="bison-2.3"
+BIND="bind-9.5.0-P2"
+BINUTILS="binutils-2.18"
+ARM_BINUTILS="binutils-2.18"
+AVR_BINUTILS="binutils-2.18"
+BRIDGE_UTILS="bridge-utils-1.4"
+BZIP2="bzip2-1.0.4"
+
+CAIRO="cairo-1.6.4"
+CAIROMM="cairomm-1.6.0"
+CDRTOOLS="cdrtools-2.01"
+CDRDAO="cdrdao-1.2.2"
+CLAMAV="clamav-0.93.3"
+COREUTILS="coreutils-6.9"
+CUPS="cups-1.1.23"
+CURL="curl-7.15.3"
+CVS_PACKAGE="cvs-1.11.18"
+
+DB4="db-4.6.21"
+# Needed by gnome VFS
+DBUS="dbus-1.0.2"
+DBUS_GLIB="dbus-glib-0.74"
+DDCLIENT="ddclient-3.6.7"
+# Required by Gnome
+DESKTOP_FILE_UTILS="desktop-file-utils-0.13"
+DHCP="dhcp-3.0.5"
+DIFFUTILS="diffutils-2.8.1"
+DVDRWTOOLS="dvd+rw-tools-7.1"
+
+SGML_COMMON="sgml-common-0.6.3"
+SGML_DTD3_VER="3.1"
+SGML_DTD3="sgml-dtd-${SGML_DTD3_VER}"
+SGML_DTD4_VER="4.4"
+SGML_DTD4="sgml-dtd-${SGML_DTD4_VER}"
+SGML_SPM="SGMLSpm-1.03ii"
+DOCBOOK_DSSSL_VER="1.79"
+DOCBOOK_DSSSL="docbook-dsssl-${DOCBOOK_DSSSL_VER}"
+DOCBOOK_UTILS="docbook-utils-0.6.14"
+DOCBOOK_XML_VER="4.4"
+DOCBOOK_XML_VER_PREV="4.1.2 4.2 4.3"
+DOCBOOK_XML="docbook-xml-${DOCBOOK_XML_VER}"
+DOCBOOK_XSL_VER="1.68.1"
+DOCBOOK_XSL="docbook-xsl-${DOCBOOK_XSL_VER}"
+E2FSPROGS="e2fsprogs-1.40.2"
+ED="ed-0.8"
+EMACS="emacs-22.1"
+ESOUND="esound-0.2.37"
+EXPAT="expat-2.0.0"
+
+LIBFAAD2="faad2-2.6.1"
+LIBFAAC="faac-1.26"
+FCRON="fcron-3.0.0"
+FFMPEG="ffmpeg-9958"
+FILE_PKG="file-4.23"
+FINDUTILS="findutils-4.2.31"
+FIREFOX="firefox-3.0.1"
+FLAC="flac-1.2.1"
+FLASH_PLUGIN="flash-player-9.0.48.0"
+FLEX="flex-2.5.33"
+FONTCONFIG="fontconfig-2.4.2"
+FOX="fox-1.6.30"
+FREETYPE="freetype-2.3.4"
+FRIBIDI="fribidi-0.10.7"
+
+GAWK="gawk-3.1.5"
+GC="gc6.5"
+GCC_CORE="gcc-4.2.3"
+GCC_SPECS_PATCH="${GCC_CORE}-specs-1.patch"
+ARM_GCC_CORE="gcc-4.2.3"
+AVR_GCC_CORE="gcc-4.2.3"
+GDB="gdb-6.4"
+GIT="git-1.5.5"
+GIT_MANPAGES="git-manpages-1.5.5"
+LIBGEDA="libgeda-1.2.0"
+GEDA_SYMBOLS="geda-symbols-1.2.0"
+GEDA_GSCHEM="geda-gschem-1.2.0"
+GEDA_GNETLIST="geda-gnetlist-1.2.0"
+GEDA_SYMCHECK="geda-gsymcheck-1.2.0"
+GEDA_GATTRIB="geda-gattrib-1.2.0"
+GETDATE="getdate_rfc868-1.2"
+GETTEXT="gettext-0.16.1"
+ESPGS="espgs-8.15.2"
+GHOSTSCRIPT_FONTS_STD="ghostscript-fonts-std-8.11"
+GHOSTSCRIPT_FONTS_OTHER="ghostscript-fonts-other-6.0"
+GIMP="gimp-2.2.12"
+GLIB2="glib-2.16.3"
+GTK2="gtk+-2.12.9"
+GTK_ENGINES="gtk-engines-2.10.2"
+GLIBC="glibc-2.7"
+AVR_LIBC="avr-libc-1.4.5"
+# The kernel version specified must not be newer than the
+# version of the kernel running on the build machine.
+GLIBC_KERNEL_VERSION="2.6.22"
+GLITZ="glitz-0.5.6"
+
+# GNOME2 core packages
+GNOME2_VER="gnome-2.18.3"
+GNOME2_PREFIX="/opt/${GNOME2_VER}"
+ORBIT2="ORBit2-2.14.7"
+LIBBONOBO="libbonobo-2.18.0"
+GCONF="GConf-2.18.0.1"
+GNOME_MIME_DATA="gnome-mime-data-2.4.3"
+GNOME_VFS="gnome-vfs-2.18.1"
+GNOME_VFS_MONIKERS="gnome-vfs-monikers-2.15.3"
+LIBGNOME="libgnome-2.18.0"
+LIBGNOMECANVAS="libgnomecanvas-2.14.0"
+LIBBONOBOUI="libbonoboui-2.18.0"
+GNOME_KEYRING="gnome-keyring-0.8.1"
+ICON_NAMING_UTILS="icon-naming-utils-0.8.6"
+GNOME_ICON_THEME="gnome-icon-theme-2.18.0"
+LIBGNOMEUI="libgnomeui-2.18.1"
+GAIL="gail-1.18.0"
+
+# Desktop
+GNOME_THEMES="gnome-themes-2.18.1"
+SCROLLKEEPER="scrollkeeper-0.3.14"
+GNOME_DOC_UTILS="gnome-doc-utils-0.10.3"
+GNOME_DESKTOP="gnome-desktop-2.18.3"
+GNOME_BACKGROUNDS="gnome-backgrounds-2.18.3"
+GNOME_MENUS="gnome-menus-2.18.3"
+GNOME_PANEL="gnome-panel-2.18.3"
+VTE="vte-0.16.6"
+GNOME_TERMINAL="gnome-terminal-2.18.1"
+LIBGTOP="libgtop-2.14.9"
+LIBGNOMEKBD="libgnomekbd-2.18.2"
+EEL="eel-2.18.3"
+NAUTILUS="nautilus-2.18.3"
+GNOME_CONTROL_CENTER="control-center-2.18.1"
+GNOME_APPLETS="gnome-applets-2.18.0"
+GNOME_SESSION="gnome-session-2.18.3"
+YELP="yelp-2.18.1"
+GNOME_USER_DOCS="gnome-user-docs-2.18.2"
+
+# GNOME2 Additional Packages - Libraries
+LIBGNOMECUPS="libgnomecups-0.2.2"
+LIBGNOMEPRINT="libgnomeprint-2.18.0"
+LIBGNOMEPRINTUI="libgnomeprintui-2.18.0"
+GTKHTML="gtkhtml-3.16.2"
+EVOLUTION_DATA_SERVER="evolution-data-server-1.12.2"
+EVOLUTION_EXCHANGE="evolution-exchange-2.12.2"
+EVOLUTION="evolution-2.12.2"
+GTKSOURCEVIEW="gtksourceview-1.8.5"
+SYSTEM_TOOLS_BACKENDS="system-tools-backends-1.4.2"
+GNOME_AUDIO="gnome-audio-2.0.0"
+
+# GNOME2 Additional Packages - Utilities
+GEDIT="gedit-2.18.2"
+EOG="eog-2.18.2"
+EVINCE="evince-2.22.2"
+FILE_ROLLER="file-roller-2.18.4"
+GCONF_EDITOR="gconf-editor-2.18.0"
+GNOME_UTILS="gnome-utils-2.18.1"
+GNOME_SYSTEM_MONITOR="gnome-system-monitor-2.18.2"
+NAUTILUS_CD_BURNER="nautilus-cd-burner-2.18.2"
+GNOME_MEDIA="gnome-media-2.18.0"
+GNOME_NETSTATUS="gnome-netstatus-2.12.1"
+GCALCTOOL="gcalctool-5.9.14"
+GUCHARMAP="gucharmap-1.10.0"
+ZENITY="zenity-2.18.2"
+GNOME_KEYRING_MANAGER="gnome-keyring-manager-2.18.0"
+GNOME_VOLUME_MANAGER="gnome-volume-manager-2.17.0"
+GNOME_SOUND_JUICER="sound-juicer-2.16.4"
+GNOME_TOTEM="totem-2.18.3"
+GDM="gdm-2.18.3"
+GNOME_MOUNT="gnome-mount-0.6"
+
+LIBSOUP="libsoup-2.2.96"
+GGV="ggv-2.8.4"
+LIBWNCK="libwnck-2.16.1"
+STARTUP_NOTIFICATION="startup-notification-0.8"
+PIDGIN="pidgin-2.1.0"
+
+LIBEXIF="libexif-0.6.16"
+
+GNUTLS="gnutls-1.6.3"
+
+LIBGSF="libgsf-1.14.5"
+GOFFICE="goffice-0.2.2"
+GNUMERIC="gnumeric-1.6.3"
+
+GREP="grep-2.5.1a"
+GRIP="grip-3.3.1"
+GROFF="groff-1.18.1.4"
+GRUB="grub-0.97"
+
+GSL="gsl-1.11"
+GSTREAMER="gstreamer-0.10.17"
+GST_PLUGINS_BASE="gst-plugins-base-0.10.17"
+GST_PLUGINS_GOOD="gst-plugins-good-0.10.7"
+GST_PLUGINS_UGLY="gst-plugins-ugly-0.10.7"
+GST_FFMPEG="gst-ffmpeg-0.10.3"
+
+GTK_DOC="gtk-doc-1.4"
+GLIBMM="glibmm-2.16.2"
+GTKMM="gtkmm-2.12.7"
+GMP="gmp-4.2.2"
+GUILE="guile-1.8.2"
+GZIP="gzip-1.3.12"
+
+HAL="hal-0.5.9.1"
+HICOLOR_ICON_THEME="hicolor-icon-theme-0.10"
+HTTPD="httpd-2.2.8" # Apache
+HVCLOCK="hvclock-0.2.0"
+
+IMLIB="imlib-1.9.14"
+IANA="iana-etc-2.20"
+IMAGE_MAGICK="ImageMagick-6.4.2-5"
+INETUTILS="inetutils-1.5"
+INKSCAPE="inkscape-r19727"
+INTLTOOL="intltool-0.34.2"
+IPROUTE2="iproute2-2.6.20-070313"
+IPTABLES="iptables-1.3.7"
+ISO_CODES="iso-codes-1.2"
+
+JACK="jack-audio-connection-kit-0.103.0"
+JAVA="jre-1.6.0_05"
+
+KBD="kbd-1.12"
+KERBEROS5="krb5-1.4.1"
+KERNEL="linux-2.6.26.2"
+KVM="kvm-72"
+
+LAME="lame-3.97"
+LCMS="lcms-1.15"
+LESS="less-418"
+LESSTIF="lesstif-0.95.0"
+LFS_BOOTSCRIPTS="lfs-bootscripts-20070813"
+LIBA52="a52dec-0.7.4"
+LIBART="libart_lgpl-2.3.17"
+LIBBOOST="boost_1_35_0"
+LIBGLADE="libglade-2.6.0"
+LIBIDL="libIDL-0.8.6"
+LIBMOWGLI="libmowgli-0.5.0"
+LIBPCAP="libpcap-0.9.4"
+LIBTOOL="libtool-1.5.24"
+LIBSIGCPP="libsigc++-2.0.17"
+LIBOGG="libogg-1.1.3"
+LIBVORBIS="libvorbis-1.2.0"
+VORBIS_TOOLS="vorbis-tools-1.1.1"
+LIBID3TAG="libid3tag-0.15.1b"
+LIBMAD="libmad-0.15.1b"
+LIBJPEG="libjpeg-6b"
+LIBPNG="libpng-1.2.29"
+LIBTIFF="tiff-3.7.4"
+GIFLIB="giflib-4.1.4"
+LIBMNG="libmng-1.0.9"
+LIBMUSICBRAINZ="libmusicbrainz-2.1.5"
+LIBRSVG="librsvg-2.16.1"
+LIBSNDFILE="libsndfile-1.0.18pre18"
+LIBXML2="libxml2-2.6.26"
+LIBXSLT="libxslt-1.1.12"
+LIBXFT="libXft-2.1.12"
+LIBGPG_ERROR="libgpg-error-1.5" # For PIDGIN
+LIBGCRYPT="libgcrypt-1.2.4"     # For PIDGIN
+LIBUSB="libusb-0.1.10a"
+LIBGPHOTO2="libgphoto2-2.1.99"
+LIBXKLAVIER="libxklavier-2.91"
+LIBOIL="liboil-0.3.9"
+LIBSAMPLERATE="libsamplerate-0.1.2"
+LIBSPF2="libspf2-1.2.5"
+LIBNOTIFY="libnotify-0.4.4"
+LTSP_UTILS="ltsp-utils-0.25-0"
+TFTP_HPA="tftp-hpa-0.42"
+
+MAILMAN="mailman-2.1.8"
+MAKE_PACKAGE="make-3.81"
+MAN="man-1.6b"
+MANPAGES="man-pages-3.07"
+LIBMCS="libmcs-0.7.1"
+METACITY="metacity-2.18.5"
+MFOUR="m4-1.4.10"
+MILTER_GREYLIST="milter-greylist-4.0"
+MILTER_SPF="smf-spf-2.0.1"
+MINICOM="minicom-2.1"
+MKTEMP="mktemp-1.5"
+MODULE_INIT_TOOLS="module-init-tools-3.2.2"
+MPLAYER="MPlayer-1.0rc1"
+MPLAYER_CODECS="mplayer-codecs-all-20061022"
+MYSQL="mysql-5.0.22"
+
+NANO="nano-2.0.1"
+NCURSES="ncurses-5.6"
+NEON="neon-0.25.5"
+NET_TOOLS="net-tools-1.60"
+NEWLIB="newlib-1.16.0"
+NFS_UTILS="nfs-utils-1.0.10"
+NMAP="nmap-4.03"
+NSS="nss-3.12-with-nspr-4.7"
+
+OPENJADE="openjade-1.3.2"
+JADETEX="jadetex-3.13"
+OPENLDAP="openldap-2.3.38"
+OPENSP="OpenSP-1.5.2"
+OPENSSH="openssh-4.7p1"
+OPENSSL="openssl-0.9.8g"
+OPERA="opera-9.51-2061.gcc4-shared-qt3.i386"
+OPERA_LANG_FR="ouw900_fr-CA.lng"
+
+PAM="Linux-PAM-0.99.7.1"
+PANGO="pango-1.18.4"
+PARTED="parted-1.8.1"
+PATCH_PACKAGE="patch-2.5.4"
+PCIUTILS="pciutils-2.2.4"
+PCRE="pcre-7.2"
+PERL="perl-5.8.8"
+PERL_MOD_PDL="PDL-2.4.2"
+PERL_MOD_PARSE_REDESCENT="Parse-RecDescent-1.94"
+PERL_MOD_XML_WRITER="XML-Writer-0.600"
+PERL_MOD_XML_PARSER="XML-Parser-2.34"
+PERL_MOD_XML_SIMPLE="XML-Simple-2.15"
+PERL_MOD_HTML_TAGSET="HTML-Tagset-3.10"
+PERL_MOD_HTML_PARSER="HTML-Parser-3.56"
+PERL_MOD_APACHE_LOGGED_AUTH_DBI="Apache-LoggedAuthDBI-0.12"
+PERL_MOD_DB_FILE="DB_File-1.814"
+PERL_MOD_DIGEST_SHA1="Digest-SHA1-2.11"
+PERL_MOD_LWP="libwww-perl-5.64"
+PERL_MOD_URI="URI-1.35"
+PERL_MOD_ARCHIVE_ZIP="Archive-Zip-1.18"
+PERL_MOD_COMPRESS_ZLIB="Compress-Zlib-2.004"
+PERL_MOD_IO_COMPRESS_BASE="IO-Compress-Base-2.004"
+PERL_MOD_IO_COMPRESS_ZLIB="IO-Compress-Zlib-2.004"
+PERL_MOD_COMPRESS_RAW_ZLIB="Compress-Raw-Zlib-2.004"
+PERL_MOD_NET_DNS="Net-DNS-0.61"
+
+PHP="php-5.1.4"
+PIXMAN="pixman-0.10.0"
+PKG_CONFIG="pkg-config-0.22"
+POPPLER="poppler-0.8.5"
+POPT="popt-1.10.4"
+PORTAUDIO="portaudio-v19_061121"
+PORTMAP="portmap-6.0"
+PROCMAIL="procmail-3.22"
+PROCPS="procps-3.2.7"
+PSMISC="psmisc-22.5"
+PSTOEDIT="pstoedit-3.42"
+PULSEAUDIO="pulseaudio-0.9.10"
+PYTHON="Python-2.4.2"
+PYGTK="pygtk-2.8.4"
+
+QT="qt-x11-free-3.3.5"
+
+READLINE="readline-5.2"
+REISERFSPROGS="reiserfsprogs-3.6.20"
+
+SAMBA="samba-3.0.21c"
+SANE_BACKENDS="sane-backends-1.0.18"
+XSANE="xsane-0.97"
+SASL2="cyrus-sasl-2.1.21"
+SED="sed-4.1.5"
+SENDMAIL="sendmail-8.13.6"
+SENDMAIL_GID="bin"
+SHADOW="shadow-4.0.18.1"
+SHARED_MIME_INFO="shared-mime-info-0.23"
+SPAMASSASSIN="Mail-SpamAssassin-3.2.3"
+SPLINT="splint-3.1.1"
+SQUIRRELMAIL="squirrelmail-1.5.1"
+STRACE="strace-4.5.15"
+SUBVERSION="subversion-1.4.6"
+SUDO="sudo-1.6.8p12"
+SYLPHEED="sylpheed-2.5.0"
+SYSKLOGD="sysklogd-1.5"
+SYSVINIT="sysvinit-2.86"
+
+T1LIB="t1lib-5.1.2"
+TAGLIB="taglib-1.4"
+TANGO_ICON_THEME="tango-icon-theme-0.8.1"
+TANGO_ICON_THEME_EXTRAS="tango-icon-theme-extras-0.1.0"
+TAR_PACKAGE="tar-1.19"
+TCPDUMP="tcpdump-3.9.4"
+TCL="tcl8.4.11"
+TK="tk8.4.11"
+TCPWRAPPERS="tcp_wrappers_7.6"
+TETEX_SRC="tetex-src-3.0"
+TETEX_TEXMF="tetex-texmf-3.0"
+TETEX_TEXMFSRC="tetex-texmfsrc-3.0"
+TETEX_CM_SUPER="tetex-cm-super"
+TEXINFO="texinfo-4.9"
+
+UDEV="udev-113"
+UDEV_CONFIG="udev-config-20080217"
+UML_UTILITIES="uml_utilities_20070815"
+UNZIP="unzip-5.52"
+UTIL_LINUX="util-linux-2.12r"
+UW_IMAP="imap-2004g"
+
+WGET="wget-1.10.2"
+WHICH="which-2.16"
+WINDOWMAKER="WindowMaker-0.92.0"
+WINDOWMAKER_EXTRA="WindowMaker-extra-0.1"
+WMNOTIFY="wmnotify-0.3.2"
+WV="wv-1.2.4"
+WXGTK="wxGTK-2.8.7"
+
+XFE="xfe-1.04"
+XFREE86="XFree86-4.6.0"
+XINELIB="xine-lib-1.1.7"
+GXINE="gxine-0.5.11"
+XMLTOMAN="xmltoman-0.4"
+XVIDCORE="xvidcore-1.1.0"
+
+ZIP="zip-2.32"
+ZLIB="zlib-1.2.3"
diff --git a/stage1/INSTALL b/stage1/INSTALL
new file mode 100644 (file)
index 0000000..9c036d0
--- /dev/null
@@ -0,0 +1,15 @@
+
+Installation instructions
+-------------------------
+
+1. Create your destination partition and make sure that it is
+   formatted and mounted.
+
+2. Copy the hvlinux-src directory, containing packages and installation
+   scripts, anywhere in your LFS partition (usually in root directory).
+   If installing from a CD-ROM, mount it under your LFS partition.
+
+3. Modify the 'sysinfos' configuration file to reflect your
+   system configuration.
+
+4. Launch './stage1-install'
diff --git a/stage1/TODO b/stage1/TODO
new file mode 100644 (file)
index 0000000..5c39976
--- /dev/null
@@ -0,0 +1,4 @@
+
+-Change all directories to root:root ownership after stage1 installation.
+
+-Change svn tree to owner lfs:lfs automatically before starting install.
diff --git a/stage1/cis-ac b/stage1/cis-ac
new file mode 100755 (executable)
index 0000000..9d7a283
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE}-build &&
+../${PACKAGE}/configure \
+    --prefix=/tools \
+    ${CONFIGURE_OPTS} &&
+make &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage1/cis-bash b/stage1/cis-bash
new file mode 100755 (executable)
index 0000000..a8a4edb
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/tools \
+    --without-bash-malloc &&
+make -j ${MAKEJOBS} &&
+make install &&
+ln -sf bash /tools/bin/sh
+
+# Return last error
+exit $?
diff --git a/stage1/cis-binutils-pass1 b/stage1/cis-binutils-pass1
new file mode 100755 (executable)
index 0000000..2dbb729
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# CC="gcc -B/usr/bin/": This forces gcc to prefer the linker from the host in /usr/bin.
+#                       This is necessary on some hosts where the new ld built here is
+#                       not compatible with the host's gcc.
+# --disable-nls: This disables internationalization as i18n is not needed
+#                for the temporary tools.
+cd ${LFS_TMP}/${1}-build &&
+CC="gcc -B/usr/bin/" ../${1}/configure \
+    --prefix=/tools \
+    --disable-nls \
+    --disable-werror &&
+make -j ${MAKEJOBS} &&
+make install &&
+# Removing all compiled files in ld subdirectory.
+make -j ${MAKEJOBS} -C ld clean &&
+make -j ${MAKEJOBS} -C ld LIB_PATH=/tools/lib &&
+cp -v ld/ld-new /tools/bin &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage1/cis-binutils-pass2 b/stage1/cis-binutils-pass2
new file mode 100755 (executable)
index 0000000..5331d9c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/tools \
+    --disable-nls \
+    --with-lib-path=/tools/lib &&
+make -j ${MAKEJOBS} &&
+make install &&
+make -j ${MAKEJOBS} -C ld clean &&
+make -j ${MAKEJOBS} -C ld LIB_PATH=/usr/lib:/lib &&
+cp -v ld/ld-new /tools/bin &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage1/cis-bzip2 b/stage1/cis-bzip2
new file mode 100755 (executable)
index 0000000..a5df099
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# This package doesn't have a configure script...
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} &&
+make PREFIX=/tools install
+
+# Return last error
+exit $?
diff --git a/stage1/cis-gcc-pass1 b/stage1/cis-gcc-pass1
new file mode 100755 (executable)
index 0000000..dd3696d
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# CC="gcc -B/usr/bin/": This forces gcc to prefer the linker from the host in /usr/bin.
+#                       This is necessary on some hosts where the new ld built here is
+#                       not compatible with the host's gcc.
+# --disable-nls: This disables internationalization as i18n is not needed
+#                for the temporary tools.
+cd ${LFS_TMP}/${1}-build &&
+CC="gcc -B/usr/bin/" ../${1}/configure \
+    --prefix=/tools \
+    --with-local-prefix=/tools \
+    --disable-nls \
+    --enable-shared \
+    --enable-languages=c &&
+make -j ${MAKEJOBS} &&
+make install &&
+ln -v -sf gcc /tools/bin/cc &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage1/cis-gcc-pass2 b/stage1/cis-gcc-pass2
new file mode 100755 (executable)
index 0000000..2116dac
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations &&
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+# Suppressing the running of the fixincludes script. */
+cp -v gcc/Makefile.in{,.orig} &&
+sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in &&
+
+# The bootstrap build performed in pass1 built GCC with the -fomit-frame-pointer
+# compiler flag. Non-bootstrap builds omit this flag by default, so the following sed
+# command is used in order to ensure consistent compiler builds.
+cp -v gcc/Makefile.in{,.tmp} &&
+sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp > gcc/Makefile.in &&
+
+# The following command will change the location of GCC's default dynamic
+# linker to use the one we installed in /tools. It also removes
+# /usr/include from GCC's include search path
+for file in $(find gcc/config -name linux64.h -o -name linux.h); do
+    cp -uv $file{,.orig}
+    sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
+        -e 's@/usr@/tools@g' $file.orig > $file
+    echo "" >> $file
+    echo "#undef STANDARD_INCLUDE_DIR" >> $file
+    echo "#define STANDARD_INCLUDE_DIR 0" >> $file
+    touch $file.orig
+done
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/tools \
+    --with-local-prefix=/tools \
+    --enable-clocale=gnu \
+    --enable-shared \
+    --enable-threads=posix \
+    --enable-__cxa_atexit \
+    --enable-languages=c,c++ \
+    --disable-libstdcxx-pch \
+    --disable-bootstrap &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+gcc_toolchain_test_stage1 &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage1/cis-gettext b/stage1/cis-gettext
new file mode 100755 (executable)
index 0000000..9f7410d
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}/gettext-tools &&
+./configure \
+    --prefix=/tools \
+    --disable-shared &&
+make -j ${MAKEJOBS} -C gnulib-lib &&
+make -j ${MAKEJOBS} -C src msgfmt &&
+cp -v src/msgfmt /tools/bin
+
+# Return last error
+exit $?
diff --git a/stage1/cis-glibc b/stage1/cis-glibc
new file mode 100755 (executable)
index 0000000..16eecd9
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Configure options:
+# --disable-profile
+#     Builds the libraries without profiling information.
+# --enable-add-ons
+#     Use all the add-ons it finds.
+#     crypt and localdata are now part of glibc.
+# --enable-kernel=2.x.x
+#     Compile the library for support of linux 2.6.x kernels.
+#     The kernel version specified must not be newer than the
+#     version of the kernel running on the build machine.
+# --with-headers=/tools/include
+#       Forces glibc to use the linux-libc-headers installed
+#       in /tools/include, rather than those on the host, which
+#       may be too old to support needed functionality.
+# --with-binutils=/tools/bin
+#     Strictly speaking this switch is not required. But it
+#     does ensure nothing can go wrong with regard to what
+#     Binutils programs get used during the Glibc build.
+# --without-gd
+#     Prevents the build of the memusagestat program, which
+#     strangely enough insists on linking against the host's
+#     libraries (libgd, libpng, libz, and so forth).
+# --without-selinux
+#       When building from hosts that include SELinux functionality
+#       (e.g., Fedora Core 3), Glibc will build with support for
+#       SELinux. As the LFS tools environment does not contain support
+#       for SELinux, a Glibc compiled with such support will fail to
+#       operate correctly.
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/tools \
+    --disable-profile \
+    --enable-add-ons \
+    --enable-kernel=${GLIBC_KERNEL_VERSION} \
+    --with-headers=/tools/include \
+    --with-binutils=/tools/bin \
+    --without-gd  \
+    --without-selinux &&
+make -j ${MAKEJOBS} &&
+mkdir -p /tools/etc &&
+touch /tools/etc/ld.so.conf &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage1/cis-linux-api-headers b/stage1/cis-linux-api-headers
new file mode 100755 (executable)
index 0000000..d9c8ba3
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} mrproper &&
+make -j ${MAKEJOBS} headers_check &&
+make INSTALL_HDR_PATH=dest headers_install &&
+cp -r -v dest/include/* /tools/include
+
+# Return last error
+exit $?
diff --git a/stage1/cis-perl b/stage1/cis-perl
new file mode 100755 (executable)
index 0000000..dc50712
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PERL_VERSION=$(get_pkg_ver ${1})
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure.gnu \
+  --prefix=/tools \
+    -Dstatic_ext='Data/Dumper Fcntl IO POSIX' &&
+make -j ${MAKEJOBS} perl utilities &&
+cp -v perl pod/pod2man /tools/bin &&
+mkdir -v -p /tools/lib/perl5/${PERL_VERSION} &&
+cp -v -R lib/* /tools/lib/perl5/${PERL_VERSION}
+
+# Return last error
+exit $?
diff --git a/stage1/cis-stripping b/stage1/cis-stripping
new file mode 100755 (executable)
index 0000000..725ff33
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+strip --strip-debug    /tools/lib/*
+strip --strip-unneeded /tools/{bin,sbin}/*
+# Removing documentation
+rm -rf /tools/{doc,info,man}
+
+# Return success
+exit 0
diff --git a/stage1/cis-toolchain-adjust b/stage1/cis-toolchain-adjust
new file mode 100755 (executable)
index 0000000..9e17879
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+cd ${LFS_TMP}
+
+# The linker, adjusted at the end of the first pass of Binutils, needs
+# to be renamed so that it can be properly found and used.
+if [ ! -f /tools/bin/ld-old -a -f /tools/bin/ld ]; then
+    mv -v /tools/bin/{ld,ld-old} || exit 1
+fi
+if [ ! -f /tools/$(gcc -dumpmachine)/bin/ld-old -a -f /tools/$(gcc -dumpmachine)/bin/ld ]; then
+    mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} || exit 1
+fi
+rm -f /tools/$(gcc -dumpmachine)/bin/ld &&
+cp -v -a /tools/bin/{ld-new,ld} &&
+ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld &&
+
+# From this point onwards, everything will link only against the libraries
+# in /tools/lib.
+
+# Point GCC to the new dynamic linker.
+gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \
+    > `dirname $(gcc -print-libgcc-file-name)`/specs &&
+
+# Removing the header files in GCC's private include directory:
+GCC_INCLUDEDIR=`dirname $(gcc -print-libgcc-file-name)`/include &&
+find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; &&
+rm -vf `grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/*` &&
+unset GCC_INCLUDEDIR &&
+
+gcc_toolchain_test_stage1
+
+# Return last error
+exit $?
diff --git a/stage1/cis-util-linux b/stage1/cis-util-linux
new file mode 100755 (executable)
index 0000000..d3861dc
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i 's@/usr/include@/tools/include@g' configure &&
+./configure &&
+make -j ${MAKEJOBS} -C lib &&
+make -j ${MAKEJOBS} -C mount mount umount &&
+make -j ${MAKEJOBS} -C text-utils more &&
+cp mount/{mount,umount} text-utils/more /tools/bin
+
+# Return last error
+exit $?
diff --git a/stage1/install-1 b/stage1/install-1
new file mode 100755 (executable)
index 0000000..d72dbaf
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+source ~/.bashrc
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage1"
+export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="${LFS}/tmp"
+
+init_log_file
+
+export CFLAGS="-pipe -march=${MACHINE_ARCHITECTURE} -O2"
+export CXXFLAGS=${CFLAGS}
+
+ipkg_mult      ${BINUTILS} cis-binutils-pass1 "${BINUTILS}-pass1"
+ipkg_mult      ${GCC_CORE} cis-gcc-pass1 "${GCC_CORE}-pass1"
+ipkg           ${KERNEL} cis-linux-api-headers
+ipkg           ${GLIBC} cis-glibc
+run_script_log "Toolchain-adjust-stage1" cis-toolchain-adjust
+ipkg_mult      ${GCC_CORE} cis-gcc-pass2 "${GCC_CORE}-pass2"
+ipkg_mult      ${BINUTILS} cis-binutils-pass2 "${BINUTILS}-pass2"
+ipkg_ac        ${NCURSES} "--with-shared --without-debug --without-ada --enable-overwrite"
+ipkg           ${BASH} cis-bash
+ipkg           ${BZIP2} cis-bzip2
+ipkg_ac        ${COREUTILS}
+ipkg_ac        ${DIFFUTILS}
+ipkg_ac        ${FINDUTILS}
+ipkg_ac        ${GAWK}
+ipkg           ${GETTEXT} cis-gettext
+ipkg_ac        ${GREP} "--disable-perl-regexp"
+ipkg_ac        ${GZIP}
+ipkg_ac        ${MAKE_PACKAGE}
+ipkg_ac        ${PATCH_PACKAGE}
+ipkg           ${PERL} cis-perl
+ipkg_ac        ${SED}
+ipkg_ac        ${TAR_PACKAGE}
+ipkg_ac        ${TEXINFO}
+ipkg           ${UTIL_LINUX} cis-util-linux
+run_script_log "Stripping" cis-stripping
+
+echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h"
+
+exit $?
diff --git a/stage1/packages-update b/stage1/packages-update
new file mode 100755 (executable)
index 0000000..096fccf
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+LFS_STAGE="stage1"
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../functions-update
+source ../packages-list
+
+update_packages_init
+
+# Begin
+
+fpkg_gnu   ${BINUTILS}
+fpkg       ${GCC_CORE} ${GNU_URL}/gcc/${GCC_CORE}
+fpkg       ${KERNEL} http://www.kernel.org/pub/linux/kernel/v2.6
+fpkg_gnu   ${GLIBC}
+fpkg_gnu   ${NCURSES}
+fpkg_gnu   ${BASH}
+fpkg       ${BZIP2} http://www.bzip.org/$(get_pkg_ver ${BZIP2})
+fpkg_gnu   ${COREUTILS}
+fpkg_gnu   ${DIFFUTILS}
+fpkg_gnu   ${FINDUTILS}
+fpkg_gnu   ${GAWK}
+fpkg_gnu   ${GETTEXT}
+fpkg_gnu   ${GREP}
+fpkg_gnu   ${GZIP}
+fpkg_gnu   ${MAKE_PACKAGE}
+fpkg_gnu   ${PATCH_PACKAGE}
+fpkg       ${PERL} http://ftp.funet.fi/pub/CPAN/src
+fpkg_gnu   ${SED}
+fpkg_gnu   ${TAR_PACKAGE}
+fpkg_gnu   ${TEXINFO}
+fpkg       ${UTIL_LINUX} http://www.kernel.org/pub/linux/utils/util-linux
+
+# Return last error
+exit $?
diff --git a/stage1/stage1-install b/stage1/stage1-install
new file mode 100755 (executable)
index 0000000..d3eb6a7
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage1"
+export LFS_LOG_DIR=${LFS}/var/log/hvlinux-install/stage1
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="${LFS}/tmp"
+
+# Making sure that this script was executed by the root user
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+# Making sure that the LFS partition is mounted
+if ! mount | awk '{ print "x" $3 "x" }' | grep "x${LFS}x" 1> /dev/null 2>&1; then
+    echo "LFS partition is not mounted. Please mount it."
+    exit 1
+fi
+
+# Creating basic directories
+for subdir in tmp var boot tools; do
+    dir=${LFS}/${subdir}
+    if [ ! -d ${dir} ]; then
+        install -dv ${dir} || exit 1
+    fi
+    chmod 777 ${dir} || exit 1
+done
+
+# Creating a link from the host root directory to LFS tools directory
+ln -sf ${LFS}/tools / &&
+
+# Testing for the presence of the lfs user
+# We cannot automatically create the user 'lfs' because the installation media
+# can be a CD-ROM (read-only)
+# If installing from some kind of live-CD, simply install as root without the LFS user :)
+if ! grep "lfs" /etc/passwd 1> /dev/null 2>&1; then
+    # The option '-k /dev/null' prevents possible copying of files from a
+    # skeleton directory (default is /etc/skel).
+    groupadd lfs &&
+    useradd -s /bin/bash -g lfs -m -k /dev/null lfs || exit 1
+fi &&
+
+cat > /home/lfs/.bashrc << "EOF" &&
+# Setting up the environment
+set +h
+umask 022
+CC="gcc -s"
+LC_ALL=POSIX
+PATH=/tools/bin:/bin:/usr/bin
+export CC LC_ALL PATH
+EOF
+
+chown lfs:lfs /home/lfs/.bashrc &&
+
+# Logging-in as 'lfs' user, and executing the install-1 script. The
+# 'su -' command starts with a clean environment and enters the home
+# directory of the user.
+su - lfs -c "cd ${PWD}; ./install-1"
+
+if [ $? -ne 0 ]; then
+    echo "*** An error occured during stage1"
+    exit 1
+fi
+
+exit 0
diff --git a/stage2/INSTALL b/stage2/INSTALL
new file mode 100644 (file)
index 0000000..7b08088
--- /dev/null
@@ -0,0 +1,52 @@
+
+Installation instructions
+-------------------------
+
+Note: In this example, the destination partition is /dev/hda6, and
+      the sources partition is /dev/hda10.
+
+1. Create and/or format the destination partition:
+       >$ mkreiserfs /dev/hda6
+
+2. Mount the partition:
+       >$ mount -t reiserfs /dev/hda6 /mnt/linux
+
+3. In the destination partition root, create a directory that will
+   be used to mount the CD or hard disk partition containing the sources:
+       >$ cd /mnt/linux
+       >$ mkdir -p mnt/hvlinux
+
+4. Mount the sources partition:
+       >$ mount -t reiserfs /dev/hda10 /mnt/linux/mnt/hvlinux
+
+5. Copy the tools directory to the LFS (/mnt/linux) partition:
+       >$ cp -a /mnt/linux/mnt/hvlinux/tools /mnt/linux
+   This is needed only if you did not run stage1 installation
+  
+6. Modify the "/mnt/linux/mnt/hvlinux/scripts/sysinfos" file to
+   reflect your configuration.
+
+7. If you want a separate boot partition, make sure it is mounted
+   under ${LFS}/boot.
+
+8. Launch the installation of stage 2:
+       >$ /mnt/linux/mnt/hvlinux/scripts/stage2/stage2-install
+
+9. After that, compile a fresh kernel.
+
+10. type 'exit'
+
+11. You can now remove the /mnt/linux/tools directory.
+
+12. Reboot.
+
+13. When the GRUB prompt appears, install grub on the MBR with:
+    grub> root (hd0,0)
+    grub> setup (hd0)
+    grub> reboot
+
+14. login as root, and create the password for the regular user:
+    >$ passwd reguser
+
+
+  
diff --git a/stage2/TODO b/stage2/TODO
new file mode 100644 (file)
index 0000000..0039891
--- /dev/null
@@ -0,0 +1,14 @@
+
+-Faire un guide post-install:
+    1. Compiler nouveau kernel
+    2. Ajouter une entrée Ã  /boot/grub/menu.lst
+    3. Démonter ${LFS}/boot
+    4. Effacer le répertoire /tools
+    5. exit (pour sortir de l'environnement chroot)
+    6. Démonter ${LFS}
+    7. Redémarrer
+
+-Nettoyer tous les link temporaires automatiquement (seulement après avoir
+ redémarré et vérifié que tout fonctionne correctement).
+
+
diff --git a/stage2/bootscripts/checkfs b/stage2/bootscripts/checkfs
new file mode 100755 (executable)
index 0000000..10acdb2
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# checkfs
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+# Printing the script name in the init log file
+log_script_name "$0 $*"
+
+# If the /fastboot file exists we don't want to run the partition checks
+if [ -f /fastboot ]; then
+    msg_box_nolog "Fast boot mode (no file systems check)"
+    FSCK_RETURN_CODE=$EXIT_CODE_SUCCESS
+else
+    # Mount the root partition read-only (just in case the kernel mounts it
+    # read-write and we don't want to run fsck on a read-write mounted
+    # partition).
+    cmd_run_log /bin/mount -n -o remount,ro /
+    if [ $? = 0 ]; then
+        # Check all the file systems mentioned in /etc/fstab that have the
+       # fs_passno value set to 1 or 2 (the 6th field. See man fstab for more
+       # info).
+       cmd_run_log_box_warn_checkfs "Checking file systems" /sbin/fsck -a -A -C -T
+       FSCK_RETURN_CODE=$?
+       if [ ${FSCK_RETURN_CODE} -eq ${EXIT_CODE_FAILURE} ]; then
+            # Start sulogin so we can repair the damage manually.
+            boot_failure "FAILURE: fsck failed. Try running fsck without the -a option."
+       fi
+    else
+       # If the remount to read-only mode didn't work abort the fsck and print
+       # an error.
+       echo "Cannot check root file system because it could not be mounted"
+       echo "in read-only mode."
+       FSCK_RETURN_CODE=$EXIT_CODE_FAILURE
+    fi
+fi
+
+exit ${FSCK_RETURN_CODE}
diff --git a/stage2/bootscripts/dhcp b/stage2/bootscripts/dhcp
new file mode 100755 (executable)
index 0000000..1b10e71
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# dhcp
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load global network parameters
+source /etc/sysconfig/network/network-parameters
+
+if [ -z ${DHCP_SERVER_IF} ]; then
+    # DHCP server is not enabled
+    msg_log "DHCP server disabled in '/etc/sysconfig/network/network-parameters'"
+    exit ${EXIT_CODE_WARNING}
+fi
+
+# The lease file must exist on startup
+if [ ! -f /var/state/dhcp/dhcpd.leases ]; then
+    touch /var/state/dhcp/dhcpd.leases || exit ${EXIT_CODE_FAILURE}
+fi
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "DHCP server start" loadproc /usr/sbin/dhcpd -q ${DHCP_SERVER_IF}
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "DHCP server stop" killproc /usr/sbin/dhcpd
+       ;;
+   
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc /usr/sbin/dhcpd
+       ;;
+    
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/functions b/stage2/bootscripts/functions
new file mode 100644 (file)
index 0000000..e979add
--- /dev/null
@@ -0,0 +1,509 @@
+#!/bin/sh
+
+# General shell functions
+
+# Return codes definitions
+EXIT_CODE_SUCCESS=0
+EXIT_CODE_FAILURE=1
+EXIT_CODE_WARNING=2
+
+# Setup default values for environment
+umask 022
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
+
+## Screen Dimensions
+# Find current screen size
+if [ -z "${COLUMNS}" ]; then
+    COLUMNS=$(stty size)
+    COLUMNS=${COLUMNS##* }
+fi
+
+# When using remote connections, such as a serial port, stty size returns 0
+if [ "${COLUMNS}" = "0" ]; then 
+    COLUMNS=80
+fi
+
+# The starting position for displaying the "X" sign inside the check box [ ]
+CHECK_POSITION=2
+SET_CHECK_POSITION="echo -en \\033[${CHECK_POSITION}G"
+
+# NORMAL prints text in normal color
+NORMAL="echo -en \\033[0;39m"
+# SUCCESS prints text in a green colour
+SUCCESS="echo -en \\033[1;32m"
+# WARNING prints text in a yellow colour
+WARNING="echo -en \\033[1;33m"
+# FAILURE prints text in a red colour
+FAILURE="echo -en \\033[1;31m"
+
+# Set the console_loglevel to display only error messages (0,1,2 and 3)
+#   KERN_EMERG   "<0>" /* system is unusable                   */
+#   KERN_ALERT   "<1>" /* action must be taken immediately     */
+#   KERN_CRIT    "<2>" /* critical conditions                  */
+#   KERN_ERR     "<3>" /* error conditions                     */
+#   KERN_WARNING "<4>" /* warning conditions                   */
+#   KERN_NOTICE  "<5>" /* normal but significant condition     */
+#   KERN_INFO    "<6>" /* informational                        */
+#   KERN_DEBUG   "<7>" /* debug-level messages                 */
+# Examples:
+#   LOGLEVEL="1" --> Prevents all messages, expect panic messages, from
+#                    appearing on the console.
+#   LOGLEVEL="8" --> Allow all messages to appear on the console.
+LOGLEVEL="4"
+
+# Timezone
+export TZ="America/Montreal"
+
+INIT_LOG_PATH="/tmp/log-init"
+INIT_LOG_FILE="$INIT_LOG_PATH/init.log"
+
+# The print_status prints a coloured "X" letter inside the checkbox to the left
+# of the screen (the checkbox is displayed with the cmd_run_log_box function).
+print_status()
+{
+    if [ ${#} = 0 ]; then
+        # If no parameters are given, print usage information.
+       echo "Usage: print_status {success|warning|failure}"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    case "$1" in
+       success)
+           ${SUCCESS}
+           ;;
+       warning)
+           ${WARNING}
+           ;;
+       failure)
+           ${FAILURE}
+           ;;
+       *)
+           echo "Usage: print_status {success|warning|failure}"
+           return ${EXIT_CODE_FAILURE}
+           ;;
+    esac
+    echo -n "X"
+    ${NORMAL} 
+}
+
+# Argument #1: message d'erreur
+boot_failure()
+{
+    $FAILURE
+    echo
+    echo $1
+    echo
+    echo "sulogin will now be started. When you logout, the system"
+    echo "will reboot."
+    echo
+    $NORMAL
+    /sbin/sulogin
+    /sbin/reboot -f
+}
+
+# Write a message to the log file.
+msg_log()
+{
+    echo "<$*>" >> ${INIT_LOG_FILE}
+    return ${EXIT_CODE_SUCCESS}
+}
+
+# Display a message with an orange warning box [X]
+msg_box_nolog()
+{
+    STRING=$1
+    echo -n "[ ] $STRING"
+    ${SET_CHECK_POSITION}
+    print_status warning
+    echo
+}
+
+# Write the command and it's arguments to the log file, without running the command.
+log_script_name()
+{
+    echo ">>> Script: $* <<<" >> ${INIT_LOG_FILE}
+    return ${EXIT_CODE_SUCCESS}
+}
+
+# Write the command and it's arguments to the log file, and run the command.
+cmd_run_log()
+{
+    echo "[$*]" >> ${INIT_LOG_FILE}
+    ${*} 1>> ${INIT_LOG_FILE} 2>&1
+    return ${?}
+}
+
+# Display the action name, run a command, log its output and display it's
+# status
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+cmd_run_log_box()
+{
+    STRING=$1
+    echo -n "[ ] $STRING"
+    shift
+    ${SET_CHECK_POSITION}
+    $* 1>> ${INIT_LOG_FILE} 2>&1
+    ERROR_CODE=${?}
+    if [ $ERROR_CODE = 0 ]; then
+       print_status success
+    else
+       print_status failure
+    fi
+    echo
+    return $ERROR_CODE
+}
+
+# Display the action name, run a command, log its output and display it's
+# status
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+#    Error codes returned by the command:
+#       0 = success
+#       1 = warning
+#       2 = failure
+cmd_run_log_box_warn()
+{
+    STRING=$1
+    echo -n "[ ] $STRING"
+    shift
+    ${SET_CHECK_POSITION}
+    $* 1>> ${INIT_LOG_FILE} 2>&1
+    ERROR_CODE=${?}
+    if [ $ERROR_CODE = ${EXIT_CODE_SUCCESS} ]; then
+       print_status success
+    elif [ $ERROR_CODE = ${EXIT_CODE_WARNING} ]; then
+       print_status warning
+    else
+       print_status failure
+    fi
+    echo
+    return $ERROR_CODE
+}
+
+
+# Display the action name, run a command, log its output and display it's
+# status
+# If something went wrong during the checks of one of the partitions,
+# fsck will exit with a return value greater than 1
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+#    Error codes returned by the command:
+#       0  = success
+#       1  = warning
+#       >1 = failure
+cmd_run_log_box_warn_checkfs()
+{
+    STRING=$1
+    echo -n "[ ] $STRING"
+    shift
+    ${SET_CHECK_POSITION}
+    $* 1>> ${INIT_LOG_FILE} 2>&1
+    ERROR_CODE=${?}
+    if [ $ERROR_CODE = ${EXIT_CODE_SUCCESS} ]; then
+       print_status success
+    elif [ $ERROR_CODE = 1 ]; then
+       print_status warning
+        ERROR_CODE=${EXIT_CODE_WARNING}
+    else
+       print_status failure
+        ERROR_CODE=${EXIT_CODE_FAILURE}
+    fi
+    echo
+    return $ERROR_CODE
+}
+
+
+# Display the action name, run a command and display it's status (no log).
+# First argument: action name (string)
+# Remaining arguments: command name with it's options
+cmd_run_nolog_box()
+{
+    STRING=$1
+    echo -n "[ ] $STRING"
+    shift
+    ${SET_CHECK_POSITION}
+    $* 1>> /dev/null 2>&1
+    ERROR_CODE=${?}
+    if [ $ERROR_CODE = 0 ]; then
+       print_status success
+    else
+       print_status failure
+    fi
+    echo
+    return $ERROR_CODE
+}
+
+# loadproc() starts a process (often a daemon) with proper error checking
+loadproc()
+{
+    # If no parameters are given, print usage information.
+    if [ ${#} = 0 ]; then
+       msg_log "Usage: loadproc {program}"
+       return ${EXIT_CODE_FAILURE}
+    fi
+
+    # Find the basename of the first parameter (the daemon's name without the
+    # path that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
+    # basename ran).
+    base=$(/usr/bin/basename ${1})
+
+    # the pidlist variable will contain the output of the pidof command. pidof
+    # will try to find the PID's that belong to a certain string; $base in
+    # this case.
+    pidlist=$(pidof -o $$ -o $PPID -o %PPID -x ${base})
+    pid=""
+    for apid in ${pidlist}; do
+       if [ -d /proc/${apid} ]; then
+           pid="${pid} ${apid}"
+       fi
+    done
+    
+    # If the $pid variable contains anything (from the previous for loop) it
+    # means the daemon is already running.
+    if [ ! -n "${pid}" ]; then
+       # Empty $pid variable means it's not running, so we run "$@" (all
+        # parameters given to this function from the script) and then check
+       # the return value.
+       "$@"
+
+       if [ ${?} -ne 0 ]; then
+           return ${EXIT_CODE_FAILURE}
+       else
+           return ${EXIT_CODE_SUCCESS}
+       fi
+    else
+       # The variable $pid was not empty, meaning it was already running.
+       msg_log "Already running"
+       return ${EXIT_CODE_WARNING}
+    fi
+}
+
+# killproc() kills a process with proper error checking
+# Arg. #1: Name of process to kill
+# Arg. #2: Optional signal to kill the process with (like -HUP, -TERM, -KILL, etc)
+killproc()
+{
+    # If no parameters are given, print usage information.
+    if [ $# -lt 1 ]; then
+       msg_log "Usage: killproc {program} [signal]"
+       return ${EXIT_CODE_FAILURE}
+    fi
+
+    killproc_path ${1} /var/run ${2}
+    
+    return ${?}
+}
+
+# killproc_path() kills a process with proper error checking
+# Arg. #1: Name of process to kill
+# Arg. #2: Base directory containing PID file
+# Arg. #3: Optional signal to kill the process with (like -HUP, -TERM, -KILL, etc)
+killproc_path()
+{
+    # If no parameters are given, print usage information.
+    if [ $# -lt 2 ]; then
+       msg_log "Usage: killproc_path {program} {pid-directory} [signal]"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    # Find the basename of the first parameter (the daemon's name without the
+    # path).
+    base=$(/usr/bin/basename ${1})
+
+    piddir=${2}
+
+    # Check if we gave a signal to kill the process with (like -HUP, -TERM,
+    # -KILL, etc) to this function (the third parameter).
+    if [ "${3}" != "" ]; then
+       killlevel=-${3}
+    else
+       nolevel=1
+    fi
+    
+    # The pidlist variable will contains the output of the pidof command. pidof
+    # will try to find the PID's that belong to a certain string; $base in this
+    # case.
+    pidlist=$(pidof -o $$ -o $PPID -o %PPID -x ${base})
+    pid=""
+    for apid in ${pidlist}
+      do
+      if [ -d /proc/${apid} ]; then
+         pid="${pid} ${apid}"
+      fi
+    done
+    
+    # If $pid contains something from the previous for loop it means one or
+    # more PID's were found that belongs to the processes to be killed.
+    if [ -n "${pid}" ]; then
+       # If no kill level was specified we'll try -TERM first and then sleep
+        # for 2 seconds to allow the kill to be completed.
+       if [ "${nolevel}" = 1 ]; then
+           cmd_run_log kill -TERM ${pid}
+
+           # If after -TERM the PID still exists we'll wait 2 seconds before
+           # trying to kill it with -KILL. If the PID still exist after that,
+           # wait two more seconds. If the PIDs still exist by then it's safe
+           # to assume that we cannot kill these PIDs.
+           if /bin/ps h ${pid} >/dev/null 2>&1; then
+               cmd_run_log sleep 2
+               if /bin/ps h ${pid} > /dev/null 2>&1; then
+                   cmd_run_log kill -KILL ${pid}
+                   if /bin/ps h ${pid} > /dev/null 2>&1; then
+                       cmd_run_log sleep 2
+                   fi
+               fi
+           fi
+           /bin/ps h ${pid} >/dev/null 2>&1
+           if [ ${?} = 0 ]; then
+               # If after the -KILL it still exists it can't be killed for
+               # some reason.
+               return ${EXIT_CODE_FAILURE}
+           else
+               # It was killed, remove possible stale PID file in ${piddir}.
+               /bin/rm -f ${piddir}/${base}.pid
+               return ${EXIT_CODE_SUCCESS}
+           fi
+       else
+           # A kill level was provided. Kill with the provided kill level and
+           # wait for 2 seconds to allow the kill to be completed.
+           /bin/kill ${killlevel} ${pid}
+           if /bin/ps h ${pid} > /dev/null 2>&1; then
+               cmd_run_log sleep 2
+           fi
+           /bin/ps h ${pid} >/dev/null 2>&1
+           if [ ${?} = 0 ]; then
+               # If ps' return value is 0 it means it ran ok which indicates
+               # that the PID still exists. This means the process wasn't
+               # killed properly with the signal provided.
+               return ${EXIT_CODE_FAILURE}
+           else
+               # If the return value was 1 or higher it means the PID didn't
+               # exist anymore which means it was killed successfully. Remove
+               # possible stale PID file.
+               /bin/rm -f ${piddir}/${base}.pid
+               return ${EXIT_CODE_SUCCESS}
+           fi
+       fi
+    else
+       # The PID didn't exist so we can't attempt to kill it.
+       msg_log "Not running"
+        return ${EXIT_CODE_WARNING}
+    fi
+}
+
+# reloadproc() sends a signal to a daemon telling it to reload it's
+# configuration file. This is almost identical to the killproc function with
+# the exception that it won't try to kill it with a -KILL signal (aka -9).
+# Arg. #1: Name of process to reload
+# Arg. #2: Optional signal to reload the process with (like -HUP)
+reloadproc()
+{
+    # If no parameters are given, print usage information.
+    if [ ${#} = 0 ]; then
+       msg_log "Usage: reloadproc {program} [signal]"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    # Find the basename of the first parameter (the daemon's name without
+    # the path that was provided so /usr/sbin/syslogd becomes plain 'syslogd'
+    # after basename ran).
+    base=$(/usr/bin/basename ${1})
+
+    # Check if we gave a signal to send to the process (like -HUP) to this
+    # function (the second parameter). If no second parameter was provided set
+    # the nolevel variable. Else set the killlevel variable to the value of $2
+    # (the second parameter).
+    if [ -n "${2}" ]; then
+       killlevel="-${2}"
+    else
+       killlevel="-SIGHUP"
+    fi
+    
+    # The pidlist variable will contains the output of the pidof command. pidof
+    # will try to find the PID's that belong to a certain string; $base in this
+    # case.
+    pidlist=$(pidof -o $$ -o $PPID -o %PPID -x ${base})
+    pid=""
+    for apid in ${pidlist}
+      do
+      if [ -d /proc/${apid} ]; then
+         pid="${pid} ${apid}"
+      fi
+    done
+    
+    # If $pid contains something from the previous for loop it means one or
+    # more PID's were found that belongs to the processes to be reloaded.
+    if [ -n "${pid}" ]; then
+       /bin/kill ${killlevel} ${pid}
+
+       if [ ${?} -ne 0 ]; then
+           sleep 2
+           if statusproc ${base} | grep "not running" 1> /dev/null 2>&1; then
+               return ${EXIT_CODE_FAILURE}
+           fi
+       fi
+    else
+       # If $pid is empty no PID's have been found that belong to the process.
+       msg_log "Not running"
+        return ${EXIT_CODE_WARNING}
+    fi
+    
+    return ${EXIT_CODE_SUCCESS}
+}
+
+
+# statusproc_path() will try to find out if a process is running or not.
+# Arg. #1: Name of process to check
+statusproc()
+{
+    # If no parameters are given, print usage information.
+    if [ $# -lt 1 ]; then
+       msg_log "Usage: statusproc {program}"
+       return ${EXIT_CODE_FAILURE}
+    fi
+
+    statusproc_path ${1} /var/run
+    
+    return ${?}
+}
+
+
+# statusproc_path() will try to find out if a process is running or not.
+# Arg. #1: Name of process to check
+# Arg. #2: Base directory containing PID file
+statusproc_path()
+{
+    # If no parameters are given, print usage information.
+    if [ $# -lt 2 ]; then
+       msg_log "Usage: status {program} {pid-directory}"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    # Find the basename of the first parameter (the daemon's name without the
+    # path).
+    base=$(/usr/bin/basename ${1})
+
+    piddir=${2}
+
+    # $pid will contain a list of PID's that belong to a process.
+    pid=$(pidof -o $$ -o $PPID -o %PPID -x ${base})
+    if [ -n "${pid}" ]; then
+       # If $pid contains something, the process is running, print the content
+       # of the $pid variable.
+       echo "${base} running with Process ID ${pid}"
+       return ${EXIT_CODE_SUCCESS}
+    fi
+
+    # If $pid doesn't contain it check if a PID file exists and inform the
+    # user about this stale file.
+    if [ -f ${piddir}/${base}.pid ]; then
+       pid=$(head -1 ${piddir}/${base}.pid)
+       if [ -n "${pid}" ]; then
+           echo "${base} not running but ${piddir}/${base}.pid exists"
+           return ${EXIT_CODE_FAILURE}
+       fi
+    else
+       echo "${base} is not running"
+    fi
+}
diff --git a/stage2/bootscripts/halt b/stage2/bootscripts/halt
new file mode 100755 (executable)
index 0000000..575d648
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# halt
+
+#
+# Call halt. See man halt for the meaning of the parameters
+#
+/sbin/halt -d -f -i -p
+
+exit $?
diff --git a/stage2/bootscripts/ifdown b/stage2/bootscripts/ifdown
new file mode 100755 (executable)
index 0000000..cc0951a
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# ifdown
+
+DEVICE=${1}
+
+BRCTL=/usr/sbin/brctl
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load network interface card parameters
+source /etc/sysconfig/network/ifconfig.${DEVICE}
+
+# Check that the brctl program is present and executable.
+check_brctl()
+{
+    if [ ! -x ${BRCTL} ]; then
+        msg_log "*** ERROR: /usr/sbin/brctl not found."
+        exit ${EXIT_CODE_FAILURE}
+    fi
+}
+
+if [ "$BOOTPROTO" == "dhcp" ]; then
+    # DHCP configuration
+
+    # Load DHCP client parameters
+    source /etc/sysconfig/network/dhcp-client
+
+    if [ ! -x ${DHCP_PROG} ]; then
+       echo "Program \"${DHCP_PROG}\" is not executable."
+        exit ${EXIT_CODE_FAILURE}
+    fi
+    cmd_run_log ${DHCP_PROG} ${DHCP_STOP} ${DEVICE} || exit ${EXIT_CODE_FAILURE}
+elif [ x${BOOTPROTO} = "xstatic" ]; then
+    # Static configuration
+    cmd_run_log ip addr flush ${DEVICE} &&
+    cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE}
+elif [ x${BOOTPROTO} = "xpppoe" ]; then
+    # PPPoE configuration
+    cmd_run_log pppoe-stop
+    cmd_run_log ip addr flush ${DEVICE} &&
+    cmd_run_log ip link set ${DEVICE} down || exit ${EXIT_CODE_FAILURE}
+else
+    exit 1
+fi
+
+# Determining if the interface is part of a bridge:
+if [ -n "${BRIDGE_TO}" ]; then
+    check_brctl
+    cmd_run_log ${BRCTL} delif ${BRIDGE_TO} ${1} || exit 1
+fi
+
+# Determining if the interface is a bridge:
+if [ "x${BRIDGE}" == "xyes" ]; then
+    # Check that the brctl program is present and executable.
+    if [ ! -x ${BRCTL} ]; then
+        msg_log "*** ERROR: /usr/sbin/brctl not found."
+        exit ${EXIT_CODE_FAILURE}
+    fi
+
+    cmd_run_log ${BRCTL} delbr ${1}
+fi
+
+exit $?
diff --git a/stage2/bootscripts/ifup b/stage2/bootscripts/ifup
new file mode 100755 (executable)
index 0000000..7f7d15f
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# ifup
+
+DEVICE=${1}
+
+BRCTL=/usr/sbin/brctl
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load network interface card parameters
+source /etc/sysconfig/network/ifconfig.${DEVICE}
+
+# Check that the brctl program is present and executable.
+check_brctl()
+{
+    if [ ! -x ${BRCTL} ]; then
+        msg_log "*** ERROR: /usr/sbin/brctl not found."
+        exit ${EXIT_CODE_FAILURE}
+    fi
+}
+
+# Determining if the interface is a bridge:
+if [ "x${BRIDGE}" == "xyes" ]; then
+    check_brctl
+    cmd_run_log ${BRCTL} addbr ${1} &&
+    cmd_run_log ${BRCTL} stp ${1} off || exit 1
+fi
+
+# Determining if the interface is part of a bridge:
+if [ -n "${BRIDGE_TO}" ]; then
+    check_brctl
+    cmd_run_log ${BRCTL} addif ${BRIDGE_TO} ${1} || exit 1
+fi
+
+if [ "x${BOOTPROTO}" = "xdhcp" ]; then
+    # DHCP configuration
+
+    # Load DHCP client parameters
+    source /etc/sysconfig/network/dhcp-client
+
+    # Make sure no file named `/var/run/dhclient.pid' remains.
+    if [ -f "/var/run/dhclient.pid" ]; then
+       rm -f /var/run/dhclient.pid
+    fi
+
+    if [ ! -x "${DHCP_PROG}" ]; then
+       echo "Program \"${DHCP_PROG}\" is not executable."
+        exit ${EXIT_CODE_FAILURE}
+    fi
+
+    cmd_run_log ${DHCP_PROG} ${DHCP_START} ${DEVICE}
+elif [ x${BOOTPROTO} = "xstatic" ]; then
+    # Static configuration
+    cmd_run_log ip addr add ${IPADDR}/${PREFIX_LENGTH} dev ${DEVICE} brd + ${IFSCOPE} &&
+    cmd_run_log ip link set ${DEVICE} up
+elif [ x${BOOTPROTO} = "xpppoe" ]; then
+    # PPPoE configuration
+    cmd_run_log pppoe-start
+else
+    exit 1
+fi
+
+exit $?
diff --git a/stage2/bootscripts/initlog b/stage2/bootscripts/initlog
new file mode 100755 (executable)
index 0000000..ba41591
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# initlog
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+case "$1" in
+    start)
+       # Initialization of the log file for the INIT process
+       if [ ! -d ${INIT_LOG_PATH} ]; then
+           boot_failure "Missing ${INIT_LOG_PATH} directory."
+       fi
+       
+       mount -n -t tmpfs -o size=100k,nr_inodes=10,mode=0755 tmpfs ${INIT_LOG_PATH} &&
+        touch ${INIT_LOG_FILE}
+       ;;
+    
+    stop)
+        umount ${INIT_LOG_PATH}
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/keyboard b/stage2/bootscripts/keyboard
new file mode 100755 (executable)
index 0000000..9cce021
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# keyboard
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load keyboard parameters
+source /etc/sysconfig/keyboard
+
+if [ -z ${KEYBOARD} ]; then
+    # Default value
+    KEYBOARD=us
+fi
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box "Configuring ${KEYBOARD} keyboard" loadkeys ${KEYBOARD}
+       ;;
+    *)
+       echo "Usage: $0 {start}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/modules b/stage2/bootscripts/modules
new file mode 100755 (executable)
index 0000000..df5f195
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# modules
+# Module auto-loading script
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Assure that the kernel has module support.
+if [ ! -e /proc/ksyms -a ! -e /proc/modules ]; then
+    exit 0
+fi
+
+modules_start()
+{
+    # Exit if there's no modules file
+    if [ ! -r /etc/sysconfig/modules ]; then
+        return 0
+    fi
+
+    echo "Loading modules:"
+
+    # Only try to load modules if the user has actually given us
+    # some modules to load.
+    while read module args; do
+       # Ignore comments and blank lines.
+       case "$module" in
+           ""|"#"*) continue ;;
+       esac
+       
+       # Attempt to load the module, making
+       # sure to pass any arguments provided.
+       modprobe ${module} ${args} >/dev/null
+       
+       # Print the module name if successful,
+       # otherwise take note.
+       if [ $? -eq 0 ]; then
+           echo " ${module}"
+       else
+           failedmod="${failedmod} ${module}"
+       fi
+    done < /etc/sysconfig/modules
+    
+    # Print a failure message with a list of any
+    # modules that may have failed to load.
+    if [ -n "${failedmod}" ]; then
+        ${FAILURE}
+       echo "Failed to load modules:${failedmod}"
+    fi
+}
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Loading modules" modules_start
+       ;;
+    
+    *)
+       echo "Usage: $0 {start}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/mountfs b/stage2/bootscripts/mountfs
new file mode 100755 (executable)
index 0000000..15cde93
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# mountfs
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       # Remount the root partition in read-write mode.
+       cmd_run_log_box "Remounting root file system Read/Write" \
+           mount -o remount,rw /
+
+        # Remove the possible /fastboot and /forcefsck files. they are only
+        # supposed to be used during the next reboot's checkfs which just
+        # happened. If you want to fastboot or forcefsck again you'll have to
+        # recreate the files
+        rm -f /fastboot /forcefsck
+
+        # Walk through /etc/fstab and mount all file systems that don't have
+       # the noauto option set in the fs_mntops field (the 4th field. See man
+       # fstab for more info).
+       cmd_run_log_box "Mounting other file systems" mount -a -O no_netdev
+        ;;
+
+    stop)
+        # Unmount all the file systems, mounting the root file system
+        # read-only (all are unmounted but because root can't be unmounted
+        # at this point mount will automatically mount it read-only which
+        # is what is supposed to happen. This way no data can be written
+       # anymore to disk).
+       cmd_run_nolog_box "Unmounting file systems" umount -a -d -r -v -t notmpfs,noproc
+        if [ $? -ne 0 ]; then
+            exit ${EXIT_CODE_WARNING}
+        fi
+        ;;
+    
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit ${EXIT_CODE_FAILURE}
+        ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/mountkernfs b/stage2/bootscripts/mountkernfs
new file mode 100755 (executable)
index 0000000..bcdc60c
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# mountkernfs
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+case "$1" in
+    start)
+       # The "-n: option tells mount not to write to the /etc/mtab
+       # file (because /etc/mtab is a symbolic link to /proc/mounts,
+       # which we are in the process of mounting).
+       cmd_run_log_box "Mounting /proc file system" mount -n proc
+       cmd_run_log_box "Mounting /sys file system" mount -n sys
+       ;;
+
+    stop)
+       umount -n proc
+        ;;
+
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/mountnetfs b/stage2/bootscripts/mountnetfs
new file mode 100755 (executable)
index 0000000..d397af7
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# mountnetfs
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+mountnetfs_stop() {
+    # The following line obtains a list from the output of
+    # mount for all netfs types and anything that was
+    # mounted with the _netdev option.
+    NETMOUNTS=`/bin/mount \
+        | /bin/grep '_netdev\|smbfs\|ncpfs|\coda\|nfs' \
+       | /usr/bin/cut -d " " -f 3 | /bin/sed 's/$/ /g'`
+
+    # Check to see if anything was listed from above
+    # (see if anything is actually needs to be unmounted)
+    if [ x"$NETMOUNTS" != x ]; then
+       # There is something mounted
+       # Try and stop processes the nice way
+       # (probably won't work in most cases)
+       /bin/fuser -TERM -m $NETMOUNTS > /dev/null
+       
+       # Check and see if it found anything.  If it
+       # did, then give 3 seconds for things to exit
+       # the nice way before killing them off.
+       # This one will work all of the time!
+       if [ $? == 0 ]; then
+           /bin/sleep 3
+           /bin/fuser -km $NETMOUNTS > /dev/null
+       fi
+
+       # We now need to unmount all network filesystems.
+       # We will do this with two umount commands to allow
+       # for broken behavior of smbmount, and also to make
+       # certain that netmounts without the _netdev option
+       # will still get unmounted.
+       /bin/umount -a -O _netdev
+
+       # save the return value from umount
+       if [ $? != 0 ]; then
+           NERRVAL=${EXIT_CODE_FAILURE}
+       fi
+
+       # Now catch the rest of the network filesystems
+       # by fstype.  This list can be extended later as
+       # more network filesystems are supported by mount.
+       /bin/umount -a -t coda,ncpfs,nfs,smbfs
+       if [ $? == 0 ]; then
+           return ${NERRVAL}
+       else
+           # make certain that we return an error
+           return ${EXIT_CODE_FAILURE}
+       fi
+    else
+       # There is nothing mounted
+       msg_log "No network volumes mounted!"
+    fi
+}
+
+
+case "$1" in
+    start)
+        # Walk through /etc/fstab and mount all file systems that have the
+       # _netdev option set in the fs_mntops field (the 4th field. See man
+       # fstab for more info).
+       cmd_run_log_box "Mounting network file systems" mount -a -O _netdev
+        ;;
+
+    stop)
+       cmd_run_log_box "Unmounting network file systems" mountnetfs_stop
+        ;;
+
+    *)
+        echo "Usage: $0 {start|stop}"
+       exit ${EXIT_CODE_FAILURE}
+    ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/network b/stage2/bootscripts/network
new file mode 100755 (executable)
index 0000000..3fa69ff
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# description: Activates/Deactivates all network interfaces configured to
+#              start at boot time.
+#
+# Modified by Hugo Villeneuve
+#
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load global network parameters
+source /etc/sysconfig/network/network-parameters
+
+# Check that the ip program is present and executable.
+if [ ! -x /sbin/ip ]; then
+    msg_log "*** ERROR: /sbin/ip not found."
+    exit ${EXIT_CODE_FAILURE}
+fi
+
+# Check that the hostname program is present and executable.
+if [ ! -x /bin/hostname ]; then
+    msg_log "*** ERROR: /bin/hostname not found."
+    exit ${EXIT_CODE_FAILURE}
+fi
+
+CWD=`pwd`
+cd /etc/sysconfig/network
+
+# See how we were called.
+case "$1" in
+    start)
+       for i in ${INTERFACES_UP}; do
+           if LANG=C egrep -L "^ONBOOT=\"?[Yy][Ee][Ss]\"?" ifconfig.$i >/dev/null 2>&1 ; then
+               cmd_run_log_box "Ethernet Adapter <$i> init" /etc/rc.d/init.d/ifup "$i"
+           fi
+       done
+
+       cmd_run_log_box "Setting hostname: ${DEFAULT_HOSTNAME}" /bin/hostname ${DEFAULT_HOSTNAME}
+       
+       if [ -n "${GATEWAY}" ]; then
+           cmd_run_log_box "Adding default route to gateway ${GATEWAY}" ip route add default via ${GATEWAY}
+       fi
+        ;;
+    
+    stop)
+       for i in ${INTERFACES_DN} ; do
+           if LC_ALL= LANG= ip link show dev $i 2> /dev/null | grep -q "UP" >/dev/null 2>&1 ; then
+               cmd_run_log_box "Ethernet Adapter <$i> stop" /etc/rc.d/init.d/ifdown "$i"
+           fi
+       done
+        ;;
+    
+    restart)
+        cd $CWD
+       $0 stop
+       $0 start
+       ;;
+    
+    status)
+       echo "Active devices:"
+        /sbin/ip -oneline addr show up | grep inet \
+           | sed 's/\(^.*\): \([a-zA-Z0-9]*\) *inet \([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/   \2 (\3)/'
+       ;;
+    
+    *)
+        echo $"Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+esac
+
+exit $?
diff --git a/stage2/bootscripts/nfs b/stage2/bootscripts/nfs
new file mode 100755 (executable)
index 0000000..e8621b7
--- /dev/null
@@ -0,0 +1,147 @@
+#!/bin/sh
+#
+# nfs           This shell script takes care of starting and stopping
+#               the NFS services.
+#
+# description: NFS is a popular protocol for file sharing across TCP/IP \
+#              networks. This service provides NFS server functionality, \
+#              which is configured via the /etc/exports file.
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load global network parameters
+source /etc/sysconfig/network/network-parameters
+
+# Check that networking is up.
+#[ ${NETWORKING} = "no" ] && exit ${EXIT_CODE_WARNING}
+
+# Check for presence of executables
+if [ ! -x /usr/sbin/rpc.nfsd ]; then
+    echo "Missing rpc.nfsd executable"
+    exit ${EXIT_CODE_WARNING}
+fi
+if [ ! -x /usr/sbin/rpc.mountd ]; then
+    echo "Missing rpc.mountd executable"
+    exit ${EXIT_CODE_WARNING}
+fi
+if [ ! -x /usr/sbin/exportfs ]; then
+    echo "Missing exportfs executable"
+    exit ${EXIT_CODE_WARNING}
+fi
+if [ ! -s /etc/exports ]; then
+    echo "Missing /etc/exports configuration file"
+    exit ${EXIT_CODE_WARNING}
+fi
+
+if [ "x${NFS_SERVER_ENA}" != "xyes" -a "x${NFS_SERVER_ENA}" != "xYes" -a "x${NFS_SERVER_ENA}" != "xYES" ]; then
+    msg_log "NFS server disabled in '/etc/sysconfig/network/network-parameters'"
+    exit ${EXIT_CODE_WARNING}
+fi
+
+# Check for and source configuration file otherwise set defaults
+# TUNE_QUEUE: controls whether to up the size of input queues
+[ -f /etc/sysconfig/network/nfs ] && . /etc/sysconfig/network/nfs
+
+[ -z "$MOUNTD_NFS_V2" ] && MOUNTD_NFS_V2=auto
+[ -z "$MOUNTD_NFS_V3" ] && MOUNTD_NFS_V3=auto
+
+# Number of servers to be started by default
+[ -z "$NFSDCOUNT" ] && NFSDCOUNT=8
+
+# Remote quota server
+[ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad`
+
+# Get the initial values for the input sock queues
+# at the time of running the script.
+if [ "$TUNE_QUEUE" = "yes" ]; then
+    RMEM_DEFAULT=`/sbin/sysctl -n net.core.rmem_default`
+    RMEM_MAX=`/sbin/sysctl -n net.core.rmem_max`
+    # 256kb recommended minimum size based on SPECsfs NFS benchmarks
+    [ -z "$NFS_QS" ] && NFS_QS=262144
+fi
+
+MOUNTD_OPTIONS="$MOUNTD_OPTIONS --no-nfs-version 2"
+MOUNTD_OPTIONS="$MOUNTD_OPTIONS --nfs-version 3"
+
+nfsd_start() {
+    # Apply input queue increase for nfs server
+    if [ "$TUNE_QUEUE" = "yes" ]; then
+       /sbin/sysctl -w net.core.rmem_default=$NFSD_QS >/dev/null 2>&1
+       /sbin/sysctl -w net.core.rmem_max=$NFSD_QS >/dev/null 2>&1
+    fi
+    cmd_run_log_box "Starting NFS services" loadproc /usr/sbin/exportfs -ra
+    if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
+       cmd_run_log_box "Starting NFS quotas" loadproc rpc.rquotad
+    fi
+    cmd_run_log_box "Starting NFS daemon" loadproc rpc.nfsd $NFSDCOUNT
+    
+    [ -n "$MOUNTD_PORT" ] \
+       && MOUNTD_OPTIONS="$MOUNTD_OPTIONS -p $MOUNTD_PORT"
+    [ "$MOUNTD_TCP" = "no" -o "$MOUNTD_TCP" = "NO" ] \
+       && MOUNTD_OPTIONS="$MOUNTD_OPTIONS --no-tcp"
+    
+    cmd_run_log_box "Starting NFS mountd" loadproc rpc.mountd $MOUNTD_OPTIONS
+    
+    touch /var/lock/subsys/nfs
+    # reset input queue for rest of network services
+    if [ "$TUNE_QUEUE" = "yes" ]; then
+       /sbin/sysctl -w net.core.rmem_default=$RMEM_DEFAULT >/dev/null 2>&1
+       /sbin/sysctl -w net.core.rmem_max=$RMEM_MAX >/dev/null 2>&1
+    fi
+}
+
+nfsd_stop() {
+    cmd_run_log_box "Stopping NFS mountd" killproc rpc.mountd
+    cmd_run_log_box "Stopping NFS daemon" killproc nfsd
+    if [ -n "$RQUOTAD" ]; then
+       cmd_run_log_box "Stopping NFS quotas" killproc rpc.rquotad
+    fi
+
+    # Do it the last so that clients can still access the server
+    # when the server is running.
+    echo "Refreshing NFS Exported Filesystems..."
+    /usr/sbin/exportfs -au
+
+    rm -f /var/lock/subsys/nfs
+}
+
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "NFS server start" nfsd_start
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "NFS server stop" nfsd_stop
+       ;;
+   
+    reload)
+       /usr/sbin/exportfs -ra
+       touch /var/lock/subsys/nfs
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc rpc.mountd
+       statusproc nfsd
+       if [ -n "$RQUOTAD" ]; then
+           statusproc rpc.rquotad
+       fi
+       ;;
+    
+    *)
+       echo "Usage: $0 {reload|restart|start|status|stop}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/portmap b/stage2/bootscripts/portmap
new file mode 100755 (executable)
index 0000000..9a54dc4
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# portmap
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "portmap start" loadproc portmap
+       ;;
+
+    stop)
+       cmd_run_log_box_warn "portmap stop" killproc portmap
+       ;;
+   
+    reload)
+       reloadproc portmap
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc portmap
+       ;;
+    
+    *)
+       echo "Usage: $0 {reload|restart|start|status|stop}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/rc b/stage2/bootscripts/rc
new file mode 100755 (executable)
index 0000000..137be04
--- /dev/null
@@ -0,0 +1,150 @@
+#!/bin/sh
+
+# rc
+
+# By Jason Pearce  - jason.pearce@linux.org
+# Modified by Gerard Beekmans - gerard@linuxfromscratch.org
+# print_error_msg based on ideas by Simon Perreault -
+# nomis80@videotron.ca
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+# If you uncomment the debug variable below none of the scripts will be
+# executed, just the script name and parameters will be echo'ed to the
+# screen so you can see how the scripts are called by rc.
+#debug="echo"
+
+# If the return value of the scripts executed in each runlevel (start or stop)
+# is not 0 (success) or 1 (warning), something went wrong with error checking
+# inside the script. The print_error_msg function will be called and the
+# message plus the return value of the K script will be printed to the screen.
+
+# Prints an error message when an unforeseen error occurred that wasn't
+# trapped for some reason by error checking.
+print_error_msg()
+{
+    ${FAILURE}
+    echo "   Error in subscript \"${1}\" (${2})"
+    ${NORMAL}
+    echo "   Press a key to continue..."
+    read
+}
+
+# Start script or program.
+startup()
+{
+    ${debug} "$@"
+}
+
+check_script_status()
+{
+    if [ ! -f $1 ]; then
+       echo "$1 is not a valid symlink"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    if [ ! -x $1 ]; then
+       echo "$1 is not executable, skipping"
+       return ${EXIT_CODE_FAILURE}
+    fi
+    
+    return ${EXIT_CODE_SUCCESS}
+}
+
+# Configure for displaying only relevant messages to console
+/bin/dmesg -n ${LOGLEVEL}
+
+# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
+trap ":" INT QUIT TSTP
+
+runlevel=${1}
+
+# If no runlevel was passed as an argument, we won't change runlevels.
+if [ "${runlevel}" = "" ]; then
+    echo "Usage: ${0} <runlevel>" >&2
+    exit ${EXIT_CODE_FAILURE}
+fi
+
+# PREVLEVEL is set by init
+# If PREVLEVEL is not set it means that there is no previous runlevel and
+# we'll set previous to N.
+previous=${PREVLEVEL}
+if [ "${previous}" = "" ]; then
+    previous="N"
+fi
+
+# Is there an rc directory for the new runlevel?
+if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
+    echo "/etc/rc.d/rc${runlevel}.d directory does not exist"
+    exit ${EXIT_CODE_FAILURE}
+fi
+
+# First, attempt to stop all services started by previous runlevel,
+# and killed in this runlevel (K8 scripts
+# If so, first collect all the K* scripts in the new run level.
+if [ ${previous} != N ]; then
+    for kill_script in $(ls /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null); do
+       if [ -f ${kill_script} ]; then
+           # "suffix" will contain the script name without the leading Kxx.
+           suffix="${kill_script##*/K[0-9][0-9]}"
+           
+           # If there is a S script in the previous runlevel corresponding
+           # to this K script, determine what it's full path is.
+           previous_start="/etc/rc.d/rc${previous}.d/S[0-9][0-9]${suffix}"
+
+           # If no start script was found in the previous run level it could
+           # be that something was started in rcS.d (sysinit level) so we'll
+           # determine the path for that possibility as well.
+           sysinit_start="/etc/rc.d/rcS.d/S[0-9][0-9]${suffix}"
+
+           # Stop the service if there is a start script in the previous run
+           # level or in the sysinit level. Otherwise, don't execute this K
+           # script because the service is not active.
+           if [ -f ${previous_start} -o -f ${sysinit_start} ]; then
+               startup ${kill_script} stop
+               retval=${?}
+               if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
+                   print_error_msg ${kill_script} ${retval}
+               fi
+           fi
+       fi
+    done
+fi
+
+# Now run the START scripts for this runlevel.
+for start_script in $(ls /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null); do
+    # "suffix" will contain the script name without the leading Sxx.
+    suffix=${start_script#/etc/rc.d/rc${runlevel}.d/S[0-9][0-9]}
+
+    # If there is a K script in the current runlevel corresponding
+    # to this S script, determine what it's full path is.
+    current_stop=/etc/rc.d/rc${runlevel}.d/K[0-9][0-9]${suffix}
+
+    if [ ${previous} != "N" ]; then
+       # If there is a S script in the previous runlevel corresponding
+       # to this S script, determine what it's full path is.
+       previous_start=/etc/rc.d/rc${previous}.d/S[0-9][0-9]${suffix}
+    else
+       previous_start=""
+    fi
+
+    if [ -f "$previous_start" -a ! -f "$current_stop" ]; then
+       # If the service was started in the previous level and was not stopped
+       # in this runlevel, then we don't have to re-start it.
+       continue
+    else
+       # If the service was not started in the previous level, or if we just
+       # stopped it in this runlevel, then we need to start or restart it.
+       check_script_status ${start_script}
+       if [ ${?} = ${EXIT_CODE_SUCCESS} ]; then
+           startup ${start_script} start
+           retval=${?}
+           if [ ${retval} -ne ${EXIT_CODE_SUCCESS} -a ${retval} -ne ${EXIT_CODE_WARNING} ]; then
+               print_error_msg ${start_script} ${retval}
+           fi
+       fi
+    fi
+done
+
+exit ${EXIT_CODE_SUCCESS}
diff --git a/stage2/bootscripts/reboot b/stage2/bootscripts/reboot
new file mode 100755 (executable)
index 0000000..2f6c3e5
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# reboot
+
+# Call reboot. See man halt for the meaning of the parameters
+echo "System reboot in progress..."
+
+/sbin/reboot -d -f -i
+
+exit $?
diff --git a/stage2/bootscripts/sendsignals b/stage2/bootscripts/sendsignals
new file mode 100755 (executable)
index 0000000..6bde3e3
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# sendsignals
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Send all the remaining processes the TERM signal
+cmd_run_log_box "Sending all processes the TERM signal" /sbin/killall5 -15
+
+# Send all the remaining process (after sending them the TERM signal before)
+# the KILL signal.
+cmd_run_log_box "Sending all processes the KILL signal" /sbin/killall5 -9
+
+exit $?
diff --git a/stage2/bootscripts/setclock b/stage2/bootscripts/setclock
new file mode 100755 (executable)
index 0000000..2a00c66
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# setclock
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load clock parameters
+source /etc/sysconfig/clock
+
+case "$UTC" in
+    yes|true|1)
+       TIME_BASE="--utc"
+       ;;
+    no|false|0)
+       TIME_BASE="--localtime"
+       ;;
+    *)
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box "Setting system time from hardware clock value" \
+           /sbin/hwclock --hctosys "$TIME_BASE"
+       ;;
+    stop)
+       cmd_run_log_box "Saving system time value in hardware clock" \
+           /sbin/hwclock --systohc "$TIME_BASE"
+       ;;
+    *)
+       echo "Usage: $0 {start|stop}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/sshd b/stage2/bootscripts/sshd
new file mode 100755 (executable)
index 0000000..83e4349
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# sshd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+SSHD="/usr/sbin/sshd -4"
+
+gen_keys() {
+    if [ ! -e /etc/ssh/ssh_host_key ] ; then
+       echo "Generating Hostkey..."
+       /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
+    fi
+    if [ ! -e /etc/ssh/ssh_host_dsa_key ] ; then
+       echo "Generating DSA-Hostkey..."
+       /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
+    fi
+    if [ ! -e /etc/ssh/ssh_host_rsa_key ] ; then
+       echo "Generating RSA-Hostkey..."
+       /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+    fi
+}
+
+sshd_start() {
+    # Checking configuration
+    if [ ! -e /etc/ssh/sshd_config ] ; then
+       echo "You need an /etc/ssh/sshd_config file to run sshd"
+       echo "There is a sample file in  /usr/share/doc/openssh"
+       exit ${EXIT_CODE_FAILURE}
+    fi
+
+    gen_keys
+    
+    if [ $? -ne 0 ]; then
+       exit ${EXIT_CODE_FAILURE}
+    else
+       loadproc ${SSHD}
+    fi
+}
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "sshd start" sshd_start
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "sshd stop" killproc sshd
+       ;;
+   
+    reload)
+       reloadproc sshd
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc sshd
+       ;;
+    
+    *)
+       echo "Usage: $0 {reload|restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/swap b/stage2/bootscripts/swap
new file mode 100755 (executable)
index 0000000..083b980
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# swap
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box "Enabling swap partition" swapon -a
+       ;;
+    
+    stop)
+       cmd_run_log_box "Disabling swap partition" swapoff -a
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    status)
+       swapon -s
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/sysklogd b/stage2/bootscripts/sysklogd
new file mode 100755 (executable)
index 0000000..9f1c310
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# syslogd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting system log daemon" loadproc syslogd
+        cmd_run_log_box_warn "Starting kernel log daemon" loadproc klogd
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "Stopping kernel log daemon" killproc klogd
+       cmd_run_log_box_warn "Stopping system log daemon" killproc syslogd
+       ;;
+    
+    reload)
+       cmd_run_nolog_box "Reloading system log daemon configuration file" reloadproc syslogd 1
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    status)
+       statusproc syslogd
+       statusproc klogd
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|reload|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+       ;;
+    
+esac
+
+exit $?
diff --git a/stage2/bootscripts/udev b/stage2/bootscripts/udev
new file mode 100644 (file)
index 0000000..98542e8
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# udev
+# Udev cold-plugging script
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+udev_start()
+{
+    # Udev handles uevents itself, so we don't need to have
+    # the kernel call out to any binary in response to them
+    echo > /proc/sys/kernel/hotplug &&
+    
+    # Copy static device nodes to /dev
+    cp -a /lib/udev/devices/* /dev &&
+    
+    # Start the udev daemon to continually watch for, and act on,
+    # uevents
+    /sbin/udevd --daemon &&
+    
+    # Now traverse /sys in order to "coldplug" devices that have
+    # already been discovered
+    /sbin/udevtrigger &&
+    
+    # Now wait for udevd to process the uevents we triggered
+    /sbin/udevsettle
+}
+
+# See how we were called
+case "$1" in
+    start)
+        if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
+           boot_failure "FAILURE: Unable to create devices without a SysFS filesystem."
+        fi
+
+        # Mount a temporary file system over /dev, so that any devices
+        # made or removed during this boot don't affect the next one.
+        # The reason we don't write to mtab is because we don't ever
+        # want /dev to be unavailable (such as by `umount -a').
+        mount -n -t tmpfs tmpfs /dev -o mode=755
+        if [ ${?} != 0 ]; then
+           boot_failure "FAILURE: Cannot mount a tmpfs onto /dev."
+        fi
+
+       cmd_run_log_box_warn "Udevd start" udev_start
+       ;;
+    
+    *)
+       echo "Usage: $0 {start}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/bootscripts/udev_retry b/stage2/bootscripts/udev_retry
new file mode 100755 (executable)
index 0000000..1aaa48a
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# udev_retry
+# Udev cold-plugging script (retry)
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+udev_retry_start()
+{
+    # From Debian: "copy the rules generated before / was mounted
+    # read-write":
+    for file in /dev/.udev/tmp-rules--*; do
+       dest=${file##*tmp-rules--}
+       [ "$dest" = '*' ] && break
+       cat $file >> /etc/udev/rules.d/$dest
+       rm -f $file
+    done
+    
+    # Re-trigger the failed uevents in hope they will succeed now
+    /sbin/udevtrigger --retry-failed &&
+    
+    # Now wait for udevd to process the uevents we triggered
+    /sbin/udevsettle
+}
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Retrying failed uvents, if any" udev_retry_start
+       ;;
+    
+    *)
+       echo "Usage: $0 {start}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage2/cis-ac b/stage2/cis-ac
new file mode 100755 (executable)
index 0000000..eda5760
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE}-build &&
+../${PACKAGE}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    ${CONFIGURE_OPTS} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-ac-nobuild b/stage2/cis-ac-nobuild
new file mode 100755 (executable)
index 0000000..443431d
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    ${CONFIGURE_OPTS} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-apr b/stage2/cis-apr
new file mode 100755 (executable)
index 0000000..057c918
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+INSTALLBUILDDIR="/usr/lib/$(get_pkg_name ${1})-$(get_pkg_ver_major ${1})"
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-installbuilddir=${INSTALLBUILDDIR}/build &&
+make -j ${MAKEJOBS} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-binutils b/stage2/cis-binutils
new file mode 100755 (executable)
index 0000000..d49567d
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# First, we only want to install the linker. This is done because the
+# source and build directories from stage1 were not kept.
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --enable-shared &&
+make tooldir=/usr &&
+make check &&
+make tooldir=/usr install &&
+
+cp -v -f ../${1}/include/libiberty.h /usr/include &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage2/cis-bison b/stage2/cis-bison
new file mode 100755 (executable)
index 0000000..440d960
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+# The configure system causes bison to be built without support for
+# internationalization of error messages if a bison program is not
+# already in $PATH. The following addition will correct this:
+echo '#define YYENABLE_NLS 1' >> config.h &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-bootscripts b/stage2/cis-bootscripts
new file mode 100755 (executable)
index 0000000..a9c849c
--- /dev/null
@@ -0,0 +1,152 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+DHCP_USED="no"
+
+# "/etc/sysconfig/network/ifconfig.lo" file creation
+cat > /etc/sysconfig/network/ifconfig.lo << "EOF" &&
+ONBOOT="yes"
+BOOTPROTO="static"
+IPADDR="127.0.0.1"
+PREFIX_LENGTH=8
+IFSCOPE="scope host"
+EOF
+
+LOOP_INDEX="0"
+for nic_device in ${INTERFACES}; do
+    file="/etc/sysconfig/network/ifconfig.${nic_device}"
+    echo "ONBOOT=\"yes\"" >> ${file} &&
+    echo "BOOTPROTO=\"${BOOTPROTO[${LOOP_INDEX}]}\"" >> ${file} &&
+    echo "IPADDR=\"${IP_ADDRESS[${LOOP_INDEX}]}\"" >> ${file} &&
+    echo "PREFIX_LENGTH=\"${PREFIX_LENGTH[${LOOP_INDEX}]}\"" >> ${file} &&
+    echo "IFSCOPE=\"\"" >> ${file} &&
+    evaluate_retval
+
+    if [ x${BOOTPROTO[${LOOP_INDEX}]} == "xdhcp" ]; then
+       GATEWAY=""
+       DHCP_USED="yes"
+    fi
+
+    LOOP_INDEX=$((${LOOP_INDEX} + 1))
+done
+
+# "/etc/sysconfig/network/network-parameters" file creation
+echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters &&
+echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters &&
+echo "DEFAULT_HOSTNAME=\"${MACHINE_NAME}.${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters &&
+echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters &&
+echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters &&
+echo "GATEWAY=\"${GATEWAY}\"" >> /etc/sysconfig/network/network-parameters &&
+
+cat >> /etc/sysconfig/network/network-parameters << EOF &&
+
+# On which network interface(s) to activate the DHCP server.
+# Leave empty or comment the line to disable the DHCP server.
+#DHCP_SERVER_IF="eth0"
+
+# Set to "yes" to enable the NFS server:
+NFS_SERVER_ENA="no"
+
+# Set FIREWALL_ENA to "yes" to enable the firewall:
+FIREWALL_ENA="no"
+# Set FIREWALL_LAN to the ethernet interface connected to the internal LAN:
+FIREWALL_LAN="eth0"
+# Set FIREWALL_WWW to the ethernet interface connected to the outside world (internet):
+FIREWALL_WWW="eth1"
+EOF
+
+# "/etc/resolv.conf" file
+if [ x${DHCP_USED} == "xno" ]; then
+    if [ -f /etc/resolv.conf ]; then
+       rm -f /etc/resolv.conf || exit 1
+    fi
+    touch /etc/resolv.conf &&
+    for i in $(seq 0 $((${#NAMESERVER[@]} - 1))); do
+       echo "nameserver ${NAMESERVER[i]}" >> /etc/resolv.conf || exit 1
+    done
+    chmod 644 /etc/resolv.conf
+    evaluate_retval
+fi
+
+# /etc/hosts file
+echo "127.0.0.1    localhost.localdomain localhost" > /etc/hosts
+evaluate_retval
+if [ x${DHCP_USED} == "xno" ]; then
+    echo "${IP_ADDRESS[0]}  ${MACHINE_NAME}.${DOMAIN} ${MACHINE_NAME}" >> /etc/hosts || exit 1
+fi
+chmod 644 /etc/hosts &&
+
+# Clock settings
+cat > /etc/sysconfig/clock << "EOF" &&
+UTC=1
+EOF
+
+# Keyboard settings
+cat > /etc/sysconfig/keyboard << "EOF" &&
+# Keyboard language: us, cf, fr, etc.
+KEYBOARD=us
+EOF
+
+# Replacing 'KEYBOARD=us' entry with appropriate keyboard layout specified by user in sysinfos
+if [ "x${KEYBOARD}" != "x" ]; then
+    sed -i s/KEYBOARD=us/KEYBOARD=${KEYBOARD}/ /etc/sysconfig/keyboard || exit 1
+fi
+
+# Copying boot scripts
+STAGE2_BOOTSCRIPTS="functions rc checkfs  dhcp halt ifdown ifup initlog keyboard modules mountfs \
+    mountkernfs mountnetfs network nfs portmap reboot sendsignals setclock sshd swap sysklogd udev udev_retry"
+mkdir -p /etc/rc.d/init.d &&
+for bootscript in ${STAGE2_BOOTSCRIPTS}; do
+    cp -a -f bootscripts/${bootscript} /etc/rc.d/init.d || exit 1
+done &&
+
+# Creating runlevels links
+
+for level in S 0 1 2 3 4 5 6; do
+    dir=/etc/rc.d/rc${level}.d
+    if [ -d ${dir} ]; then
+        # Removing old links
+        rm -f ${dir}/* || exit 1
+    else
+        # Creating basic directory structure
+        mkdir -v -p ${dir} || exit 1
+    fi
+done &&
+
+# rcS.d
+bootscript_add_rcS initlog     05 00 &&
+bootscript_add_rcS mountkernfs 10 00 &&
+bootscript_add_rcS modules     15 00 &&
+bootscript_add_rcS udev        20 00 &&
+bootscript_add_rcS swap        25 94 &&
+bootscript_add_rcS checkfs     30 00 &&
+bootscript_add_rcS mountfs     35 95 &&
+bootscript_add_rcS udev_retry  40 00 &&
+bootscript_add_rcS sysklogd    45 93 &&
+bootscript_add_rcS keyboard    50 00 &&
+bootscript_add_rcS setclock    55 92 &&
+
+# rc0.d
+bootscript_add_manual 0 sendsignals 95 00 &&
+bootscript_add_manual 0 halt        99 00 &&
+
+# rc3.d
+bootscript_add_rc3 network    05 80 &&
+bootscript_add_rc3 portmap    10 75 &&
+bootscript_add_rc3 nfs        15 74 &&
+bootscript_add_rc3 dhcp       20 73 &&
+bootscript_add_rc3 sshd       25 70 &&
+bootscript_add_rc3 mountnetfs 30 10 &&
+
+# rc6.d is almost identical to rc0.d
+bootscript_add_manual 6 sendsignals 95 00 &&
+bootscript_add_manual 6 reboot      99 00 &&
+
+chown -R root:root /etc/rc.d /etc/sysconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-bzip2 b/stage2/cis-bzip2
new file mode 100755 (executable)
index 0000000..96f9dbe
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -f Makefile-libbz2_so &&
+make clean &&
+make -j ${MAKEJOBS} &&
+make PREFIX=/usr install &&
+
+cp -fv bzip2-shared /bin/bzip2 &&
+cp -afv libbz2.so* /lib &&
+ln -sfv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so &&
+rm -fv /usr/bin/{bunzip2,bzcat,bzip2} &&
+ln -sfv bzip2 /bin/bunzip2 &&
+ln -sfv bzip2 /bin/bzcat
+
+# Return last error
+exit $?
diff --git a/stage2/cis-compressdoc b/stage2/cis-compressdoc
new file mode 100755 (executable)
index 0000000..0a77265
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CWD=$(pwd)
+
+install -m755 ${CWD}/misc/compressdoc /usr/sbin &&
+
+# Compressing man pages with bzip2
+/usr/sbin/compressdoc --bz2
+
+exit $?
diff --git a/stage2/cis-coreutils b/stage2/cis-coreutils
new file mode 100755 (executable)
index 0000000..941ee38
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# Move some programs to their proper FHS locations:
+mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin &&
+mv -v /usr/bin/{false,hostname,ln,ls,mkdir,mknod,mv,pwd,readlink,rm} /bin &&
+mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin &&
+mv -v /usr/bin/chroot /usr/sbin &&
+
+# Some of the scripts in the LFS-Bootscripts package depend on head
+# sleep and nice. As /usr may not be available during the early stages
+# of booting, those binaries need to be on the root partition:
+mv -v /usr/bin/{head,sleep,nice} /bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-db4 b/stage2/cis-db4
new file mode 100755 (executable)
index 0000000..c6e0f79
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}/build_unix &&
+../dist/configure \
+    --prefix=/usr \
+    --enable-compat185 \
+    --enable-cxx &&
+make &&
+make docdir=/usr/share/doc/${1} install &&
+chown -Rv root:root /usr/share/doc/${1}
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-dhcp b/stage2/cis-dhcp
new file mode 100755 (executable)
index 0000000..c6aa80c
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure &&
+make -j ${MAKEJOBS} &&
+make LIBDIR=/usr/lib INCDIR=/usr/include install &&
+
+# This is for the DHCP client
+cat > /etc/dhclient.conf << "EOF" &&
+# dhclient.conf
+
+timeout 15;
+
+interface "eth0"{
+  supersede domain-name "_DOMAIN_";
+  prepend domain-name-servers 127.0.0.1;
+  request subnet-mask, broadcast-address, time-offset, routers,
+          domain-name, domain-name-servers, host-name;
+  require subnet-mask, domain-name-servers;
+}
+EOF
+
+sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/dhclient.conf &&
+
+cat > /etc/sysconfig/network/dhcp-client << "EOF" &&
+# dhcp-client
+# DHCP client program informations
+#
+DHCP_PROG="/sbin/dhclient"
+DHCP_START="-q -1"
+DHCP_STOP="-q -r"
+EOF
+
+# Is it really necessary? If necessary, uncomment entries.
+cat > /etc/dhclient-exit-hooks << "EOF" &&
+#!/bin/sh
+
+# Load global network parameters
+. /etc/sysconfig/network/network-parameters
+
+#  Update /etc/hosts only if we have an ip address.
+if [ -n "${new_ip_address}" ]; then
+    echo "127.0.0.1    localhost.localdomain localhost" > /etc/hosts &&
+    echo "${new_ip_address} ${DEFAULT_HOSTNAME}" >> /etc/hosts
+    exit_status=0
+else
+    exit_status=1
+fi
+EOF
+chmod 740 /etc/dhclient-exit-hooks &&
+
+# The following commands will create a base configuration file for a DHCP server.
+cat > /etc/dhcpd.conf << EOF 
+# Configuration file for DHCP server.
+
+default-lease-time 72000;
+max-lease-time 144000;
+ddns-update-style ad-hoc;
+
+subnet 192.168.0.0 netmask 255.255.255.0 {
+  range 192.168.0.2 192.168.0.240;
+  option broadcast-address 192.168.0.255;
+  option routers 192.168.0.1;
+  option domain-name-servers 192.168.0.1;
+}
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-e2fsprogs b/stage2/cis-e2fsprogs
new file mode 100755 (executable)
index 0000000..1560056
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --with-root-prefix="" \
+    --enable-elf-shlibs &&
+make -j ${MAKEJOBS} &&
+make install &&
+make install-libs
+
+# Return last error
+exit $?
diff --git a/stage2/cis-ed b/stage2/cis-ed
new file mode 100755 (executable)
index 0000000..eb998fc
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make &&
+make install &&
+mv /usr/bin/{ed,red} /bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-emacs b/stage2/cis-emacs
new file mode 100755 (executable)
index 0000000..65d7516
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin &&
+make -j ${MAKEJOBS} bootstrap &&
+make install &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags &&
+
+cat > /etc/skel/.emacs << "EOF"
+;; ~/.emacs
+
+;; Emacs initialization file
+
+;; Are we running XEmacs or Emacs?
+(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
+
+;;; Emacs Load Path
+(setq load-path (cons "/usr/local/share/emacs/site-lisp" load-path))
+
+;; Do not display a splash screen on startup
+(setq inhibit-splash-screen t)
+
+;; Set up the keyboard so the delete key on both the regular keyboard
+;; and the keypad delete the character under the cursor and to the right
+;; under X, instead of the default, backspace behavior.
+(global-set-key [delete] 'delete-char)
+(global-set-key [kp-delete] 'delete-char)
+
+;; Pour avoir les accents
+(set-keyboard-coding-system 'iso-8859-1)
+
+;; Turn on font-lock mode for Emacs
+(cond ((not running-xemacs)
+       (global-font-lock-mode t)
+))
+
+;; Turn on font-lock mode for XEmacs
+(cond (running-xemacs
+       (require 'font-lock)
+))
+
+;; Always end a file with a newline
+(setq require-final-newline t)
+
+;; Stop at the end of the file, not just add lines
+(setq next-line-add-newlines nil)
+
+;; Replaces tabs in files with spaces
+(setq-default indent-tabs-mode nil)
+
+;; Enable wheelmouse support by default
+(mwheel-install)
+(setq mwheel-follow-mouse t)
+
+;; Makes the compilation buffer always scrolls to follow
+;; output as it comes in.
+(setq compilation-scroll-output t)
+
+;;===========================================================
+;; Key bindings for compiling programs
+;;===========================================================
+(defun compile-make-clean ()
+  (interactive)           ;; can be called from kbd
+  (compile "make clean"))
+;; Must add helper function for the make also, otherwise
+;; the first definition caused both F4 and F5 to execute "make clean".
+(defun compile-make ()
+  (interactive) 
+  (compile "make"))
+
+;; replace-string on F2
+(global-set-key [f2] 'replace-string)
+
+;; replace-string on F3
+(global-set-key [f3] 'query-replace)
+
+;; make clean on F4
+(global-set-key [f4] 'compile-make-clean)
+
+;; compile on F5
+(global-set-key [f5] 'compile-make)
+
+;; Goto next error on F6
+(global-set-key [f6] 'next-error)
+
+;; Indent code on F8
+(global-set-key [f8] 'indent-region)
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-findutils b/stage2/cis-findutils
new file mode 100755 (executable)
index 0000000..1fb8788
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+  --prefix=/usr \
+  --libexecdir=/usr/lib/findutils \
+  --localstatedir=/var/lib/locate &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# Some of the scripts in the LFS-Bootscripts package depend on find.
+# As /usr may not be available during the early stages of booting, this
+# program needs to be on the root partition. The updatedb script also
+# needs to be modified to correct an explicit path:
+mv -v /usr/bin/find /bin &&
+sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb
+
+# Return last error
+exit $?
diff --git a/stage2/cis-flex b/stage2/cis-flex
new file mode 100755 (executable)
index 0000000..449a627
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+ln -sfv libfl.a /usr/lib/libl.a &&
+
+# Create a bash script called lex that calls flex and have it emulate lex.
+cat > /usr/bin/lex << "EOF" &&
+#!/bin/sh
+# /usr/bin/lex
+
+exec /usr/bin/flex -l "$@"
+EOF
+chmod -v 755 /usr/bin/lex
+
+# Return last error
+exit ${last_error}
diff --git a/stage2/cis-gcc b/stage2/cis-gcc
new file mode 100755 (executable)
index 0000000..6812f7e
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# Applying a sed substitution that will suppress the installation of
+# libiberty.a. We want to use the Binutils version of libiberty.a
+cd ${LFS_TMP}/${1} &&
+sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
+
+# The bootstrap build performed in pass1 built GCC with the -fomit-frame-pointer
+# compiler flag. Non-bootstrap builds omit this flag by default, so the following sed
+# command is used in order to ensure consistent compiler builds.
+sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in &&
+
+# Suppressing the running of the fixincludes script. */
+sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in &&
+
+# GCC provides a gccbug script which detects at compile time whether
+# mktemp is present, and hardcodes the result in a test. This will
+# cause the script to fall back to using less random names for temporary
+# files. We will be installing mktemp later, so the following sed will
+# simulate its presence:
+sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/lib \
+    --enable-shared \
+    --enable-threads=posix \
+    --enable-__cxa_atexit \
+    --enable-clocale=gnu \
+    --enable-languages=c,c++ \
+    --disable-bootstrap &&
+make -j ${MAKEJOBS} &&
+make install &&
+ln -v -sf ../usr/bin/cpp /lib &&
+ln -v -sf gcc /usr/bin/cc &&
+
+# Performing compilation test...
+echo 'main(){}' > dummy.c &&
+cc dummy.c &&
+readelf -l a.out | grep ': /lib' 1> /dev/null 2>&1 &&
+rm dummy.c a.out &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage2/cis-glibc b/stage2/cis-glibc
new file mode 100755 (executable)
index 0000000..07e9ae6
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# In the vi_VN.TCVN locale, bash enters an infinite loop at startup.
+# It is unknown whether this is a bash bug or a Glibc problem.
+# Disable installation of this locale in order to avoid the problem:
+sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED &&
+
+# When running make install, a script called test-installation.pl
+# performs a small sanity test on our newly installed Glibc. However,
+# because our toolchain still points to the /tools directory, the
+# sanity test would be carried out against the wrong Glibc. We can
+# force the script to check the Glibc we have just installed with:
+sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
+    scripts/test-installation.pl &&
+
+# The ldd shell script contains Bash-specific syntax. Change its
+# default program interpreter to /bin/bash in case another /bin/sh
+# is installed as described in the Shells chapter of the BLFS book:
+sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in &&
+
+# Configure options:
+# --disable-profile
+#     Builds the libraries without profiling information.
+# --enable-add-ons
+#     Use all the add-ons it finds.
+#     crypt and localdata are now part of glibc.
+# --enable-kernel=2.x.x
+#     Compile the library for support of linux 2.6.x kernels.
+#     The kernel version specified must not be newer than the
+#     version of the kernel running on the build machine.
+# --without-gd
+#     Prevents the build of the memusagestat program, which
+#     strangely enough insists on linking against the host's
+#     libraries (libgd, libpng, libz, and so forth).
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --disable-profile \
+    --enable-add-ons \
+    --enable-kernel=${GLIBC_KERNEL_VERSION} \
+    --libexecdir=/usr/lib/glibc &&
+make -j ${MAKEJOBS} &&
+mkdir -p /tools/etc &&
+touch /tools/etc/ld.so.conf &&
+make install
+
+# The following instructions, instead of the install-locales target
+# above, will install the minimum set of locales necessary for the
+# tests to run successfully:
+mkdir -v -p /usr/lib/locale &&
+localedef -i de_DE -f ISO-8859-1 de_DE &&
+localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro &&
+localedef -i en_HK -f ISO-8859-1 en_HK &&
+localedef -i en_PH -f ISO-8859-1 en_PH &&
+localedef -i en_US -f ISO-8859-1 en_US &&
+localedef -i en_US -f UTF-8 en_US.UTF-8 &&
+localedef -i es_MX -f ISO-8859-1 es_MX &&
+localedef -i fa_IR -f UTF-8 fa_IR &&
+localedef -i fr_CA -f UTF-8 fr_CA.UTF-8 &&
+localedef -i fr_CA -f ISO-8859-1 fr_CA &&
+localedef -i ca_FR -f UTF-8 ca_FR.UTF-8 &&
+localedef -i ca_FR -f ISO-8859-1 ca_FR &&
+localedef -i fr_FR -f ISO-8859-1 fr_FR &&
+localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro &&
+localedef -i fr_FR -f UTF-8 fr_FR.UTF-8 &&
+localedef -i it_IT -f ISO-8859-1 it_IT &&
+localedef -i ja_JP -f EUC-JP ja_JP &&
+
+cat > /etc/nsswitch.conf << "EOF" &&
+# /etc/nsswitch.conf
+
+passwd: files
+group: files
+shadow: files
+
+hosts: files dns
+networks: files
+
+protocols: files
+services: files
+ethers: files
+rpc: files
+
+EOF
+
+ln -sf ${TIMEZONE} /usr/share/zoneinfo/localtime &&
+cp --remove-destination /usr/share/zoneinfo/${TIMEZONE} /etc/localtime &&
+
+cat > /etc/ld.so.conf << "EOF"
+# /etc/ld.so.conf
+/usr/local/lib
+/opt/lib
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-groff b/stage2/cis-groff
new file mode 100755 (executable)
index 0000000..202430e
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# Many screen fonts don't have Unicode single quotes and dashes in
+# them. Tell Groff to use the ASCII equivalents instead:
+sed -i -e 's/2010/002D/' -e 's/2212/002D/' \
+    -e 's/2018/0060/' -e 's/2019/0027/' font/devutf8/R.proto &&
+
+PAGE=letter ./configure \
+    --prefix=/usr \
+    --enable-multibyte &&
+# Groff does not like to be made in parallel.
+make &&
+make install &&
+
+# Some documentation programs, such as xman, will not work properly without
+# the following symlinks:
+ln -fsv eqn /usr/bin/geqn &&
+ln -fsv tbl /usr/bin/gtbl
+
+# Return last error
+exit $?
diff --git a/stage2/cis-grub b/stage2/cis-grub
new file mode 100755 (executable)
index 0000000..02b2bfb
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+GRUB_STAGE_FILES="/usr/lib/grub/i386-pc"
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+mkdir -p /boot/grub &&
+cp -a ${GRUB_STAGE_FILES}/stage{1,2} /boot/grub &&
+cp -a ${GRUB_STAGE_FILES}/{e2fs,reiserfs}_stage1_5 /boot/grub
+
+# Return last error
+exit $?
diff --git a/stage2/cis-gzip b/stage2/cis-gzip
new file mode 100755 (executable)
index 0000000..c2433bc
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --bindir=/bin &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+mv -fv /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin &&
+mv -fv /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-hv-utilities b/stage2/cis-hv-utilities
new file mode 100755 (executable)
index 0000000..a721fa6
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+SRCDIR="./hv-utilities"
+PREFIX="/usr/local"
+BINDIR="${PREFIX}/bin"
+SYSBINDIR="${PREFIX}/sbin"
+BIN_UTILITIES="camera-download cd-erase cd-copy pstopdf distro-backup dos2unix \
+               dvd-ram-format fix-avi gztobz2 hv-backup hv-video-dvd mail-files \
+               mail-if-fail mail-statistics media-write pstopdf replace.pl \
+               rotatelogs setdate strip-debug-symbols tildes-clean"
+
+for program in ${BIN_UTILITIES}; do
+    install -v ${SRCDIR}/${program} ${BINDIR} || exit 1
+done
+
+# Return last error
+exit $?
diff --git a/stage2/cis-iana b/stage2/cis-iana
new file mode 100755 (executable)
index 0000000..2f6c42b
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# iana-etc installs /etc/services and /etc/protocols using data from the
+# Internet Assigned Numbers Authority.
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-inetutils b/stage2/cis-inetutils
new file mode 100755 (executable)
index 0000000..0ae48ef
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# This is only a basic installation (no servers) of inetutils.
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --disable-logger \
+    --disable-syslogd \
+    --disable-whois \
+    --disable-servers &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+mv -fv /usr/bin/ping /bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-iproute2 b/stage2/cis-iproute2
new file mode 100755 (executable)
index 0000000..4f54d75
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# The installation of two manual pages is broken and results in
+# dangling symlinks. Fix this with the following command:
+sed -i -e '/tc-bfifo.8/d' -e '/tc-pfifo.8/s/pbfifo/bfifo/' Makefile &&
+
+make SBINDIR=/sbin -j ${MAKEJOBS} &&
+make SBINDIR=/sbin install &&
+
+# The arpd binary links against the Berkeley DB libraries that reside
+# in /usr and uses a database in /var/lib/arpd/arpd.db. Thus,
+# according to the FHS, it must be in /usr/sbin. Move it there:
+mv -v /sbin/arpd /usr/sbin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-kbd b/stage2/cis-kbd
new file mode 100755 (executable)
index 0000000..2b752b8
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# --datadir=/lib/kbd 
+#     This option puts keyboard layout data in a directory that will
+#     always be on the root partition instead of the default /usr/share/kbd
+./configure \
+    --datadir=/lib/kbd &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# Some of the scripts in the LFS-Bootscripts package depend on kbd_mode,
+# openvt, and setfont. As /usr may not be available during the early stages
+# of booting, those binaries need to be on the root partition:
+mv -v /usr/bin/{kbd_mode,openvt,setfont} /bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-kernel b/stage2/cis-kernel
new file mode 100755 (executable)
index 0000000..a435e06
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# The ARCH variable must be exported for this script
+# to work correctly for architectures other than PC.
+#   eg. export ARCH=powerpc
+
+# We don't compile anything, we only install headers
+#unset CROSS_COMPILE &&
+
+SYSROOT=${SYSROOT:-""}
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Move files to their final destination 
+mkdir -pv ${SYSROOT}/usr/src &&
+mv ${LFS_TMP}/${1} ${SYSROOT}/usr/src &&
+
+# Remove any previous link. Otherwise, the
+# new link would be created inside kernel directory.
+cd ${SYSROOT}/usr/src &&
+rm -fv linux &&
+ln -sfv ${1} linux &&
+
+# First step, install kernel API headers:
+cd ${SYSROOT}/usr/src/${1} &&
+make -j ${MAKEJOBS} mrproper &&
+make -j ${MAKEJOBS} headers_check &&
+make -j ${MAKEJOBS} INSTALL_HDR_PATH=dest headers_install &&
+mkdir -pv ${SYSROOT}/usr/include &&
+cp -rv dest/include/* ${SYSROOT}/usr/include &&
+
+# Second, install HV kernel compilation script:
+cd ${SYSROOT}/usr/src &&
+
+VERSION=$(get_pkg_ver ${1}) &&
+
+echo "#!/bin/sh" > compile-kernel &&
+echo "KERNEL_VERSION=${VERSION}" >> compile-kernel &&
+echo "DEST=/boot" >> compile-kernel &&
+cat >> compile-kernel << "EOF" &&
+
+make bzImage &&
+make modules &&
+make modules_install &&
+
+cp arch/x86/boot/bzImage ${DEST}/vmlinuz-${KERNEL_VERSION} &&
+cp System.map            ${DEST}/System-${KERNEL_VERSION}.map &&
+cp .config               ${DEST}/config-${KERNEL_VERSION}
+
+if [ $? -ne 0 ]; then
+    echo "*** Kernel compilation error ***."
+    exit 1
+fi
+
+exit 0
+EOF
+
+chmod -v u+x compile-kernel
+
+# Return last error
+exit $?
diff --git a/stage2/cis-man b/stage2/cis-man
new file mode 100755 (executable)
index 0000000..16aef84
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# SED substitution to add the -R switch to the PAGER variable so that escape
+# sequences are properly handled by Less.
+sed -i 's@-is@&R@g' configure &&
+
+# SED substitution to comment out the MANPATH /usr/man line in the man.conf
+# file to prevent redundant results when using programs such as whatis.
+sed -i 's@MANPATH./usr/man@#&@g' src/man.conf.in &&
+
+./configure -confdir=/etc &&
+make -j ${MAKEJOBS} &&
+make install 
+
+# Return last error
+exit $?
diff --git a/stage2/cis-man-pages b/stage2/cis-man-pages
new file mode 100755 (executable)
index 0000000..f6637fa
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-module-init-tools b/stage2/cis-module-init-tools
new file mode 100755 (executable)
index 0000000..d6ebb52
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# --enable-zlib: To handle compressed kernel modules.
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/ \
+    --enable-zlib &&
+make -j ${MAKEJOBS} &&
+make INSTALL=install install &&
+
+cat > /etc/modprobe.conf << "EOF"
+# modprobe.conf
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-ncurses b/stage2/cis-ncurses
new file mode 100755 (executable)
index 0000000..3b7e884
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --with-shared \
+    --without-debug \
+    --enable-widec &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# Fix a library that shouldn't be executable.
+chmod -v 644 /usr/lib/libncurses++w.a &&
+
+# To be FHS compliant...
+mv -fv /usr/lib/libncursesw.so.5* /lib &&
+
+# Fixing some symlinks after the move
+ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so &&
+
+# Many applications still expect the linker to be able to find
+# non-wide-character Ncurses libraries. Trick such applications
+# into linking with wide-character libraries by means of symlinks
+# and linker scripts:
+for lib in curses ncurses form panel menu ; do
+    rm -vf /usr/lib/lib${lib}.so
+    echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so
+    ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a
+done
+ln -sfv libncurses++w.a /usr/lib/libncurses++.a &&
+
+# Finally, make sure that old applications that look for
+# -lcurses at build time are still buildable:
+rm -vf /usr/lib/libcursesw.so &&
+echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so &&
+ln -sfv libncurses.so /usr/lib/libcurses.so &&
+ln -sfv libncursesw.a /usr/lib/libcursesw.a &&
+ln -sfv libncurses.a /usr/lib/libcurses.a
+
+# Return last error
+exit $?
diff --git a/stage2/cis-net-tools b/stage2/cis-net-tools
new file mode 100755 (executable)
index 0000000..e146b94
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+yes "" | make config &&
+sed -i -e 's|HAVE_IP_TOOLS 0|HAVE_IP_TOOLS 1|g' \
+    -e 's|HAVE_MII 0|HAVE_MII 1|g' config.h &&
+sed -i -e 's|# HAVE_IP_TOOLS=0|HAVE_IP_TOOLS=1|g' \
+    -e 's|# HAVE_MII=0|HAVE_MII=1|g' config.make &&
+make -j ${MAKEJOBS} &&
+make update
+
+# Return last error
+exit $?
diff --git a/stage2/cis-nfs-utils b/stage2/cis-nfs-utils
new file mode 100755 (executable)
index 0000000..d16a283
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# This package needs the user 'nobody'
+hv_useradd -c nobody -d /home -g nogroup -s /bin/bash -u 99 nobody &&
+
+# Problem with build directory
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --disable-nfsv4 \
+    --disable-gss &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+cat > /etc/exports << "EOF"
+# NFS file systems export list
+#
+# An entry in /etc/exports will typically look like this: 
+#    directory machine1(option11,option12) machine2(option21,option22)
+
+#/root                 192.168.0.0/24(rw,sync,no_root_squash)
+#/srv/www/htdocs       192.168.0.0/24(rw,sync)
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-openssh b/stage2/cis-openssh
new file mode 100755 (executable)
index 0000000..148ca8d
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+install -v -m700 -d /var/lib/sshd &&
+chown -v root:sys /var/lib/sshd &&
+
+hv_groupadd sshd &&
+hv_useradd -c sshd-privsep -d /var/lib/sshd -g sshd -s /bin/false sshd &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc/ssh \
+    --libexecdir=/usr/lib/openssh \
+    --with-md5-passwords \
+    --with-privsep-path=/var/lib/sshd &&
+make -j ${MAKEJOBS} &&
+make -j ${MAKEJOBS} install &&
+
+cd ${LFS_TMP}/${1} &&
+install -v -m755 -d /usr/share/doc/${1} &&
+install -v -m644 INSTALL LICENCE OVERVIEW README* WARNING.RNG \
+    /usr/share/doc/${1} &&
+
+# Disabling root logins
+sed -i -e "s!^#PermitRootLogin.*!PermitRootLogin no!g" /etc/ssh/sshd_config &&
+
+# Enabling X11 forwarding
+sed -i -e "s!^#X11Forwarding.*!X11Forwarding yes!g" /etc/ssh/sshd_config &&
+
+# Setting MaxAuthTries to 1
+sed -i -e "s!^#MaxAuthTries.*!MaxAuthTries 1!g" /etc/ssh/sshd_config
+
+# Return last error
+exit $?
diff --git a/stage2/cis-openssl b/stage2/cis-openssl
new file mode 100755 (executable)
index 0000000..838653d
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./config \
+    --openssldir=/etc/ssl \
+    --prefix=/usr shared &&
+# Install the man pages in /usr/share/man instead of the default
+# which is /etc/ssl/man
+make -j ${MAKEJOBS} MANDIR=/usr/share/man &&
+make -j ${MAKEJOBS} MANDIR=/usr/share/man install &&
+cp -v -r certs /etc/ssl
+
+# Return last error
+exit $?
diff --git a/stage2/cis-pam b/stage2/cis-pam
new file mode 100755 (executable)
index 0000000..af7d2b8
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --libdir=/lib \
+    --sbindir=/lib/security \
+    --enable-securedir=/lib/security \
+    --docdir=/usr/share/doc/${1} \
+    --enable-read-both-confs &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+chmod -v 4755 /lib/security/unix_chkpwd &&
+mv -v /lib/security/pam_tally /sbin &&
+mv -v /lib/libpam{,c,_misc}.la /usr/lib &&
+sed -i 's| /lib| /usr/lib|' /usr/lib/libpam_misc.la &&
+
+if [ -L /lib/libpam.so ]; then
+   for LINK in libpam{,c,_misc}.so; do
+       ln -v -sf ../../lib/$(readlink /lib/${LINK}) /usr/lib/${LINK} &&
+       rm -v /lib/${LINK}
+   done
+fi &&
+
+mkdir -p /etc/pam.d &&
+cat > /etc/pam.d/other << EOF &&
+# /etc/pam.d/other
+
+auth            required        pam_unix.so     nullok
+account         required        pam_unix.so
+session         required        pam_unix.so
+password        required        pam_unix.so     nullok
+EOF
+
+cat > /etc/pam.conf << EOF
+# /etc/pam.conf
+
+other           auth            required        pam_unix.so     nullok
+other           account         required        pam_unix.so
+other           session         required        pam_unix.so
+other           password        required        pam_unix.so     nullok
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-pciutils b/stage2/cis-pciutils
new file mode 100755 (executable)
index 0000000..ef44abf
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd /${LFS_TMP}/${1} &&
+
+# This command suppresses some unneeded screen output from the update-pciids
+# command if you don't have either Lynx or Wget installed by redirecting the
+# stderr output of the embedded which command to /dev/null.
+sed -i 's/null ;/null 2>\&1 ;/' update-pciids.sh &&
+
+make PREFIX=/usr &&
+make PREFIX=/usr install &&
+
+# Some packages require the PCI static library.
+install -v -m 755 -d /usr/include/pci &&
+install -v -m 644 lib/libpci.a /usr/lib &&
+install -v -m 644 lib/*.h /usr/include/pci
+
+# Return last error
+exit $?
diff --git a/stage2/cis-perl b/stage2/cis-perl
new file mode 100755 (executable)
index 0000000..4f3cad7
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# First create a basic /etc/hosts file to be referenced in one
+# of Perl's configuration files as well as the optional testsuite:
+echo "127.0.0.1 localhost $(hostname)" > /etc/hosts &&
+
+cd ${LFS_TMP}/${1} &&
+./configure.gnu \
+    --prefix=/usr \
+    -Dman1dir=/usr/share/man/man1 \
+    -Dman3dir=/usr/share/man/man3 \
+    -Dpager="/usr/bin/less -isR" &&
+# Perl does not like to be made in parallel?
+make &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-pkg-config b/stage2/cis-pkg-config
new file mode 100755 (executable)
index 0000000..bea596d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+var_add_path "PKG_CONFIG_PATH" /etc/profile "/usr/local/lib/pkgconfig" &&
+var_export   "PKG_CONFIG_PATH" /etc/profile
+
+# Return last error
+exit $?
diff --git a/stage2/cis-popt b/stage2/cis-popt
new file mode 100755 (executable)
index 0000000..ac238d5
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+# fix taken backported from the development version of popt fixes
+# a problem identified by the included testsuite:
+sed -i -e "/*origOptString ==/c 0)" popt.c &&
+
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make -j ${MAKEJOBS} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-portmap b/stage2/cis-portmap
new file mode 100755 (executable)
index 0000000..7728375
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-post-install b/stage2/cis-post-install
new file mode 100755 (executable)
index 0000000..39f59c2
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+cat > /etc/default/useradd << "EOF" &&
+# useradd defaults file
+HOME=/home
+INACTIVE=-1
+EXPIRE=
+SHELL=/bin/bash
+SKEL=/etc/skel
+CREATE_MAIL_SPOOL=yes
+EOF
+
+chmod -v 644 /etc/default/useradd &&
+
+if [ -n "${REGUSER}" ]; then
+    hv_useradd -g users -G audio,video,usb -s /bin/bash -m ${REGUSER} || exit 1
+fi &&
+
+echo "Copying /etc/skel files to root directory" &&
+# Copy skel files to root directory. First create a copy to change owner
+cp -au /etc/skel/.??* /root &&
+
+# Fixing ownership of directories /tmp and /var/log (may have been created by
+# a regular user when fetching packages).
+chown -v root:root /tmp &&
+chown -v root:root /var &&
+chown -v root:root /var/log
+
+exit $?
diff --git a/stage2/cis-procps b/stage2/cis-procps
new file mode 100755 (executable)
index 0000000..7728375
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-psmisc b/stage2/cis-psmisc
new file mode 100755 (executable)
index 0000000..acfde61
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# By default, Psmisc's pidof program is not installed. This usually is
+# not a problem because it is installed later in the Sysvinit package,
+# which provides a better pidof program.
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --exec-prefix="" &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# There is no reason for the pstree and pstree.x11 programs to reside
+# in /bin. Therefore, move them to /usr/bin:
+mv -v /bin/pstree* /usr/bin
+
+# Return last error
+exit $?
diff --git a/stage2/cis-readline b/stage2/cis-readline
new file mode 100755 (executable)
index 0000000..13273f6
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# Reinstalling Readline will cause the old libraries to be moved to
+# <libraryname>.old. While this is normally not a problem, in some
+# cases it can trigger a linking bug in ldconfig. This can be
+# avoided by issuing the following two seds:
+sed -i '/MV.*old/d' Makefile.in &&
+sed -i '/{OLDSUFF}/c:' support/shlib-install &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libdir=/lib &&
+# SHLIB_LIBS=-lncurses: Forces Readline to link against the libncurses library.
+make SHLIB_LIBS=-lncurses &&
+make install &&
+# Now move the static libraries to a more appropriate location:
+mv -v /lib/lib{readline,history}.a /usr/lib &&
+
+# Next, remove the .so files in /lib and relink them into /usr/lib:
+rm -v /lib/lib{readline,history}.so &&
+ln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.so &&
+ln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so
+
+# Return last error
+exit $?
diff --git a/stage2/cis-reiserfsprogs b/stage2/cis-reiserfsprogs
new file mode 100755 (executable)
index 0000000..464d060
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sbindir=/sbin &&
+# Doesn't seem to use CFLAGS...
+make -j ${MAKEJOBS} &&
+make install &&
+ln -sf reiserfsck /sbin/fsck.reiserfs &&
+ln -sf mkreiserfs /sbin/mkfs.reiserfs
+
+# Return last error
+exit $?
diff --git a/stage2/cis-shadow b/stage2/cis-shadow
new file mode 100755 (executable)
index 0000000..9690701
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --libdir=/lib \
+    --sysconfdir=/etc \
+    --enable-shared \
+    --without-selinux &&
+# Disable the installation of the groups program and its man page, as
+# Coreutils provides a better version.
+sed -i 's/groups$(EXEEXT) //' src/Makefile &&
+find man -name Makefile -exec sed -i '/groups/d' {} \; &&
+make -j ${MAKEJOBS} &&
+make install &&
+cp -f ../${1}/etc/{limits,login.access} /etc &&
+
+# Instead of using the default crypt method, we want to use the more secure
+# MD5 method of password encryption, which also allows passwords longer than
+# 8 characters. We also need to change the obsolete /var/spool/mail location
+# for user mailboxes that Shadow uses by default to the /var/mail location
+# used currently. We accomplish both these things by changing the relevant
+# configuration file while copying it to its destination.
+sed -e's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \
+    -e 's@/var/spool/mail@/var/mail@' \
+    ../${1}/etc/login.defs > /etc/login.defs
+
+var_add_shadow "ENV_SUPATH" /etc/login.defs "/usr/local/sbin:/usr/local/bin" &&
+
+# Move some misplaced symlinks/programs to their proper locations.
+mv /usr/bin/passwd /bin &&
+
+# Move Shadow's libraries to more appropriate locations.
+mv /lib/libshadow.*a /usr/lib &&
+rm /lib/libshadow.so &&
+ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so &&
+
+# The -D option of the useradd program requires this directory for it
+# to work properly.
+mkdir -p /etc/default &&
+
+# To enable shadowed passwords:
+pwconv &&
+
+# To enable shadowed group passwords:
+grpconv
+
+# Return last error
+exit $?
diff --git a/stage2/cis-stripping b/stage2/cis-stripping
new file mode 100755 (executable)
index 0000000..bd6ba2c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
+    -exec /tools/bin/strip --strip-debug '{}' ';'
+
+# Return success
+exit 0
diff --git a/stage2/cis-sudo b/stage2/cis-sudo
new file mode 100755 (executable)
index 0000000..46a3dc1
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+cat > /etc/sudoers << EOF &&
+# User alias specification
+User_Alias  ADMIN = _REGUSER_
+
+# Allow people in group ADMIN to run all commands without a password
+ADMIN       ALL = NOPASSWD: ALL
+EOF
+
+sed -i -e "s!_REGUSER_!${REGUSER}!g" /etc/sudoers &&
+chmod 600 /etc/sudoers
+
+# Return last error
+exit $?
diff --git a/stage2/cis-sysklogd b/stage2/cis-sysklogd
new file mode 100755 (executable)
index 0000000..80c8fa1
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+cat > /etc/syslog.conf << "EOF"
+# /etc/syslog.conf
+
+auth,authpriv.* -/var/log/auth.log
+*.*;auth,authpriv.none -/var/log/sys.log
+daemon.* -/var/log/daemon.log
+kern.* -/var/log/kern.log
+mail.* -/var/log/mail.log
+user.* -/var/log/user.log
+cron.* -/var/log/cron.log
+*.emerg *
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-sysvinit b/stage2/cis-sysvinit
new file mode 100755 (executable)
index 0000000..25e9b19
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i 's@Sending processes@& started by init@g' src/init.c &&
+make -j ${MAKEJOBS} -C src &&
+make -C src install &&
+
+# Configuring Sysvinit
+cat > /etc/inittab << "EOF"
+# /etc/inittab
+#
+# SysVinit
+
+# Each non-comment line is a data record entry with the following format:
+# <id>:<runlevels>:<action>:<process>
+#
+# id:        Unique sequence of 1-4 characters identifying an entry in inittab
+# runlevels: lists the runlevels for which the specified action should be taken
+# action:    describes which action should be taken
+# process:   specifies the process to be executed
+
+# Default runlevel
+id:3:initdefault: 
+
+# System initialization before anything else (runs when system boots).
+si::sysinit:/etc/rc.d/init.d/rc S
+
+# System halting
+l0:0:wait:/etc/rc.d/init.d/rc 0
+
+# Single-user mode
+l1:1:wait:/etc/rc.d/init.d/rc 1
+
+# Not used  
+l2:2:wait:/etc/rc.d/init.d/rc 2
+
+# Full multi-user mode
+l3:3:wait:/etc/rc.d/init.d/rc 3
+
+# Not used
+l4:4:wait:/etc/rc.d/init.d/rc 4
+
+# Full multi-user mode (X-windows)
+l5:5:wait:/etc/rc.d/init.d/rc 5
+
+# System reboot
+l6:6:wait:/etc/rc.d/init.d/rc 6
+
+# Trap CTRL-ALT-DELETE
+ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
+
+su:S016:once:/sbin/sulogin
+
+# getty-programs for the normal runlevels
+# 'getty' opens a tty port, prompts for a login name and invokes the
+# /bin/login command.
+# The <id> field MUST be the same as the last
+# characters of the device (after "tty").
+1:12345:respawn:/sbin/agetty 38400 tty1
+2:2345:respawn:/sbin/agetty 38400 tty2
+3:2345:respawn:/sbin/agetty 38400 tty3
+4:2345:respawn:/sbin/agetty 38400 tty4
+5:2345:respawn:/sbin/agetty 38400 tty5
+6:2345:respawn:/sbin/agetty 38400 tty6
+
+# Run xdm or kdm in runlevel 5
+# kdm or xdm is now a separate service
+x:5:respawn:/usr/X11R6/bin/xdm -nodaemon
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-tcp-wrappers b/stage2/cis-tcp-wrappers
new file mode 100755 (executable)
index 0000000..92078fb
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -j ${MAKEJOBS} REAL_DAEMON_DIR=/usr/sbin STYLE=-DPROCESS_OPTIONS linux &&
+make install &&
+
+# Creating /etc/hosts.allow
+cat > /etc/hosts.allow << "EOF" &&
+ALL : LOCAL 192.168.0.0/255.255.255.0 : RFC931
+EOF
+
+# Creating /etc/hosts.deny
+cat > /etc/hosts.deny << "EOF"
+ALL: ALL: RFC931
+EOF
+
+# Return last error
+exit $?
diff --git a/stage2/cis-texinfo b/stage2/cis-texinfo
new file mode 100755 (executable)
index 0000000..08601bd
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+make TEXMF=/usr/share/texmf install-tex
+
+# Return last error
+exit $?
diff --git a/stage2/cis-toolchain-adjust b/stage2/cis-toolchain-adjust
new file mode 100755 (executable)
index 0000000..dece896
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# First, backup the /tools linker, and replace it with the adjusted linker
+# we made in chapter 5. We'll also create a link to its counterpart in
+# /tools/$(gcc -dumpmachine)/bin.
+mv -v /tools/bin/{ld,ld-old} &&
+mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} &&
+mv -v /tools/bin/{ld-new,ld} &&
+ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld &&
+
+# Amend the GCC specs file so that it points to the new dynamic linker, and so
+# that GCC knows where to find its start files.
+gcc -dumpspecs | sed \
+    -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \
+    -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
+    -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
+    `dirname $(gcc --print-libgcc-file-name)`/specs &&
+
+# Testing toolchain
+cd /tmp &&
+echo 'main(){}' > dummy.c &&
+cc dummy.c -Wl,--verbose &> dummy.log &&
+if [ ! readelf -l a.out | grep 'Requesting program interpreter: /lib/' \
+    1> /dev/null 2>&1 ]; then
+    exit 1
+fi &&
+
+if [ ! grep "attempt to open /usr/lib/crt.* succeeded" dummy.log 1> /dev/null 2>&1 ]; then
+    exit 1
+fi &&
+
+if [ ! grep "attempt to open /lib/libc.so.6 succeeded" dummy.log 1> /dev/null 2>&1 ]; then
+    exit 1
+fi &&
+
+if [ ! grep "found ld-linux.so.2 at /lib/ld-linux.so.2" dummy.log 1> /dev/null 2>&1 ]; then
+    exit 1
+fi &&
+
+rm dummy.c a.out
+
+# Return last error
+exit $?
diff --git a/stage2/cis-udev b/stage2/cis-udev
new file mode 100755 (executable)
index 0000000..2104875
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+install -dv /lib/{firmware,udev/devices/{pts,shm}} &&
+
+if [ ! -c /lib/udev/devices/null ]; then
+    mknod -m0666 /lib/udev/devices/null c 1 3 || exit 1
+fi &&
+
+if [ ! -h /lib/udev/devices/fd ]; then
+    ln -sfv /proc/self/fd /lib/udev/devices/fd || exit 1
+fi &&
+
+if [ ! -h /lib/udev/devices/stdin ]; then
+    ln -sfv /proc/self/fd/0 /lib/udev/devices/stdin || exit 1
+fi &&
+
+if [ ! -h /lib/udev/devices/stdout ]; then
+    ln -sfv /proc/self/fd/1 /lib/udev/devices/stdout || exit 1
+fi &&
+
+if [ ! -h /lib/udev/devices/stderr ]; then
+    ln -sfv /proc/self/fd/2 /lib/udev/devices/stderr || exit 1
+fi &&
+
+if [ ! -h /lib/udev/devices/core ]; then
+    ln -sfv /proc/kcore /lib/udev/devices/core || exit 1
+fi &&
+
+make EXTRAS="`echo extras/*/`" &&
+make DESTDIR=/ EXTRAS="`echo extras/*/`" install &&
+
+# First install the commonly-used rules files provided by Udev:
+cp -v etc/udev/rules.d/[0-9]* /etc/udev/rules.d/ &&
+
+# Install the documentation that explains how to create custom Udev rules:
+#install -m644 -v docs/writing_udev_rules/index.html \
+#    /usr/share/doc/${1}/index.html &&
+
+cat > /etc/sysconfig/modules << "EOF" &&
+# Add modules that must be manually loaded in this file,
+# one per line.
+
+EOF
+
+chmod -v 644 /etc/sysconfig/modules &&
+
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage2/cis-udev-config b/stage2/cis-udev-config
new file mode 100755 (executable)
index 0000000..eabeee9
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make install &&
+
+# Install the documentation that explains the LFS-specific rules files:
+make install-doc &&
+
+# Install the documentation that explains the commonly-used rules files provided by Udev:
+make install-extra-doc
+
+# Return last error
+exit $?
diff --git a/stage2/cis-util-linux b/stage2/cis-util-linux
new file mode 100755 (executable)
index 0000000..a7b0b38
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# The FHS recommends that we use /var/lib/hwclock, instead of the usual
+# /etc, as the location for the adjtime file. To make the hwclock program
+# FHS-compliant, run the following:
+sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' -i $(grep -rl '/etc/adjtime' .) &&
+mkdir -pv /var/lib/hwclock &&
+
+./configure &&
+# HAVE_KILL=yes: This prevents the kill program (already installed by
+#                Procps) from being built and installed again.
+# HAVE_SLN=yes:  This prevents the sln program (a statically linked
+#                ln already installed by Glibc) from being built and
+#                installed again.
+make -j ${MAKEJOBS} HAVE_KILL=yes HAVE_SLN=yes &&
+make HAVE_KILL=yes HAVE_SLN=yes install
+
+# Return last error
+exit $?
diff --git a/stage2/cis-zlib b/stage2/cis-zlib
new file mode 100755 (executable)
index 0000000..a858ffc
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+ZLIB_VERSION=$(get_pkg_ver ${1})
+
+# Zlib is known to build its shared library incorrectly if CFLAGS is
+# specified in the environment. We need to add the -fPIC directive to CFLAGS
+# for the duration of the below configure command, then remove it afterwards. 
+export CFLAGS="${CFLAGS} -fPIC"
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --shared \
+    --libdir=/lib &&
+make -j ${MAKEJOBS} &&
+
+# Installing the shared library
+make install &&
+
+# The previous command installed a .so file in /lib. We will remove
+# it and relink it into /usr/lib:
+rm -v /lib/libz.so &&
+ln -sfv ../../lib/libz.so.${ZLIB_VERSION} /usr/lib/libz.so &&
+
+# Now also build the non-shared (static) library: 
+make clean &&
+./configure \
+    --prefix=/usr &&
+make -j ${MAKEJOBS} &&
+make install &&
+
+# Fix the permissions on the static library: 
+chmod 644 /usr/lib/libz.a
+
+# Return last error
+exit $?
diff --git a/stage2/create-config-files b/stage2/create-config-files
new file mode 100755 (executable)
index 0000000..f0ca40a
--- /dev/null
@@ -0,0 +1,235 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CWD=$(pwd)
+
+echo "Creating /etc/fstab" &&
+cat > /etc/fstab << "EOF"
+# Device       Mount point     FS-type   Options             Dump  Fsck-order
+# ----------------------------------------------------------------------------
+EOF
+evaluate_retval
+if [ -n "${BOOT_PARTITION}" ]; then
+    echo "${BOOT_PARTITION} /boot ext2 defaults 1 1" >> /etc/fstab || exit 1
+fi
+if [ -n "${SWAP_PARTITION}" ]; then
+    echo "${SWAP_PARTITION} none swap sw 0 0" >> /etc/fstab || exit 1
+fi
+echo "${LFS_PARTITION}  /                 reiserfs defaults,noatime 0 0" >> /etc/fstab &&
+echo "/dev/cdrom        /media/cdrom      auto     ro,noauto,users  0 0" >> /etc/fstab &&
+echo "/dev/dvd          /media/dvd        auto     ro,noauto,users  0 0" >> /etc/fstab &&
+echo "proc              /proc             proc     defaults         0 0" >> /etc/fstab &&
+echo "sysfs             /sys              sysfs    defaults         0 0" >> /etc/fstab &&
+echo "devpts            /dev/pts          devpts   gid=4,mode=620   0 0" >> /etc/fstab &&
+echo "shm               /dev/shm          tmpfs    defaults         0 0" >> /etc/fstab &&
+echo "none              /proc/bus/usb     usbfs    defaults,devmode=0666 0 0" >> /etc/fstab &&
+
+echo "Creating /etc/profile" &&
+cat > /etc/profile << "EOF" &&
+#!/bin/sh
+# /etc/profile
+
+# System wide environment and startup programs
+# Functions and aliases go in /etc/bashrc
+# This is the first file read by bash during the logon process.
+
+export USER=`id -un`
+export LOGNAME=$USER
+export MAIL="/var/mail/$USER"
+export HISTFILESIZE=1000
+export HISTSIZE=1000
+export HOSTNAME=`/bin/hostname`
+export EDITOR=_DEFAULT_EDITOR_
+export CFLAGS="-pipe -O2"
+export CXXFLAGS=${CFLAGS}
+
+# Set default permissions when creating new files.
+if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then
+    # Normal user
+    umask 002
+else
+    # Root
+    umask 022
+fi
+
+if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
+    export INPUTRC=/etc/inputrc
+fi
+
+# This disables generation of 'core' files when an application exit abnormally
+ulimit -c 0
+
+PATH="/bin:/usr/bin:/usr/local/bin"
+if [ $USER = 'root' ]; then
+    PATH="/sbin:/usr/sbin:$PATH:/usr/local/sbin"
+fi
+
+MANPATH="/usr/share/man:/usr/local/share/man"
+
+export PATH MANPATH PS1 PS2
+
+export LANG="en_US.ISO8859-1"
+
+# The sort order of ls output is affected by  the  locale  and
+# can  be  overridden  by the LC_COLLATE environment variable.
+# For example, if LC_COLLATE equals C, dot files appear first,
+# followed  by  names  beginning with upper-case letters, then
+# followed by names beginning with lower-case letters. But  if
+# LC_COLLATE equals en_US.ISO8859-1, then leading dots as well
+# as case are ignored in determining the sort order.
+export LC_COLLATE=C
+
+EOF
+
+sed -i -e "s!_DEFAULT_EDITOR_!${DEFAULT_EDITOR}!g" /etc/profile &&
+
+var_add_str "CFLAGS" /etc/profile "-march=${MACHINE_ARCHITECTURE}" &&
+
+echo "Creating /etc/bashrc" &&
+cat > /etc/bashrc << "EOF" &&
+#!/bin/sh
+
+# /etc/bashrc
+
+# System wide functions and aliases
+# Environment stuff goes in /etc/profile
+
+alias df='df -h'
+alias du='du -h -s'
+# --show-control-chars is for seeing international characters in filenames
+alias ls='ls -h --color=auto --show-control-chars'
+alias halt='/sbin/halt'
+alias reboot='/sbin/reboot' 
+
+eval $(dircolors --sh /etc/DIR_COLORS)
+
+# For some unknown reason bash refuses to inherit PS1 in some circumstances
+# that I can't figure out. Putting PS1 here ensures that it gets loaded every
+# time.
+# \h = Display hostname
+# \s = Display shell name (bash)
+# \v = Display shell version
+# \w = Display complete path
+# \W = Dispaly only current directory
+# \$ = Display '#'
+#PS1="\h(\W)\$"
+
+if [ "$TERM" = "linux" ]; then
+    #we're on the system console or maybe telnetting in
+    export PS1="\u(\W)\$"
+    #export PS1="\[\e[32;1m\]\u@\H > \[\e[0m\]"
+else
+    #we're not on the console, assume an xterm
+    #export PS1="\[\e]2;\u@\H   \w\a\e[32;1m\]>\[\e[0m\] "
+    export PS1="\[\e]2;[\u]   \w\a\e[32;1m\]>\[\e[0m\] "
+fi
+EOF
+
+echo "Creating /etc/inputrc" &&
+cat > /etc/inputrc << "EOF" &&
+# Begin /etc/inputrc
+
+# Enable 8bit input
+set meta-flag On
+set input-meta On
+# Turns off 8th bit stripping
+set convert-meta Off
+# Keep the 8th bit for display
+set output-meta On
+
+# none, visible or audible
+set bell-style none
+
+# All of the following map the escape sequence of the value contained inside
+# the 1st argument to the readline specific functions
+"\eOd": backward-word
+"\eOc": forward-word
+# for linux console
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+"\e[5~": beginning-of-history
+"\e[6~": end-of-history
+"\e[3~": delete-char
+"\e[2~": quoted-insert
+# for xterm
+"\eOH": beginning-of-line
+"\eOF": end-of-line
+EOF
+
+
+echo "Creating /etc/skel and it's files" &&
+mkdir -p /etc/skel &&
+cat > /etc/skel/.bash_logout << "EOF" &&
+# ~/.bash_logout
+
+clear
+EOF
+
+cat > /etc/skel/.bash_profile << "EOF" &&
+# ~/.bash_profile
+
+# User specific environment and startup programs
+# This file is the second read by bash during the logon process.
+
+# Get the aliases and functions
+if [ -f ~/.bashrc ]; then
+       . ~/.bashrc
+fi
+
+BASH_ENV=$HOME/.bashrc
+
+export BASH_ENV
+
+unset USERNAME
+EOF
+
+cat > /etc/skel/.bashrc << "EOF" &&
+# ~/.bashrc
+
+# User specific aliases and functions
+# This file is executed each time an xterm window
+# is started.
+
+# Source global definitions
+if [ -f /etc/bashrc ]; then
+       . /etc/bashrc
+fi
+
+alias rm='rm -i'
+alias mv='mv -i'
+alias cp='cp -i'
+EOF
+
+echo "Creating /etc/host.conf" &&
+cat > /etc/host.conf << "EOF" &&
+# /etc/host.conf
+#
+# Lookup names via DNS first then fall back to /etc/hosts.
+order bind,hosts
+
+# Allow multiple addresses.
+multi on
+
+# Check for IP address spoofing.
+nospoof on
+EOF
+chmod 644 /etc/host.conf &&
+
+echo "Creating /etc/shells" &&
+cat > /etc/shells << "EOF" &&
+/bin/sh
+/bin/bash
+EOF
+chmod 644 /etc/shells &&
+
+echo "Installing /etc/DIR_COLORS" &&
+install -m644 ${CWD}/misc/DIR_COLORS /etc/DIR_COLORS &&
+
+echo "Creating /etc/shutdown.allow" &&
+echo "${REGUSER}" > /etc/shutdown.allow
+
+exit $?
diff --git a/stage2/create-groups b/stage2/create-groups
new file mode 100755 (executable)
index 0000000..75e784c
--- /dev/null
@@ -0,0 +1,37 @@
+#!/tools/bin/sh
+
+# System configuration informations (entered by the user)
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# In order for root to be able to login and for the name "root" to be
+# recognized, there need to be relevant entries in the /etc/group file.
+
+cat > /etc/group << "EOF"
+root:x:0:
+bin:x:1:
+sys:x:2:
+kmem:x:3:
+tty:x:4:
+tape:x:5:
+daemon:x:6:
+floppy:x:7:
+disk:x:8:
+lp:x:9:
+uucp:x:10:
+audio:x:11:
+video:x:12
+utmp:x:13
+usb:x:14
+cdrom:x:15
+# Used by MTAs (Mail Transport Agents)
+mail:x:34:mail
+# Default group used by some programs that do not require a group.
+nogroup:x:99:
+# The default GID used by shadow for new users
+users:x:100:
+
+EOF
+
+exit $?
diff --git a/stage2/create-users b/stage2/create-users
new file mode 100755 (executable)
index 0000000..46033c4
--- /dev/null
@@ -0,0 +1,13 @@
+#!/tools/bin/sh
+
+# System configuration informations (entered by the user)
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# In order for root to be able to login and for the name "root" to be
+# recognized, there need to be relevant entries in the /etc/passwd file.
+
+echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd
+
+exit $?
diff --git a/stage2/hv-utilities/camera-download b/stage2/hv-utilities/camera-download
new file mode 100755 (executable)
index 0000000..7271f49
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+PROG_NAME=$(basename $0)
+
+MOUNTPOINT=/media/camera
+DIRNAME=$(date +%Y%m%d-%Hh%M)
+
+print_usage()
+{
+    echo "Usage: ${PROG_NAME} [OPTION]..."
+    echo
+    echo "Copy and delte images from digital camera."
+    echo
+    echo "Options:"
+    echo "  -h   display this help and exit"
+    exit 0
+}
+
+while getopts "h" flag ;do
+    case ${flag} in
+       h)
+           print_usage
+           ;;
+       ?)
+           echo "${PROG_NAME}: Invalid option: ${OPTARG}."
+           echo "Try \`${PROG_NAME} -h' for more information."
+           exit 1
+           ;;
+    esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -ne 0 ]; then
+    echo "${PROG_NAME}: Too many arguments."
+    echo "Try \`${PROG_NAME} -h' for more information."
+    exit 1
+fi
+
+
+if ! mount | grep ${MOUNTPOINT} 1> /dev/null 2>&1; then
+    mount ${MOUNTPOINT} || exit 1
+fi
+
+mkdir -p ~/camera/${DIRNAME} &&
+
+mv ${MOUNTPOINT}/dcim/???_???? ~/camera/${DIRNAME}
+
+umount /media/camera
+
+exit $?
diff --git a/stage2/hv-utilities/cd-copy b/stage2/hv-utilities/cd-copy
new file mode 100755 (executable)
index 0000000..166698e
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# cd-copy: CD to CD copy
+
+# Load configuration informations about device
+. /etc/sysconfig/cdrecord
+
+print_usage()
+{
+    echo "Usage: $(basename $0)"
+}
+
+if [ $# != 0 ]; then
+    print_usage
+    exit 1
+fi
+
+if [ "x${CDROM_DEVICE}" != "x${CDREC_DEVICE}" ];then
+    CDRDAO_OPTS="--on-the-fly"
+fi
+
+cdrdao copy ${CDRDAO_OPTS} \
+    --source-device ${CDROM_DEVICE} \
+    --device ${CDREC_DEVICE} ${CDRECORD_OPTS} --eject
+
+exit $?
diff --git a/stage2/hv-utilities/cd-erase b/stage2/hv-utilities/cd-erase
new file mode 100755 (executable)
index 0000000..74930c2
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# cd-erase
+
+# Load configuration informations about device
+. /etc/sysconfig/cdrecord
+
+print_usage()
+{
+    echo "Usage: $(basename $0) {all|fast|session}"
+}
+
+if [ $# = 0 -o $# -gt 1 ]; then
+    print_usage
+    exit 1
+fi
+
+ERASE_TYPE=${1}
+
+case "${ERASE_TYPE}" in
+    all)
+       ;;
+    
+    fast)
+       ;;
+    
+    session)
+       ;;
+    
+    *)
+       print_usage
+       exit 1
+       ;;
+esac
+
+cdrecord ${CDRECORD_OPTS} dev=${CDREC_DEVICE} blank=${ERASE_TYPE}
+
+exit $?
diff --git a/stage2/hv-utilities/crypt.pl b/stage2/hv-utilities/crypt.pl
new file mode 100755 (executable)
index 0000000..17f366b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+srand (time());
+my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
+my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
+my $plaintext = shift;
+my $crypttext = crypt ($plaintext, $salt);
+
+print "${crypttext}\n";
diff --git a/stage2/hv-utilities/distro-backup b/stage2/hv-utilities/distro-backup
new file mode 100755 (executable)
index 0000000..006ab2b
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# linux HV backup
+
+export MEDIA_DEV="/dev/dvd"
+export MEDIA_DIR="/media/dvd"
+
+export BKP_TMP_DIR=/mnt/video/tmp
+BKP_FILES_LIST="/bin /boot /dev /etc /home /lib /opt /root /sbin /var /usr"
+
+media-write ${BKP_FILES_LIST}
+
+exit $?
diff --git a/stage2/hv-utilities/dos2unix b/stage2/hv-utilities/dos2unix
new file mode 100755 (executable)
index 0000000..aca541a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+print_usage()
+{
+    echo "$(basename $0) -- Translates multiple DOS text file to UNIX."
+    echo "Usage: $(basename $0) dos-text-file"
+}
+
+if [ $# = 0 ]; then
+    print_usage
+    exit 1
+fi
+
+TMPFILE="/tmp/dos2unix$$"
+
+while [ $# -ne 0 ]; do
+    # Checking if input file exist.
+    if [ ! -f $1 ]; then
+       echo "$0: File $1 not found."
+       print_usage
+       exit 1
+    fi
+    # DOS files lines ends with CR+LF. Unix files lines ends with LF.
+    # Removing CR from DOS file (CR is 0x0D --> 015 in octal notation).
+    tr -d '\015' < $1 > $TMPFILE
+    if [ $? -eq 0 ] ; then
+       # Success
+        mv $TMPFILE $1
+    fi
+    shift
+done
+
+if [ -f $TMPFILE ]; then
+    rm $TMPFILE
+fi
diff --git a/stage2/hv-utilities/dvd-ram-format b/stage2/hv-utilities/dvd-ram-format
new file mode 100755 (executable)
index 0000000..44a9a27
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+mkudffs --spartable=2 --media-type=dvdram /dev/dvdram
+
+exit $?
diff --git a/stage2/hv-utilities/fix-avi b/stage2/hv-utilities/fix-avi
new file mode 100755 (executable)
index 0000000..b626971
--- /dev/null
@@ -0,0 +1,149 @@
+#!/bin/bash
+#
+# A script to correct the resolution of an AVI file and
+# make a DVD without any stretching or squashing
+#
+
+# NTSC values
+dvd_width=720
+dvd_height=480
+
+# Precision of computations
+BC_SCALE=10
+
+print_usage()
+{
+    echo "Usage: ${PROG_NAME} [OPTION]...  WIDTHxHEIGHT"
+    echo
+    echo "Outputs ffmpeg options to correctly convert an AVI file,"
+    echo "of width WIDTH and height HEIGHT, for creating a"
+    echo "video DVD."
+    echo
+    echo "Options:"
+    echo "  -h     display this help and exit"
+    echo "  -w     output in widescreen format (preferred)"
+    echo "  -v     verbose output"
+    echo
+    echo "When encoding to a 16:9 aspect MPEG (*see note below*)"
+    echo "
+Source   NTSC/PAL               NTSC/PAL               NTSC/PAL
+Aspect   CVD                    SVCD                   DVD
+ 4:3     Not Applicable: See above table for 1.33 resolutions
+
+16:9     *352x480 / *352x576    *480x480 / *480x576    352x480 / 352x576 704x480 / 704x576 720x480 / 720x576
+
+1.85     *352x460 / *352x552    *480x460 / *480x552    352x460 / 352x552 704x460 / 704x552 720x460 / 720x552
+
+2.20     *352x388 / *352x432    *480x388 / *480x464    352x388 / 352x464 704x388 / 704x464 720x388 / 720x464
+
+2.35     *352x360 / *352x432    *480x360 / *480x432    352x360 / 352x432 704x360 / 704x432 720x360 / 720x432"
+}
+
+#dvd_dar this is either 16:9 or 4:3 the Display Aspect Ratio
+dvd_dar=`echo "scale=${BC_SCALE}; 4/3" | bc`
+DISPLAY_DAR="4:3"
+
+while getopts "hwv" flag ;do
+    case ${flag} in
+       h)
+           print_usage
+            exit 0
+           ;;
+       w)
+            # Widescreen, 16:9
+            dvd_dar=`echo "scale=${BC_SCALE}; 16/9" | bc`
+            DISPLAY_DAR="16:9"
+            widescreen=yes
+           ;;
+       v)
+           VERBOSE=yes
+           ;;
+       ?)
+           echo "${PROG_NAME}: Invalid option: ${OPTARG}."
+           echo "Try \`${PROG_NAME} --help' for more information."
+           exit 1
+           ;;
+    esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -ne 1 ]; then
+    print_usage
+    exit 1
+fi
+
+
+calc_par()
+{
+    width=$1
+    height=$2
+    dar=$3
+
+    echo "scale=${BC_SCALE}; ($height*$dar)/$width" | bc
+}
+
+src_width=$(echo $1 | sed "s!\([0-9]*\)x[0-9]*!\1!")
+src_height=$(echo $1 | sed "s![0-9]*x\([0-9]*\)!\1!")
+
+src_dar=`echo "scale=${BC_SCALE}; $src_width/$src_height" | bc`
+src_par=$(calc_par $src_width $src_height $src_dar)
+
+dvd_par=$(calc_par $dvd_width $dvd_height $dvd_dar)
+
+# when width of DVD is going to be 720, height will be:
+out_height=`echo "scale=0; ($dvd_par*$dvd_width)/$src_dar" | bc`
+
+# Temporaire:
+if [ ${out_height} -gt 480 -a ${out_height} -lt 485 ]; then
+    out_height=${dvd_height}
+fi
+
+h22=`echo "scale=0; ($out_height/2)*2" | bc`
+
+# ...and working out height is even, if not add 1 to make it even
+if [ $out_height != $h22 ]; then
+    out_height=`expr $out_height + 1`
+fi
+
+#Padding needed
+#And test if even pixels
+
+p=`echo "scale=0; ($dvd_height-$out_height)/2" | bc`
+p22=`echo "scale=0; ($p/2)*2" | bc`
+
+# Padding values must be even.
+if [ $p != $p22 ]; then
+    p_top=`expr $p - 1`
+    p_bot=`expr $p + 1`
+else
+    p_bot=$p
+    p_top=$p
+fi
+
+if [ "x${VERBOSE}" == "xyes" ]; then
+    out_par=$(calc_par $dvd_width $out_height $dvd_dar)
+    echo "Source:"
+    echo "  Size................: ${src_width}x${src_height}"
+    echo "  Display Aspect Ratio: ${src_dar}"
+    echo "  Pixel Aspect Ratio..: ${src_par}"
+    echo
+    echo "DVD:"
+    echo "  Size................: ${dvd_width}x${dvd_height}"
+    echo "  Display Aspect Ratio: ${dvd_dar}"
+    echo "  Pixel Aspect Ratio..: ${dvd_par}"
+    echo
+    echo "Output:"
+    echo "  Size................: ${dvd_width}x${out_height}"
+    echo "  Display Aspect Ratio: ${dvd_dar}"
+    echo "  Pixel Aspect Ratio..: ${out_par}"
+    echo "  Padding Top.........: ${p_top}"
+    echo "  Padding Bottom......: ${p_bot}"
+    echo
+    echo "ffmpeg options:"
+fi
+
+echo " -s ${dvd_width}x${out_height} -padtop ${p_top} -padbottom ${p_bot} -aspect ${DISPLAY_DAR}"
+
+exit $?
diff --git a/stage2/hv-utilities/gztobz2 b/stage2/hv-utilities/gztobz2
new file mode 100755 (executable)
index 0000000..5bb9918
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+print_usage()
+{
+    echo "$(basename $0) -- Convert multiple compressed gzip files to bzip2."
+    echo "Usage: $(basename $0) [FILES]"
+}
+
+if [ $# = 0 ]; then
+    print_usage
+    exit 1
+fi
+
+while [ $# -ne 0 ]; do
+    ORIG_GZIPPED_FILENAME=${1}
+
+    # Checking if input file exist.
+    if [ ! -f $1 ]; then
+       echo "$0: File ${ORIG_GZIPPED_FILENAME} not found."
+       exit 1
+    fi
+
+    # Checking if input file is a valid gzipped file.
+    gzip -t ${ORIG_GZIPPED_FILENAME}
+    if [ $? -ne 0 ] ; then
+       echo "$0: File ${ORIG_GZIPPED_FILENAME} is not a valid gzip file."
+       exit 1
+    fi
+
+    # Obtaining uncompressed name of file
+    FILENAME=$(gunzip -l ${ORIG_GZIPPED_FILENAME} | sed '1d' | sed 's/\(.*\)% \(.*\)/\2/')
+    
+    # Decompressing file to standard output and piping result to bzip2
+    gunzip ${ORIG_GZIPPED_FILENAME} --stdout | bzip2 --best > ${FILENAME}.bz2
+    if [ $? -ne 0 ] ; then
+       echo "$0: Error converting file ${ORIG_GZIPPED_FILENAME} to bzip2."
+       exit 1
+    fi
+
+    # Keeping the original file's timestamp
+    touch --reference=${ORIG_GZIPPED_FILENAME} ${FILENAME}.bz2
+
+    # Deleting original .gz file
+    if [ -f ${FILENAME}.bz2 ]; then
+       rm ${ORIG_GZIPPED_FILENAME}
+    fi
+    
+    shift
+done
diff --git a/stage2/hv-utilities/hv-backup b/stage2/hv-utilities/hv-backup
new file mode 100755 (executable)
index 0000000..38a74a8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# dvd-backup
+
+# Load configuration informations about device
+. /etc/sysconfig/cdrecord
+
+export MEDIA_DEV="/dev/dvd"
+export MEDIA_DIR="/media/dvd"
+
+source /etc/backup.conf
+
+export BKP_TMP_DIR
+
+media-write ${BKP_FILES_LIST}
+
+exit $?
diff --git a/stage2/hv-utilities/hv-video-dvd b/stage2/hv-utilities/hv-video-dvd
new file mode 100755 (executable)
index 0000000..230ffee
--- /dev/null
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+#====================================================
+# Options modifiables par l'usager.
+#====================================================
+
+# Pour convertir une portion seulement, ajouter: "-ss 00:00:00 -t 00:00:30"
+START_TIME="00:00:00"
+#DURATION="00:01:00"
+
+# Taille du fichier de sortie selon le video bitrate,
+# pour un fichier source AVI de 345M:
+# 
+#   Non-spécifié: 811M
+#   2000k:        726M
+#   1400k:        594M
+
+# 1 ou 2
+PASSES=1
+
+#====================================================
+# Fin des options modifiables par l'usager.
+#====================================================
+
+print_usage()
+{
+    echo "Usage: ${PROG_NAME} [OPTION]... FICHIER"
+    echo ""
+    echo "Conversion d'un fichier vidéo AVI au format MPEG-2 pour créer un DVD vidéo."
+    echo ""
+    echo "Options:"
+    echo "  -a     Display Aspect Ratio du DVD, 4:3 (avec barres noires ajoutées) ou 16:9 (widescreen)"
+    echo "  -b     video bitrate (ex: -b 1400k)"
+    echo "  -h     affiche cette aide et termine"
+    echo "  -o     nom du fichier de sortie"
+    echo "  -s     taille du fichier source [WxH]"
+    echo "  -w     grave le DVD"
+}
+
+#====================================================
+# Options de la ligne de commande
+#====================================================
+
+while getopts "a:b:ho:s:w" flag ;do
+    case ${flag} in
+       a)
+            # Display Aspect Ratio of DVD, 4:3 (with blank bars added) or 16:9 (widescreen)
+            dvd_dar=${OPTARG}
+           ;;
+       b)
+            # Video bitrate
+            video_bitrate=${OPTARG}
+           ;;
+       h)
+           print_usage
+            exit 0
+           ;;
+       o)
+           outfile=${OPTARG}
+            ;;
+       s)
+           src_size=${OPTARG}
+            ;;
+       w)
+           bruler="yes"
+           ;;
+       ?)
+           echo "${PROG_NAME}: Option invalide: ${OPTARG}."
+           echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
+           exit 1
+           ;;
+    esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -ne 1 ]; then
+    echo "Erreur: fichier source non-spécifié."
+    echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
+    exit 1
+fi
+
+INFILE="${1}"
+
+if [ -z ${outfile} ]; then
+    outfile="$(basename ${INFILE} .avi).mpg"
+fi
+
+if [ -z ${DURATION} ]; then
+    ARG_DURATION=""
+else
+    ARG_DURATION="-t ${DURATION}"
+fi
+
+if [ "x${dvd_dar}" == "x16:9" ]; then
+    ARG_WIDESCREEN="-w"
+else
+    ARG_WIDESCREEN=""
+fi
+
+if [ -z ${video_bitrate} ]; then
+    ARG_VIDEO_BIT_RATE=""
+else
+    ARG_VIDEO_BIT_RATE="-b ${video_bitrate}"
+fi
+
+if [ -z ${src_size} ]; then
+    echo "Erreur: taille du fichier source non-spécifiée."
+    exit 1
+fi
+
+#====================================================
+# Obtention des options Ã  utiliser avec FFMPEG
+#====================================================
+DVD_CONVERSION_OPTIONS=$(fix-avi ${ARG_WIDESCREEN} ${src_size} )
+# -y : Overwrite output files.
+FFMPEG_OPT="-y -ss ${START_TIME} ${ARG_DURATION} -target ntsc-dvd ${ARG_VIDEO_BIT_RATE} ${DVD_CONVERSION_OPTIONS}"
+
+if [ ! -f ${INFILE} ]; then
+    echo "Erreur: fichier source absent."
+    exit 1
+fi
+
+if [ -f ${outfile} ]; then
+    echo "Fichier <${outfile}> déjà convertit, terminé."
+else
+    for passe in $(seq ${PASSES}); do
+        if [ "x${PASSES}" == "x1" ]; then
+            PASSES_OPT=""
+        else
+            PASSES_OPT="-pass $passe"
+        fi
+        
+        echo "FFMPEG options: ${PASSES_OPT} ${FFMPEG_OPT}"
+        ffmpeg ${PASSES_OPT} -i ${INFILE} ${FFMPEG_OPT} ${outfile} || exit 1
+    done
+fi
+
+exit $?
diff --git a/stage2/hv-utilities/mail-files b/stage2/hv-utilities/mail-files
new file mode 100755 (executable)
index 0000000..b910580
--- /dev/null
@@ -0,0 +1,307 @@
+#!/bin/sh
+
+# script to email files as attachments.
+# ------------------------------------
+
+# Additional documentation for this script, including a brief introdcution 
+# to MIME can be found at:  http://home.clara.net/dwotton/unix/mail_files.htm
+
+# Written: Dave Wotton, July 1998, (Cambridge UK)
+#          This script comes with no warranty or support. You are
+#          free to modify it as you wish, but please retain an
+#          acknowledgement of my original authorship.
+
+# Amended: Dave Wotton, 6/3/99
+#          -t flag now optional. subject also optional
+#
+# Amended: Dave Wotton, 3/8/00
+#          added -b and -u  options. By default a file-list which is not
+#          preceded by a -n, -b, or -u flag is now NOT encoded (the previous
+#          default was to base64 encode it.).
+#
+# Amended: Dave Wotton, 10/10/00
+#          added a -c (cc:) option.
+#          Added a tty -s test to prevent the prompt to enter the text body
+#          being displayed when not connected to a tty. (The text body is
+#          still required though. /dev/null will suffice.)
+#
+# Amended: Dave Wotton, 24/2/01
+#          Now uses perl to perform the base64 encoding, as it comes as
+#          standard on most modern Unixes. (You need the perl MIME package
+#          though, which I believe is standard. )
+
+# Amended: Dave Wotton, 22/09/01
+#          Now creates a "To:" header and uses the sendmail -t flag to
+#          duplicate this as the envelope recipients, rather than using the
+#          user supplied list of addresses simply as envelope recipients.
+#          This confused some mail clients, specifically Lotus Notes.
+
+# Amended: Dave Wotton, 30/09/01
+#          Now initialises the main variables, so that previously set
+#          environment variable values (eg. $CC) aren't used instead.
+#          Enable multiple occurrences of the -t and -c flags. Thanks to
+#          Jason Judge for these suggestions.
+
+
+# Usage:   mail_files [-t] mailid [ -c mailid ] [ -s subject ] [ -f mailid ] 
+#          [-n file_list] [-u file_list] [-b file_list] file_list
+#
+#    -f      : The mailid of the sender ( defaults to your userid )
+#              Only userids that have been defined as "trusted" in the sendmail
+#              config file can make use of the -f option. For non-trusted users
+#              any value specified by this parameter will be ignored by 
+#              sendmail.
+#    -t      : The mailid of the recipient. Mandatory, no default
+#              multiple mailids can be specified, separated by commas.
+#    -c      : The mailid of any carbon-copy recipients. Optional.
+#              multiple mailids can be specified, separated by commas.
+#    -s      : The subject string. Optional, default = "Not specified".
+#              Enclose in quotes.
+#    -n      : no-encode: indicates a list of files which are NOT to be base64
+#              or uuencode encoded. Multiple files may be enclosed in double
+#              quotes. Usual wildcard notation can be used. This option is
+#              for completeness and can be omitted because the default action 
+#              is not to encode the file-list.
+#    -b      : base64 encoding: indicates a list of files which are to be 
+#              base64 encoded. Multiple files may be enclosed in double quotes.
+#              Usual wildcard notation can be used.
+#    -u      : uuencode encoding: indicates a list of files which are to be 
+#              uuencode encoded. Multiple files may be enclosed in double 
+#              quotes. Usual wildcard notation can be used.
+#  file_list : The list of files to send as attachments with no-encoding
+#              (same as -n option, but the file list does not need to be
+#              enclosed in quotes if more than one file specified). 
+#              Usual wildcard notation can be used.
+
+# The program will also prompt for text to be supplied on standard input
+# as the main text of the message.
+
+# eg.
+#      1) mail_files Dave.Wotton -b file9.gif t*.htm < /dev/null
+#
+#         email file9.gif as a base64 encoded attachment and the t*.htm
+#         files unencoded.
+#
+#      2) mail_files Dave.Wotton -s "my test" -b "file1.gif file2.gif" \
+#                    < /dev/null
+#
+#         email file1.gif and file2.gif as base64 encoded attachments.
+
+# The script makes use of perl's MIME package to perform the base-64 
+# encoding/decoding. 
+
+# Note that files destined for Windows environments should have a name of
+# the form aaaa.bbb where aaaa is up to 8 characters long, and bbb is a
+# 3 character sufix. The suffix determines which program is used to
+# display/process the data at the remote end.
+
+# Simple text files can be emailed unencoded. Binary files, or text files
+# with long lines ( ie > 1000 chars ) should use the  base64 or uuencode 
+# encoding procedures. Base64 is preferred because it is more universally
+# supported. In particular, most PC mail-clients can automatically decode
+# base64 encoded attachments. Note that simple text files with short lines 
+# which are destined for PC environments should not be base64 encoded.
+# This is because PCs use a different line-break character to Unix.
+# If the text is base64 encoded, the line-breaks are not converted
+# automatically and so the data arrives at the remote end without
+# line-breaks.
+
+# set up a 'usage' routine
+# ------------------------
+
+usage()
+{
+  [ "$1" ] && ( echo $* ; echo "" )
+
+  cat <<!
+  Usage:   mail_files [-t] mailid [ -c mailid ] [ -s subject ] [ -f mailid ] 
+           [-n file_list] [-u file_list] [-b file_list] file_list
+!
+  exit 4
+}
+
+# Initialise main variables ...
+# -------------------------
+
+FROM=$LOGNAME
+SUBJ=${SUBJ:-"Not specified"}
+
+TO="" ; CC="" ; SUBJ="" ; NOENC="" ; BASE64="" ; UUE=""
+
+# First parse the command line options. Using getopts means the parameters
+# can be supplied in any order. But first we handle the first parameter,
+# which may be a recipient, without a -t flag...
+
+case "$1" in
+   -* ) : ;;                   # ignore it, let getopts handle flags
+    * ) TO=$1 ; shift ;;
+esac
+
+while getopts f:s:t:c:n:b:u: OPT
+do
+     case $OPT in
+         "f" ) FROM=$OPTARG ;;
+         "t" ) TO="$TO,$OPTARG" ;;
+         "c" ) CC="$CC,$OPTARG" ;;
+         "s" ) SUBJ=$OPTARG ;;
+         "n" ) NOENC="$NOENC $OPTARG" ;;
+         "b" ) BASE64="$BASE64 $OPTARG" ;;
+         "u" ) UUE="$UUE $OPTARG" ;;
+          *  ) usage ;;
+     esac
+done
+
+shift `expr $OPTIND - 1`
+
+if [ "$TO" = "" ]
+then
+    usage "An addressee must be specified"
+fi
+
+# All remaining parameters are files not requiring encoding ...
+# ---------------------------------------------------------
+
+# Build up $FILES as the list of non-encoded files. Use sed to remove
+# any leading space from the variable.
+
+FILES=`echo $NOENC $*|sed 's/^ //'`
+
+if [ "$BASE64" = "" -a "$FILES" = "" -a "$UUE" = "" ]
+then
+    usage "At least one file must be specified"
+fi
+
+# Remove leading commas from TO, CC  ...
+# ---------------------------------
+
+TO=`echo $TO | sed 's/^,//'`
+CC=`echo $CC | sed 's/^,//'`
+
+# Validate that the files exist ...
+# -----------------------------
+
+for F in $FILES $BASE64 $UUE
+do
+   if [ ! -r $F ]
+   then
+      echo "Error: File $F does not exist / is not readable."
+      echo "Exiting. ( Mail not sent )."
+      exit
+   fi
+done
+
+tty -s && echo "Enter text of main message ( finish with CTRL-D ) ..."
+
+# Now do the work ...
+# ---------------
+
+# The generated mail message is output onto standard out, which is then
+# piped in to sendmail.
+
+(
+cat <<!
+From: $FROM
+Subject: $SUBJ
+To: $TO
+!
+
+[ "$CC" ] && echo "Cc: $CC"
+
+cat <<!
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"
+
+This is a Mime message, which your mail program may not understand. Parts
+of the message will appear as text. If the remainder appears as random
+characters in the message body, instead of as attachments, then you'll
+have to extract these parts and decode them manually.
+
+--DMW.Boundary.605592468
+Content-Type: text/plain; name="message.txt"; charset=US-ASCII
+Content-Disposition: inline; filename="message.txt"
+Content-Transfer-Encoding: 7bit
+
+!
+
+# Read the standard input as the main text of the message ...
+# -------------------------------------------------------
+
+cat - 
+
+# Now process the non-encrypted attachments ...
+# -----------------------------------------
+
+if [ "$FILES" ]
+then
+    for F in $FILES
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: 7bit
+       echo
+
+       cat $F
+
+    done
+fi
+
+# Now process the base64 encrypted attachments ...
+# --------------------------------------------
+
+if [ "$BASE64" ]
+then
+    for F in $BASE64
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: base64
+       echo
+
+       perl -e '
+       use MIME::Base64 qw(encode_base64);
+       local($/) = undef;
+       print encode_base64(<STDIN>);' < $F
+
+    done
+fi
+
+# Now process the uuencode encrypted attachments ...
+# ----------------------------------------------
+
+# Sorry, this bit is untested - I haven't got a mail-client which can
+# handle uuencoded MIME messages automatically, so can't test if the
+# 'Content-Transfer-Encoding: uuencode' line is correct and whether I
+# need the uuencode "begin" and "end" lines.
+
+if [ "$UUE" ]
+then
+    for F in $UUE
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: uuencode
+       echo
+
+       uuencode < $F xxx 
+
+    done
+fi
+
+# append the final boundary line ...
+
+echo --DMW.Boundary.605592468--
+
+) | /usr/sbin/sendmail -t -r ${FROM}
+#> test.txt
diff --git a/stage2/hv-utilities/mail-if-fail b/stage2/hv-utilities/mail-if-fail
new file mode 100755 (executable)
index 0000000..733ff9b
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# This script is used to run a command. If the command failed,
+# an email is sent to the address specified by MAILTO.
+
+# Begin of user modifiable variables
+MAILFROM="${USER}"
+MAILTO="root"
+# End of User modifiable variables
+
+SENDMAIL="/usr/sbin/sendmail -t -r ${MAILFROM}"
+MAILFILE="/tmp/mail-if-fail-output$$"
+LOGFILE="/tmp/mail-if-fail-log$$"
+
+# Running the specified command
+${*} 1> ${LOGFILE} 2>&1
+
+ERROR_CODE=${?}
+
+if [ ${ERROR_CODE} -ne "0" ]; then
+    echo "From: ${MAILFROM}" > ${MAILFILE}
+    echo "To: ${MAILTO}" >> ${MAILFILE}
+    echo "Subject: \"${1}\" FAILED (${ERROR_CODE})" >> ${MAILFILE}
+    echo "Content-type: text/plain" >> ${MAILFILE}
+    echo "Output of command ${*}:" >> ${MAILFILE}
+    echo >> ${MAILFILE}
+    cat ${LOGFILE} >> ${MAILFILE}
+    cat ${MAILFILE} | ${SENDMAIL} || exit 1
+    rm -f ${MAILFILE}
+fi
+
+rm -f ${LOGFILE}
+
+exit ${ERROR_CODE}
diff --git a/stage2/hv-utilities/mail-statistics b/stage2/hv-utilities/mail-statistics
new file mode 100755 (executable)
index 0000000..565aff8
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Sendmail and Procmail log file analyzer
+
+# If no parameters are given, use current log file
+if [ ${#} = 0 ]; then
+    SUFFIX=""
+    SUBDIR=""
+elif [ $# -eq 1 ]; then
+    SUFFIX=".$1"
+    SUBDIR="backup"
+else
+    echo "Usage: $0 [log file number]"
+    exit 1
+fi
+
+
+SM_LOG_FILE=/var/log/${SUBDIR}/mail.log${SUFFIX}
+PM_LOG_FILE=/var/log/${SUBDIR}/procmail.log${SUFFIX}
+
+
+# Computes a ratio
+# arg 1: numerator
+# arg 2: denumerator
+hv_ratio()
+{
+    echo $(( ( ( ${1} * 100000 ) / ${2} ) / 1000 ))
+}
+
+
+# Sendmail (MTA) statistics
+SM_REJECTED=$(cat ${SM_LOG_FILE} | grep 'ruleset=' | wc -l)
+SM_ACCEPTED=$(cat ${SM_LOG_FILE} | grep 'stat=Sent' | grep 'mailer=local' | wc -l)
+SM_TOTAL=$(( ${SM_REJECTED} + ${SM_ACCEPTED} ))
+
+# Procmail (MDA) statistics
+SPAM_COUNT=$(cat ${PM_LOG_FILE} | grep 'procmail: Match on \"\^X-Spam-Status: Yes' | wc -l)
+HAM_COUNT=$(cat ${PM_LOG_FILE} | grep 'procmail: No match on \"\^X-Spam-Status: Yes' | wc -l)
+SA_TOTAL=$(( ${SPAM_COUNT} + ${HAM_COUNT} ))
+
+echo "Sendmail statistics (MTA):"
+echo "  Accepted: $((${SM_ACCEPTED}))"
+echo "  Total:    ${SM_TOTAL}"
+echo "  Ratio:    $(hv_ratio ${SM_ACCEPTED} ${SM_TOTAL})%"
+echo "SpamAssassin statistics:"
+echo "  Spam:     $((${SPAM_COUNT}))"
+echo "  Total:    ${SA_TOTAL}"
+echo "  Ratio:    $(hv_ratio ${SPAM_COUNT} ${SA_TOTAL})%"
+
+exit 0
diff --git a/stage2/hv-utilities/media-write b/stage2/hv-utilities/media-write
new file mode 100755 (executable)
index 0000000..dfcfb1c
--- /dev/null
@@ -0,0 +1,157 @@
+#!/bin/sh
+
+# Write files/directories on CD or DVD
+
+# Load configuration informations about device
+. /etc/sysconfig/cdrecord
+
+# Maximum size in Mbytes
+CD_MEDIA_SIZE=700
+DVD_MEDIA_SIZE=4400
+
+GROWISOFS_OPTS="-dvd-compat"
+
+# Try to read ATIP infos for CD disks to estimate capacity...
+MEDIA_ATIP_INFOS=$(cdrecord dev=${MEDIA_DEV} -atip 2>&1)
+
+if echo ${MEDIA_ATIP_INFOS} | grep "ATIP info from disk" 1> /dev/null 2>&1; then
+    MEDIA_SIZE=${CD_MEDIA_SIZE}
+    MEDIA_TYPE="CD"
+    echo "CD disk detected"
+elif echo ${MEDIA_ATIP_INFOS} | grep "Found DVD media but" 1> /dev/null 2>&1; then
+    MEDIA_SIZE=${DVD_MEDIA_SIZE}
+    MEDIA_TYPE="DVD"
+    echo "DVD disk detected"
+elif echo ${MEDIA_ATIP_INFOS} | grep "cdrecord: No disk / Wrong disk" 1> /dev/null 2>&1; then
+    echo "No disk inserted, aborting"
+    exit 1
+else
+    echo "Unable to determine disk capacity, aborting"
+    exit 1
+fi
+
+echo "Disk capacity is ${MEDIA_SIZE} Mbytes"
+
+BKP_TMP_DIR=${BKP_TMP_DIR:-"/tmp"}
+TMP_FILE="${BKP_TMP_DIR}/media-write-file$$"
+TMP_MOUNT="${BKP_TMP_DIR}/media-write-mount$$"
+
+print_usage()
+{
+    echo "Usage: $(basename $0) files..."
+}
+
+evaluate_retval()
+{
+    last_error=$?
+    if [ ${last_error} -ne 0 ]; then
+       exit ${last_error}
+    fi
+}
+
+if [ $# = 0 ]; then
+    print_usage
+    exit 1
+fi
+
+FILES_SIZE="0"
+
+FILES_WRITE_LIST=${*}
+
+for file in ${FILES_WRITE_LIST}; do
+    if [ -d ${file} -o -f ${file} ]; then
+        FILES_SIZE=$(expr ${FILES_SIZE} + `du -m ${file} -s | sed 's/\([0-9]*\).*/\1/g'`)
+    else
+       echo "$0: Directory or file ${file} not found."
+       print_usage
+       exit 1
+    fi
+done
+
+echo "Total size of files to backup is ${FILES_SIZE}Mbytes"
+
+# The ext2 filesystem is not as space-efficient as the reiser filesystem,
+# so we must add a few megabytes...
+FILES_SIZE=`expr $FILES_SIZE + 20`
+
+if [ ${FILES_SIZE} -gt ${MEDIA_SIZE} ]; then
+    echo "Total size is greater than media capacity, aborting"
+    exit 1
+    #####FILES_SIZE=${MEDIA_SIZE}
+fi
+
+# Create an empty file of $FILES_SIZE
+dd if=/dev/zero of=${TMP_FILE} bs=1024k count=${FILES_SIZE}
+if [ $? != 0 ]; then
+    echo "Error while creating empty file..."
+    rm -f ${TMP_FILE}
+    exit 1
+fi
+
+# Create an extended-2 filesystem on this file
+echo y | /sbin/mke2fs -m 0 -b 2048 ${TMP_FILE}
+if [ $? != 0 ]; then
+    echo "Error creating file system on empty file..."
+    rm -f ${TMP_FILE}
+    exit 1
+fi
+
+# Mount this empty file through the loopback device.
+mkdir -p ${TMP_MOUNT}
+mount -o loop -t ext2 ${TMP_FILE} ${TMP_MOUNT}
+if [ $? != 0 ]; then
+    echo "Error mounting empty file..."
+    rm -f ${TMP_FILE}
+    rm -rf $TMP_MOUNT
+    exit 1
+fi
+
+# Removing lost+found directory
+rmdir ${TMP_MOUNT}/lost+found
+
+# Copy files to $TMP_MOUNT and umount it afterwards.
+echo "Copying files..."
+cp -a --parents ${FILES_WRITE_LIST} ${TMP_MOUNT}
+if [ $? != 0 ]; then
+    echo "Error while copying files..."
+    umount ${TMP_MOUNT}
+    rm -rf ${TMP_MOUNT}
+    rm -f ${TMP_FILE}
+    exit 1
+fi
+
+umount ${TMP_MOUNT}
+
+echo Press any key to burn files
+read
+
+#***************************************************
+# Burning...
+#***************************************************
+case "${MEDIA_TYPE}" in
+    CD)
+        cdrecord ${CDRECORD_OPTS} dev=${MEDIA_DEV} -data ${TMP_FILE} || exit 1
+       ;;
+    DVD)
+        growisofs ${GROWISOFS_OPTS} -Z /dev/dvd=${TMP_FILE} || exit 1
+       ;;
+    *)
+       echo "Unknown removable media type, aborting"
+       exit 1
+       ;;
+esac
+
+# Mounting the media to verify burned capacity
+if ! grep ${MEDIA_DEV} /etc/mtab 1> /dev/null 2>&1; then
+    mount ${MEDIA_DEV} ${MEDIA_DIR} || exit 1
+fi
+
+FILES_SIZE=$(du -m ${MEDIA_DIR} -s | sed 's/\([0-9]*\).*/\1/g')
+echo "Total size of files backed-up is ${FILES_SIZE}Mbytes"
+
+umount ${MEDIA_DIR}
+
+rmdir ${TMP_MOUNT}
+rm -f ${TMP_FILE}
+
+exit $?
diff --git a/stage2/hv-utilities/pstopdf b/stage2/hv-utilities/pstopdf
new file mode 100755 (executable)
index 0000000..36e3b1c
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+print_usage()
+{
+    echo "pstopdf -- Translates multiple Postscript files into a"
+    echo "           unique PDF document."
+    echo "Usage: $(basename $0) [OPTION]... [FILE]..."
+    echo
+    echo "  -o filename     Specify the name of the generated PDF file. The"
+    echo "                  default is 'output.pdf'."
+}
+
+while getopts ":o:" opt; do
+    case $opt in
+       o )
+           PDF_FILE=$OPTARG
+           ;;
+       \? )
+           print_usage
+           ;;
+    esac
+done
+
+if [ -z "${PDF_FILE}" ]; then
+    PDF_FILE="output.pdf"
+fi
+
+shift $(($OPTIND - 1))
+
+if [ $# -eq 0 ]; then
+    print_usage
+    exit 1
+fi
+
+gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=${PDF_FILE} $@
+
+exit 0
diff --git a/stage2/hv-utilities/replace.pl b/stage2/hv-utilities/replace.pl
new file mode 100755 (executable)
index 0000000..8347be6
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+#
+# Usage:  replace.pl original_string replacement_string input_filename
+# This Perl script changes the string $original to $replacement in all files
+# specified on the command line.
+# 19950926 gkj
+$original=$ARGV[0];
+$replacement=$ARGV[1];
+# The input record separator is defined by Perl global
+# variable $/.  It can be anything, including multiple
+# characters.  Normally it is "\n", newline.  Here, we
+# say there is no record separator, so the whole file
+# is read as one long record, newlines included.
+undef $/;
+
+$file=$ARGV[2];
+
+if (! open(INPUT,"<$file") ) {
+    print STDERR "Can't open input file $bakfile\n";
+    exit(0);
+}
+
+# Read input file as one long record.
+$data=<INPUT>;
+close INPUT;
+
+if ($data =~ s/$original/$replacement/gi) {
+    $bakfile = "$file.bak";
+    # Abort if can't backup original or output.
+    if (! rename($file,$bakfile)) {
+       die "Can't rename $file $!";
+    }
+    if (! open(OUTPUT,">$file") ) {
+       die "Can't open output file $file\n";
+    }
+    print OUTPUT $data;
+    close OUTPUT;
+    print STDERR "$file changed\n";
+}
+else {
+    print STDERR "$file not changed\n";
+}
+
+exit(0);
diff --git a/stage2/hv-utilities/rotatelogs b/stage2/hv-utilities/rotatelogs
new file mode 100755 (executable)
index 0000000..2a02fae
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+#
+# rotatelogs - rotate log files (local host)
+#
+
+BACKUP_LOGDIR="/var/log/backup"
+
+LOGDIR_GLOBAL=/var/log
+LOGFILES_GLOBAL="auth.log clamd.log freshclam.log cron.log daemon.log kern.log mail.log procmail.log scrollkeeper.log sys.log user.log xdm.log XFree86.0.log"
+
+LOGDIR_APACHE=/var/log/apache
+LOGFILES_APACHE="access_log error_log ssl_request_log"
+
+LOGDIR_CUPS=/var/log/cups
+LOGFILES_CUPS="access_log error_log"
+
+LOGDIR_NAMED=/home/named/etc/namedb
+LOGFILES_NAMED="named.run"
+
+# arg 1: Backup log directory
+# arg 2: log filename
+rotate_log()
+{
+    backup_log_dir=${1}
+    file=${2}
+    
+    for day in 8 7 6 5 4 3 2 1 0 ; do
+       if [ -f ${backup_log_dir}/${file}.${day} ]; then
+           mv ${backup_log_dir}/${file}.${day} ${backup_log_dir}/${file}.$((${day}+1)) || exit 1
+       fi
+    done
+    
+    if [ -f ${file} ]; then
+       user=$(ls -l --numeric-uid-gid ${file} | awk '{ print $3 }')
+       group=$(ls -l --numeric-uid-gid ${file} | awk '{ print $4 }')
+       cp -a ${file} ${backup_log_dir}/${file}.0 || exit 1
+    fi
+
+    # Empty file
+    cp /dev/null ${file} &&
+    chown ${user}.${group} ${file} &&
+    chmod 640 ${file}
+
+    return $?
+}
+
+if [ ! -d ${BACKUP_LOGDIR} ]; then
+    mkdir ${BACKUP_LOGDIR}
+fi
+
+# syslogd files
+LOGDIR=${LOGDIR_GLOBAL}
+cd ${LOGDIR} &&
+for file in ${LOGFILES_GLOBAL}; do
+    rotate_log ${BACKUP_LOGDIR} ${file} || exit 1
+done
+
+kill -HUP `cat /var/run/syslogd.pid`  &&
+
+# named (BIND) server log files (if installed)
+LOGDIR=${LOGDIR_NAMED}
+if [ -d ${LOGDIR} ]; then
+    cd ${LOGDIR} &&
+    for file in ${LOGFILES_NAMED}; do
+        rotate_log ${BACKUP_LOGDIR} ${file} || exit 1
+    done
+
+    kill -HUP `cat /home/named/var/run/named.pid` || exit 1
+fi
+
+# For Apache web server (if installed)
+LOGDIR=${LOGDIR_APACHE}
+if [ -d ${LOGDIR} ]; then
+    if [ ! -d ${BACKUP_LOGDIR}/apache ]; then
+        mkdir -p ${BACKUP_LOGDIR}/apache
+    fi
+    cd ${LOGDIR} &&
+    for file in ${LOGFILES_APACHE}; do
+        rotate_log ${BACKUP_LOGDIR}/apache ${file} || exit 1
+    done
+    
+    /usr/sbin/apachectl graceful &&
+    sleep 2
+fi
+
+# For CUPS
+LOGDIR=${LOGDIR_CUPS}
+if [ -d ${LOGDIR} ]; then
+    if [ ! -d ${BACKUP_LOGDIR}/cups ]; then
+        mkdir -p ${BACKUP_LOGDIR}/cups
+    fi
+    cd ${LOGDIR} &&
+    for file in ${LOGFILES_CUPS}; do
+        rotate_log ${BACKUP_LOGDIR}/cups ${file} || exit 1
+    done
+fi
+
+exit $?
diff --git a/stage2/hv-utilities/setdate b/stage2/hv-utilities/setdate
new file mode 100755 (executable)
index 0000000..ce2f14e
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rm /var/lib/hwclock/adjtime
+hwclock --localtime --set --date "2004/03/02 23:56:00"
+hwclock --localtime --hctosys
+date
diff --git a/stage2/hv-utilities/strip-debug-symbols b/stage2/hv-utilities/strip-debug-symbols
new file mode 100755 (executable)
index 0000000..6adf92a
--- /dev/null
@@ -0,0 +1,2 @@
+find /{,usr/,usr/local/}{bin,sbin,lib} -type f -exec /usr/bin/strip --strip-debug '{}' ';'
+
diff --git a/stage2/hv-utilities/tildes-clean b/stage2/hv-utilities/tildes-clean
new file mode 100755 (executable)
index 0000000..8c7dfaa
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# No arguments --> clean the current directory
+
+PROG_NAME=$(basename $0)
+MAXDEPTH="-maxdepth 1"
+
+print_usage()
+{
+    echo "Usage: ${PROG_NAME} [OPTION]... [SOURCE]"
+    echo
+    echo "Remove emacs backup files (ending with \`~') in SOURCE directory."
+    echo "If no SOURCE directory is specified, the current directory is"
+    echo "taken as SOURCE. Directory names ending with \`~' are not"
+    echo "removed, only files."
+    echo
+    echo "Options:"
+    echo "  -h   display this help and exit"
+    echo "  -r   allow cleanning of subdirectories"
+    exit 0
+}
+
+while getopts "hr" flag ;do
+    case ${flag} in
+       h)
+           print_usage
+           ;;
+       r)
+           MAXDEPTH=""
+           ;;
+       ?)
+           echo "${PROG_NAME}: Invalid option: ${OPTARG}."
+           echo "Try \`${PROG_NAME} --help' for more information."
+           exit 1
+           ;;
+    esac
+done
+shift `expr "${OPTIND}" - 1`
+
+# `$#' now represents the number of arguments after the options.
+# `$1' is the first argument, etc.
+if [ $# -gt 1 ]; then
+    echo "${PROG_NAME}: Too many arguments."
+    echo "Try \`${PROG_NAME} --help' for more information."
+    exit 1
+fi
+
+if [ $# = 0 ]; then
+    source_dir="."
+else
+    source_dir="${1}"
+fi
+
+if [ ! -d ${source_dir} ]; then
+    echo "${PROG_NAME}: ${source_dir}: No such directory."
+    exit 1
+fi
+
+# We remove the trailing `/' at the end of directory, if present.
+source_dir=$(echo ${source_dir} | sed 's/\/$//g')
+
+find ${source_dir} ${MAXDEPTH} -name '*~' -exec /bin/rm '{}' +
+
+exit $?
diff --git a/stage2/install-1 b/stage2/install-1
new file mode 100755 (executable)
index 0000000..7d34e49
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage2"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage2
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+init_log_file
+
+export CFLAGS="-pipe -march=${MACHINE_ARCHITECTURE} -O2"
+export CXXFLAGS=${CFLAGS}
+
+ipkg           ${KERNEL} cis-kernel
+ipkg           ${MANPAGES} cis-man-pages
+ipkg           ${GLIBC} cis-glibc
+run_script_log "toolchain-adjust-stage2" cis-toolchain-adjust
+ipkg           ${BINUTILS} cis-binutils
+ipkg           ${GCC_CORE} cis-gcc
+ipkg           ${DB4} cis-db4
+ipkg_ac        ${SED} "--bindir=/bin --enable-html"
+ipkg           ${E2FSPROGS} cis-e2fsprogs
+ipkg           ${COREUTILS} cis-coreutils
+ipkg           ${IANA} cis-iana
+ipkg_ac        ${MFOUR}
+ipkg           ${BISON} cis-bison
+ipkg           ${NCURSES} cis-ncurses
+ipkg           ${PROCPS} cis-procps
+ipkg_ac        ${LIBTOOL}
+ipkg           ${PERL} cis-perl
+ipkg           ${READLINE} cis-readline
+ipkg           ${ZLIB} cis-zlib
+ipkg_ac        ${AUTOCONF}
+ipkg_ac        ${AUTOMAKE}
+ipkg_ac        ${BASH} "--bindir=/bin --without-bash-malloc --with-installed-readline"
+
+/bin/bash +h -c ./install-2
+
+exit $?
diff --git a/stage2/install-2 b/stage2/install-2
new file mode 100755 (executable)
index 0000000..352adc7
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage2"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage2
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+init_log_file
+
+ipkg           ${BZIP2} cis-bzip2
+ipkg_ac        ${DIFFUTILS}
+ipkg_ac        ${FILE_PKG}
+ipkg           ${FINDUTILS} cis-findutils
+ipkg           ${FLEX} cis-flex
+ipkg           ${GRUB} cis-grub
+ipkg_ac        ${GAWK} "--libexecdir=/usr/lib"
+ipkg_ac        ${GETTEXT}
+ipkg_ac        ${GREP} "--bindir=/bin"
+ipkg           ${GROFF} cis-groff
+ipkg           ${GZIP} cis-gzip
+ipkg           ${INETUTILS} cis-inetutils
+ipkg           ${IPROUTE2} cis-iproute2
+ipkg           ${KBD} cis-kbd
+ipkg_ac        ${LESS}
+ipkg_ac        ${MAKE_PACKAGE}
+ipkg           ${MAN} cis-man # Obsoleted
+ipkg_ac        ${MKTEMP} "--with-libc"
+ipkg           ${MODULE_INIT_TOOLS} cis-module-init-tools
+ipkg_ac        ${PATCH_PACKAGE}
+ipkg           ${PSMISC} cis-psmisc
+ipkg           ${SHADOW} cis-shadow
+ipkg           ${SYSKLOGD} cis-sysklogd
+ipkg           ${SYSVINIT} cis-sysvinit
+ipkg_ac        ${TAR_PACKAGE} "--bindir=/bin --libexecdir=/usr/sbin"
+ipkg           ${TEXINFO} cis-texinfo
+ipkg           ${UDEV} cis-udev
+ipkg           ${UDEV_CONFIG} cis-udev-config
+ipkg           ${UTIL_LINUX} cis-util-linux
+
+# End of standard LFS packages installation.
+ipkg_ac        ${WHICH}
+ipkg           ${REISERFSPROGS} cis-reiserfsprogs
+ipkg           ${PCIUTILS} cis-pciutils
+ipkg           ${NET_TOOLS} cis-net-tools
+ipkg           ${DHCP} cis-dhcp
+ipkg           ${PKG_CONFIG} cis-pkg-config
+ipkg_ac_nb     ${POPT}
+ipkg           ${PAM} cis-pam
+ipkg           ${OPENSSL} cis-openssl
+ipkg           ${OPENSSH} cis-openssh
+
+ipkg_ac        ${EXPAT} # expat is needed by apr-util.
+ipkg           ${APR} cis-apr
+ipkg_ac        ${APR_UTIL} "--with-apr=/usr/bin/apr-1-config"
+ipkg_ac        ${NEON} "--with-ssl"
+ipkg_ac        ${SUBVERSION}
+
+ipkg           ${SUDO} cis-sudo
+ipkg_ac        ${WGET}
+
+ipkg_ac        ${NANO}
+ipkg           ${EMACS} cis-emacs
+
+ipkg           ${TCPWRAPPERS} cis-tcp-wrappers # Needed by portmap
+ipkg_ac_nb     ${PORTMAP}
+ipkg           ${NFS_UTILS}   cis-nfs-utils
+
+run_script_log  "Installing bootscripts" cis-bootscripts
+run_script_log  "Installing HV-utilities" cis-hv-utilities
+run_script_log  "Compressing man pages" cis-compressdoc
+####action_checkbox "Stripping" ./cis-stripping
+
+echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h"
+
+# Creating root password
+passwd root || exit 1
+
+action_checkbox "Performing post-install" ./cis-post-install
+ldconfig
+
+lasterror=$?
+
+if [ ${lasterror} -eq 0 ]; then
+    echo "Stage2 successfully completed."
+    echo "You must now compile a new kernel (go to /usr/src/linux)."
+    echo "After that, you can reboot and try your new system."
+else
+    echo "Error in script 'install-2'"
+    exit ${lasterror}
+fi
+
+exec /bin/bash --login
diff --git a/stage2/makedir b/stage2/makedir
new file mode 100755 (executable)
index 0000000..c7394c4
--- /dev/null
@@ -0,0 +1,35 @@
+#!/tools/bin/sh
+# This script is called when there is no /bin/sh link, so the shell is set
+# to /tools/bin/sh
+
+install -dv /{bin,boot,dev/pts,etc/opt,home,lib,mnt,proc} &&
+install -dv /{root,sbin,srv,sys,tmp,usr/local,var,opt} &&
+for dirname in /usr /usr/local
+  do
+  install -dv $dirname/{bin,etc,include,lib,sbin,share,src} &&
+  ln -sf share/{man,doc,info} $dirname &&
+  install -dv $dirname/share/{dict,doc,info,locale,man} &&
+  install -dv $dirname/share/{nls,misc,terminfo,zoneinfo} &&
+  install -dv $dirname/share/man/man{1,2,3,4,5,6,7,8}
+done &&
+install -dv /media/{cdrom,dvd} &&
+install -dv /var/{lock,log,mail,run,spool} &&
+install -dv /var/{tmp,opt,cache,lib/misc,local} &&
+install -dv /opt/{bin,doc,include,info} &&
+install -dv /opt/{lib,man/man{1,2,3,4,5,6,7,8}} &&
+install -dv /etc/rc.d/{init.d,rc0.d,rc1.d,rc2.d,rc3.d,rc4.d,rc5.d,rc6.d,rcS.d} &&
+install -dv /etc/sysconfig/network &&
+ln -v -sf ../var/tmp /usr &&
+
+# For alsa, nfs and fcron?
+install -dv /var/lock/subsys &&
+
+# Required only for hvlinux.
+install -dv /tmp/log-init &&
+ln -v -sf /tmp/log-init/init.log /var/log/init.log &&
+
+install -dv /usr/share/pixmaps &&
+install -dv /usr/local/share/pixmaps
+
+# Return with last error...
+exit $?
diff --git a/stage2/misc/DIR_COLORS b/stage2/misc/DIR_COLORS
new file mode 100644 (file)
index 0000000..8a6e26b
--- /dev/null
@@ -0,0 +1,73 @@
+# Configuration file for the color ls utility
+# This file goes in the /etc directory, and must be world readable.
+# You can copy this file to .dir_colors in your $HOME directory to override
+# the system defaults.
+
+# COLOR needs one of these arguments: 'tty' colorizes output to ttys, but not
+# pipes. 'all' adds color characters to all output. 'none' shuts colorization
+# off.
+COLOR tty
+
+# Below, there should be one TERM entry for each termtype that is colorizable
+TERM linux
+TERM console
+TERM con132x25
+TERM con132x30
+TERM con132x43
+TERM con132x60
+TERM con80x25
+TERM con80x28
+TERM con80x30
+TERM con80x43
+TERM con80x50
+TERM con80x60
+TERM xterm
+TERM vt100
+
+# EIGHTBIT, followed by '1' for on, '0' for off. (8-bit output)
+EIGHTBIT 1
+
+# Below are the color init strings for the basic file types. A color init
+# string consists of one or more of the following numeric codes:
+# Attribute codes: 
+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+# Text color codes:
+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+# Background color codes:
+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+NORMAL  00          # global default, although everything should be something.
+FILE    00          # normal file
+CHR     01;31       # character device driver
+FIFO    00;33;40    # pipe
+DIR     01;34       # directory
+EXEC    00;35       # files with execute permission:
+SOCK    01;35;04    # socket
+LINK    01;36       # symbolic link
+BLK     01;37       # block device driver
+ORPHAN  01;05;37;41 # orphaned syminks
+MISSING 01;05;37;41 # ... and the files they point to
+
+# List any file extensions like '.gz' or '.tar' that you would like ls
+# to colorize below. Put the extension, a space, and the color init string.
+# (and any comments you want to add after a '#')
+.cmd 00;35 # executables (bright green)
+.exe 00;35
+.com 00;35
+.btm 00;35
+.bat 00;35
+.tar 01;31 # archives or compressed (bright red)
+.tgz 01;31
+.bz2 01;31
+.arj 01;31
+.taz 01;31
+.lzh 01;31
+.zip 01;31
+.z   01;31
+.Z   01;31
+.gz  01;31
+.jpg 01;35 # image formats
+.gif 01;35;47
+.bmp 01;35
+.xbm 01;35
+.xpm 01;35
+.patch 04;31
diff --git a/stage2/misc/compressdoc b/stage2/misc/compressdoc
new file mode 100755 (executable)
index 0000000..b096d50
--- /dev/null
@@ -0,0 +1,465 @@
+#!/bin/bash
+# VERSION: 20050112.0027
+#
+# Compress (with bzip2 or gzip) all man pages in a hierarchy and
+# update symlinks - By Marc Heerdink <marc @ koelkast.net>
+#
+# Modified to be able to gzip or bzip2 files as an option and to deal
+# with all symlinks properly by Mark Hymers <markh @ linuxfromscratch.org>
+#
+# Modified 20030930 by Yann E. Morin <yann.morin.1998 @ anciens.enib.fr>
+# to accept compression/decompression, to correctly handle hard-links,
+# to allow for changing hard-links into soft- ones, to specify the
+# compression level, to parse the man.conf for all occurrences of MANPATH,
+# to allow for a backup, to allow to keep the newest version of a page.
+#
+# Modified 20040330 by Tushar Teredesai to replace $0 by the name of the 
+# script.
+#   (Note: It is assumed that the script is in the user's PATH)
+#
+# Modified 20050112 by Randy McMurchy to shorten line lengths and
+# correct grammar errors.
+#
+# TODO:
+#     - choose a default compress method to be based on the available
+#       tool : gzip or bzip2;
+#     - offer an option to automagically choose the best compression 
+#       methed on a per page basis (eg. check which of 
+#       gzip/bzip2/whatever is the most effective, page per page);
+#     - when a MANPATH env var exists, use this instead of /etc/man.conf
+#       (useful for users to (de)compress their man pages;
+#     - offer an option to restore a previous backup;
+#     - add other compression engines (compress, zip, etc?). Needed?
+
+# Funny enough, this function prints some help.
+function help ()
+{
+  if [ -n "$1" ]; then
+    echo "Unknown option : $1"
+  fi
+  ( echo "Usage: $MY_NAME <comp_method> [options] [dirs]" && \
+  cat << EOT
+Where comp_method is one of :
+  --gzip, --gz, -g
+  --bzip2, --bz2, -b
+                Compress using gzip or bzip2.
+
+  --decompress, -d
+                Decompress the man pages.
+
+  --backup      Specify a .tar backup shall be done for all directories.
+                In case a backup already exists, it is saved as .tar.old 
+                prior to making the new backup. If a .tar.old backup 
+                exists, it is removed prior to saving the backup.
+                In backup mode, no other action is performed.
+
+And where options are :
+  -1 to -9, --fast, --best
+                The compression level, as accepted by gzip and bzip2. 
+                When not specified, uses the default compression level 
+                for the given method (-6 for gzip, and -9 for bzip2). 
+                Not used when in backup or decompress modes.
+
+  --force, -F   Force (re-)compression, even if the previous one was 
+                the same method. Useful when changing the compression 
+                ratio. By default, a page will not be re-compressed if 
+                it ends with the same suffix as the method adds 
+                (.bz2 for bzip2, .gz for gzip).
+
+  --soft, -S    Change hard-links into soft-links. Use with _caution_ 
+                as the first encountered file will be used as a 
+                reference. Not used when in backup mode.
+
+  --hard, -H    Change soft-links into hard-links. Not used when in 
+                backup mode.
+
+  --conf=dir, --conf dir
+                Specify the location of man.conf. Defaults to /etc.
+
+  --verbose, -v Verbose mode, print the name of the directory being 
+                processed. Double the flag to turn it even more verbose, 
+                and to print the name of the file being processed.
+
+  --fake, -f    Fakes it. Print the actual parameters compman will use.
+
+  dirs          A list of space-separated _absolute_ pathnames to the 
+                man directories. When empty, and only then, parse 
+                ${MAN_CONF}/man.conf for all occurrences of MANPATH.
+
+Note about compression:
+  There has been a discussion on blfs-support about compression ratios of
+  both gzip and bzip2 on man pages, taking into account the hosting fs,
+  the architecture, etc... On the overall, the conclusion was that gzip
+  was much more efficient on 'small' files, and bzip2 on 'big' files, 
+  small and big being very dependent on the content of the files.
+
+  See the original post from Mickael A. Peters, titled 
+  "Bootable Utility CD", dated 20030409.1816(+0200), and subsequent posts:
+  http://linuxfromscratch.org/pipermail/blfs-support/2003-April/038817.html
+
+  On my system (x86, ext3), man pages were 35564KB before compression. 
+  gzip -9 compressed them down to 20372KB (57.28%), bzip2 -9 got down to 
+  19812KB (55.71%). That is a 1.57% gain in space. YMMV.
+
+  What was not taken into consideration was the decompression speed. But 
+  does it make sense to? You gain fast access with uncompressed man 
+  pages, or you gain space at the expense of a slight overhead in time. 
+  Well, my P4-2.5GHz does not even let me notice this... :-)
+
+EOT
+) | less
+}
+
+# This function checks that the man page is unique amongst bzip2'd, 
+# gzip'd and uncompressed versions.
+#  $1 the directory in which the file resides
+#  $2 the file name for the man page
+# Returns 0 (true) if the file is the latest and must be taken care of, 
+# and 1 (false) if the file is not the latest (and has therefore been 
+# deleted).
+function check_unique ()
+{
+  # NB. When there are hard-links to this file, these are
+  # _not_ deleted. In fact, if there are hard-links, they
+  # all have the same date/time, thus making them ready
+  # for deletion later on.
+
+  # Build the list of all man pages with the same name
+  DIR=$1
+  BASENAME=`basename "${2}" .bz2`
+  BASENAME=`basename "${BASENAME}" .gz`
+  GZ_FILE="$BASENAME".gz
+  BZ_FILE="$BASENAME".bz2
+
+  # Look for, and keep, the most recent one
+  LATEST=`(cd "$DIR"; ls -1rt "${BASENAME}" "${GZ_FILE}" "${BZ_FILE}" \
+         2>/dev/null | tail -n 1)`
+  for i in "${BASENAME}" "${GZ_FILE}" "${BZ_FILE}"; do
+    [ "$LATEST" != "$i" ] && rm -f "$DIR"/"$i"
+  done
+
+  # In case the specified file was the latest, return 0
+  [ "$LATEST" = "$2" ] && return 0
+  # If the file was not the latest, return 1
+  return 1
+}
+
+# Name of the script
+MY_NAME=`basename $0`
+
+# OK, parse the command-line for arguments, and initialize to some 
+# sensible state, that is: don't change links state, parse 
+# /etc/man.conf, be most silent, search man.conf in /etc, and don't 
+# force (re-)compression.
+COMP_METHOD=
+COMP_SUF=
+COMP_LVL=
+FORCE_OPT=
+LN_OPT=
+MAN_DIR=
+VERBOSE_LVL=0
+BACKUP=no
+FAKE=no
+MAN_CONF=/etc
+while [ -n "$1" ]; do
+  case $1 in
+    --gzip|--gz|-g)
+      COMP_SUF=.gz
+      COMP_METHOD=$1
+      shift
+      ;;
+    --bzip2|--bz2|-b)
+      COMP_SUF=.bz2
+      COMP_METHOD=$1
+      shift
+      ;;
+    --decompress|-d)
+      COMP_SUF=
+      COMP_LVL=
+      COMP_METHOD=$1
+      shift
+      ;;
+    -[1-9]|--fast|--best)
+      COMP_LVL=$1
+      shift
+      ;;
+    --force|-F)
+      FORCE_OPT=-F
+      shift
+      ;;
+    --soft|-S)
+      LN_OPT=-S
+      shift
+      ;;
+    --hard|-H)
+      LN_OPT=-H
+      shift
+      ;;
+    --conf=*)
+      MAN_CONF=`echo $1 | cut -d '=' -f2-`
+      shift
+      ;;
+    --conf)
+      MAN_CONF="$2"
+      shift 2
+      ;;
+    --verbose|-v)
+      let VERBOSE_LVL++
+      shift
+      ;;
+    --backup)
+      BACKUP=yes
+      shift
+      ;;
+    --fake|-f)
+      FAKE=yes
+      shift
+      ;;
+    --help|-h)
+      help
+      exit 0
+      ;;
+    /*)
+      MAN_DIR="${MAN_DIR} ${1}"
+      shift
+      ;;
+    -*)
+      help $1
+      exit 1
+      ;;
+    *)
+      echo "\"$1\" is not an absolute path name" 
+      exit 1
+      ;;
+  esac
+done
+
+# Redirections
+case $VERBOSE_LVL in
+  0)
+     # O, be silent
+     DEST_FD0=/dev/null
+     DEST_FD1=/dev/null
+     VERBOSE_OPT=
+     ;;
+  1)
+     # 1, be a bit verbose
+     DEST_FD0=/dev/stdout
+     DEST_FD1=/dev/null
+     VERBOSE_OPT=-v
+     ;;
+  *)
+     # 2 and above, be most verbose
+     DEST_FD0=/dev/stdout
+     DEST_FD1=/dev/stdout
+     VERBOSE_OPT="-v -v"
+     ;;
+esac
+
+# Note: on my machine, 'man --path' gives /usr/share/man twice, once 
+# with a trailing '/', once without.
+if [ -z "$MAN_DIR" ]; then
+  MAN_DIR=`man --path -C "$MAN_CONF"/man.conf \
+            | sed 's/:/\\n/g' \
+            | while read foo; do dirname "$foo"/.; done \
+            | sort -u \
+            | while read bar; do echo -n "$bar "; done`
+fi
+
+# If no MANPATH in ${MAN_CONF}/man.conf, abort as well
+if [ -z "$MAN_DIR" ]; then
+  echo "No directory specified, and no directory found with \`man --path'"
+  exit 1
+fi
+
+# Fake?
+if [ "$FAKE" != "no" ]; then
+  echo "Actual parameters used:"
+  echo -n "Compression.......: "
+  case $COMP_METHOD in
+    --bzip2|--bz2|-b) echo -n "bzip2";;
+    --gzip|__gz|-g) echo -n "gzip";;
+    --decompress|-d) echo -n "decompressing";;
+    *) echo -n "unknown";;
+  esac
+  echo " ($COMP_METHOD)"
+  echo "Compression level.: $COMP_LVL"
+  echo "Compression suffix: $COMP_SUF"
+  echo -n "Force compression.: "
+  [ "foo$FORCE_OPT" = "foo-F" ] && echo "yes" || echo "no"
+  echo "man.conf is.......: ${MAN_CONF}/man.conf"
+  echo -n "Hard-links........: "
+  [ "foo$LN_OPT" = "foo-S" ] && 
+  echo "convert to soft-links" || echo "leave as is"
+  echo -n "Soft-links........: "
+  [ "foo$LN_OPT" = "foo-H" ] && 
+  echo "convert to hard-links" || echo "leave as is"
+  echo "Backup............: $BACKUP"
+  echo "Faking (yes!).....: $FAKE"
+  echo "Directories.......: $MAN_DIR"
+  echo "Verbosity level...: $VERBOSE_LVL"
+  exit 0
+fi
+
+# If no method was specified, print help
+if [ -z "${COMP_METHOD}" -a "${BACKUP}" = "no" ]; then
+  help
+  exit 1
+fi
+
+# In backup mode, do the backup solely
+if [ "$BACKUP" = "yes" ]; then
+  for DIR in $MAN_DIR; do
+    cd "${DIR}/.."
+    DIR_NAME=`basename "${DIR}"`
+    echo "Backing up $DIR..." > $DEST_FD0
+    [ -f "${DIR_NAME}.tar.old" ] && rm -f "${DIR_NAME}.tar.old"
+    [ -f "${DIR_NAME}.tar" ] && 
+    mv "${DIR_NAME}.tar" "${DIR_NAME}.tar.old"
+    tar -cfv "${DIR_NAME}.tar" "${DIR_NAME}" > $DEST_FD1
+  done
+  exit 0
+fi
+
+# I know MAN_DIR has only absolute path names
+# I need to take into account the localized man, so I'm going recursive
+for DIR in $MAN_DIR; do
+  MEM_DIR=`pwd`
+  cd "$DIR"
+  for FILE in *; do
+    # Fixes the case were the directory is empty
+    if [ "foo$FILE" = "foo*" ]; then continue; fi
+
+    # Fixes the case when hard-links see their compression scheme change
+    # (from not compressed to compressed, or from bz2 to gz, or from gz 
+    # to bz2)
+    # Also fixes the case when multiple version of the page are present, 
+    # which are either compressed or not.
+    if [ ! -L "$FILE" -a ! -e "$FILE" ]; then continue; fi
+
+    # Do not compress whatis files
+    if [ "$FILE" = "whatis" ]; then continue; fi
+
+    if [ -d "$FILE" ]; then
+      cd "${MEM_DIR}"  # Go back to where we ran "$0", 
+                       # in case "$0"=="./compressdoc" ...
+      # We are going recursive to that directory
+      echo "-> Entering ${DIR}/${FILE}..." > $DEST_FD0
+      # I need not pass --conf, as I specify the directory to work on
+      # But I need exit in case of error
+      "$MY_NAME" ${COMP_METHOD} ${COMP_LVL} ${LN_OPT} ${VERBOSE_OPT} \
+      ${FORCE_OPT} "${DIR}/${FILE}" || exit 1
+      echo "<- Leaving ${DIR}/${FILE}." > $DEST_FD1
+      cd "$DIR"  # Needed for the next iteration of the loop
+
+    else # !dir
+      if ! check_unique "$DIR" "$FILE"; then continue; fi
+
+      # Check if the file is already compressed with the specified method
+      BASE_FILE=`basename "$FILE" .gz`
+      BASE_FILE=`basename "$BASE_FILE" .bz2`
+      if [ "${FILE}" = "${BASE_FILE}${COMP_SUF}" \
+         -a "foo${FORCE_OPT}" = "foo" ]; then continue; fi
+
+      # If we have a symlink
+      if [ -h "$FILE" ]; then
+        case "$FILE" in
+          *.bz2)
+            EXT=bz2 ;;
+          *.gz)
+            EXT=gz ;;
+          *)
+            EXT=none ;;
+        esac
+
+        if [ ! "$EXT" = "none" ]; then
+          LINK=`ls -l "$FILE" | cut -d ">" -f2 \
+               | tr -d " " | sed s/\.$EXT$//`
+          NEWNAME=`echo "$FILE" | sed s/\.$EXT$//`
+          mv "$FILE" "$NEWNAME"
+          FILE="$NEWNAME"
+        else
+          LINK=`ls -l "$FILE" | cut -d ">" -f2 | tr -d " "`
+        fi
+
+        if [ "$LN_OPT" = "-H" ]; then
+          # Change this soft-link into a hard- one
+          rm -f "$FILE" && ln "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
+          chmod --reference "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
+        else
+          # Keep this soft-link a soft- one.
+          rm -f "$FILE" && ln -s "${LINK}$COMP_SUF" "${FILE}$COMP_SUF"
+        fi
+        echo "Relinked $FILE" > $DEST_FD1
+
+      # else if we have a plain file
+      elif [ -f "$FILE" ]; then
+        # Take care of hard-links: build the list of files hard-linked
+        # to the one we are {de,}compressing.
+        # NB. This is not optimum has the file will eventually be 
+        # compressed as many times it has hard-links. But for now, 
+        # that's the safe way.
+        inode=`ls -li "$FILE" | awk '{print $1}'`
+        HLINKS=`find . \! -name "$FILE" -inum $inode`
+
+        if [ -n "$HLINKS" ]; then
+          # We have hard-links! Remove them now.
+          for i in $HLINKS; do rm -f "$i"; done
+        fi
+
+        # Now take care of the file that has no hard-link
+        # We do decompress first to re-compress with the selected
+        # compression ratio later on...
+        case "$FILE" in
+          *.bz2)
+            bunzip2 $FILE
+            FILE=`basename "$FILE" .bz2`
+          ;;
+          *.gz)
+            gunzip $FILE
+            FILE=`basename "$FILE" .gz`
+          ;;
+        esac
+
+        # Compress the file with the given compression ratio, if needed
+        case $COMP_SUF in
+          *bz2)
+            bzip2 ${COMP_LVL} "$FILE" && chmod 644 "${FILE}${COMP_SUF}"
+            echo "Compressed $FILE" > $DEST_FD1
+            ;;
+          *gz)
+            gzip ${COMP_LVL} "$FILE" && chmod 644 "${FILE}${COMP_SUF}"
+            echo "Compressed $FILE" > $DEST_FD1
+            ;;
+          *)
+            echo "Uncompressed $FILE" > $DEST_FD1
+            ;;
+        esac
+
+        # If the file had hard-links, recreate those (either hard or soft)
+        if [ -n "$HLINKS" ]; then
+          for i in $HLINKS; do
+            NEWFILE=`echo "$i" | sed s/\.gz$// | sed s/\.bz2$//`
+            if [ "$LN_OPT" = "-S" ]; then
+              # Make this hard-link a soft- one
+              ln -s "${FILE}$COMP_SUF" "${NEWFILE}$COMP_SUF"
+            else
+              # Keep the hard-link a hard- one
+              ln "${FILE}$COMP_SUF" "${NEWFILE}$COMP_SUF"
+            fi
+            # Really work only for hard-links. Harmless for soft-links
+            chmod 644 "${NEWFILE}$COMP_SUF"
+          done
+        fi
+
+      else
+        # There is a problem when we get neither a symlink nor a plain 
+        # file. Obviously, we shall never ever come here... :-(
+        echo -n "Whaooo... \"${DIR}/${FILE}\" is neither a symlink "
+        echo "nor a plain file. Please check:"
+        ls -l "${DIR}/${FILE}"
+        exit 1
+      fi
+    fi
+  done # for FILE
+done # for DIR
diff --git a/stage2/packages-update b/stage2/packages-update
new file mode 100755 (executable)
index 0000000..2820e42
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+LFS_STAGE="stage2"
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../functions-update
+source ../packages-list
+
+update_packages_init
+
+# Begin
+
+# These packages are needed first for stage1:
+lpkg     1 ${BINUTILS}
+lpkg     1 ${GCC_CORE}
+lpkg     1 ${KERNEL}
+lpkg     1 ${GLIBC}
+lpkg     1 ${NCURSES}
+lpkg     1 ${BASH}
+lpkg     1 ${BZIP2}
+lpkg     1 ${COREUTILS}
+lpkg     1 ${DIFFUTILS}
+lpkg     1 ${FINDUTILS}
+lpkg     1 ${GAWK}
+lpkg     1 ${GETTEXT}
+lpkg     1 ${GREP}
+lpkg     1 ${GZIP}
+lpkg     1 ${MAKE_PACKAGE}
+lpkg     1 ${PATCH_PACKAGE}
+lpkg     1 ${PERL}
+lpkg     1 ${SED}
+lpkg     1 ${TAR_PACKAGE}
+lpkg     1 ${TEXINFO}
+lpkg     1 ${UTIL_LINUX}
+
+# These packages are only for stage2
+fpkg       ${MANPAGES} http://www.kernel.org/pub/linux/docs/manpages
+fpkg       ${DB4} http://download.oracle.com/berkeley-db
+fpkg_sf    ${E2FSPROGS}
+fpkg       ${IANA} http://www.sethwklein.net/projects/iana-etc/downloads
+fpkg_gnu   ${MFOUR}
+fpkg_gnu   ${BISON}
+fpkg       ${PROCPS} http://procps.sourceforge.net
+fpkg_gnu   ${LIBTOOL}
+fpkg_gnu   ${READLINE}
+fpkg       ${ZLIB} http://www.zlib.net
+fpkg_gnu   ${AUTOCONF}
+fpkg_gnu   ${AUTOMAKE}
+
+fpkg       ${LESS} http://www.greenwoodsoftware.com/less
+fpkg_gnu   ${GROFF}
+fpkg_sf    ${FLEX}
+fpkg_gnu   ${INETUTILS}
+fpkg_hv    ${IPROUTE2}
+fpkg_lfs   ${FILE_PKG} "file"
+fpkg       ${KBD} http://www.kernel.org/pub/linux/utils/kbd
+fpkg       ${GRUB} ftp://alpha.gnu.org/gnu/grub
+fpkg       ${MAN} http://primates.ximian.com/~flucifredi/man
+fpkg       ${MKTEMP} ftp://ftp.mktemp.org/pub/mktemp
+fpkg       ${MODULE_INIT_TOOLS} http://www.kernel.org/pub/linux/utils/kernel/module-init-tools
+fpkg_sf    ${PSMISC}
+fpkg_hv    ${SHADOW}
+fpkg       ${SYSKLOGD} http://www.infodrom.org/projects/sysklogd/download
+fpkg       ${SYSVINIT} ftp://ftp.cistron.nl/pub/people/miquels/sysvinit
+fpkg       ${UDEV} http://www.kernel.org/pub/linux/utils/kernel/hotplug
+fpkg_lfs   ${UDEV_CONFIG}
+
+# Additional packages (not in original LFS, only for hvlinux).
+fpkg       ${NANO} http://www.nano-editor.org/dist/v2.0
+fpkg_hv    ${REISERFSPROGS}
+fpkg       ${PAM} http://www.kernel.org/pub/linux/libs/pam/pre/library
+fpkg       ${OPENSSL} ftp://ftp.openssl.org/source
+fpkg       ${OPENSSH} ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
+fpkg       ${DHCP} ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history
+fpkg       ${NFS_UTILS} ftp://ftp.kernel.org/pub/linux/utils/nfs
+fpkg_gnu   ${WHICH}
+fpkg       ${TCPWRAPPERS} ftp://ftp.porcupine.org/pub/security
+fpkg       ${APR}      http://apache.sunsite.ualberta.ca/apr
+fpkg_sf    ${EXPAT}
+fpkg       ${APR_UTIL} http://apache.sunsite.ualberta.ca/apr
+fpkg       ${NEON}      http://www.webdav.org/neon
+fpkg       ${SUBVERSION} http://subversion.tigris.org/downloads
+fpkg       ${SUDO} http://www.courtesan.com/sudo/dist
+fpkg       ${PKG_CONFIG} http://pkgconfig.freedesktop.org/releases
+fpkg       ${NET_TOOLS} http://www.tazenda.demon.co.uk/phil/net-tools
+fpkg_hv    ${POPT}
+fpkg_hv    ${PORTMAP}
+fpkg_gnu   ${EMACS}
+
+fpkg_gnu   ${WGET}
+fpkg       ${PCIUTILS} ftp://ftp.kernel.org/pub/software/utils/pciutils
+
+fpkg_lfs   ${LFS_BOOTSCRIPTS}
+
+# Return last error
+exit $?
diff --git a/stage2/setup b/stage2/setup
new file mode 100755 (executable)
index 0000000..05de721
--- /dev/null
@@ -0,0 +1,66 @@
+#!/tools/bin/sh
+
+# The first argument to the setup script is the working directory.
+cd ${1}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage2"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage2
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+init_log_file
+
+run_cmd_log    "Changing ownership of /tools files to root" chown -R 0:0 /tools &&
+run_script_log "Creating basic directory structure" makedir &&
+
+# The first mode change ensures that not just everybody can enter the /root
+# directory -- the same as a normal user would do with his or her home
+# directory. The second mode change makes sure that any user can write to the
+# /tmp and /var/tmp directories, but cannot remove other users' files from them.
+# The latter is prohibited by the so-called "sticky bit" -- the highest bit in
+# the 1777 bit mask.
+run_cmd_log "Setting permissions for /root" chmod 0750 /root &&
+run_cmd_log "Setting permissions for /tmp and /var/tmp" \
+    chmod 1777 /tmp /var/tmp &&
+
+# To remove the warning message:
+#     "warning: can't open /etc/fstab: No such file or directory"
+touch /etc/fstab &&
+# We must use the -n option. If not, a regular "/etc/mtab" file will be created,
+# and the mtab link we try to create later will not work.
+action_checkbox "Mounting the /proc filesystem" mount -n proc /proc -t proc &&
+
+action_checkbox "Mounting the /dev/pts filesystem" \
+    mount -n -t devpts -o gid=4,mode=620 none /dev/pts &&
+
+run_script_log "Creating essential symlinks" symlinks &&
+run_script_log "Creating default groups" create-groups &&
+run_script_log "Creating default users" create-users &&
+
+run_script_log "Creating default configuration files" create-config-files &&
+
+touch /var/run/utmp &&
+touch /var/log/{btmp,lastlog,wtmp} &&
+chgrp utmp /var/run/utmp /var/log/lastlog /var/log/btmp &&
+chmod 664  /var/run/utmp /var/log/lastlog &&
+chmod 600  /var/log/btmp &&
+
+# Executing the install-1 script
+./install-1
+
+last_error=$?
+
+umount /dev/pts
+umount proc
+
+
+if [ $? != 0 -o ${last_error} != 0 ]; then
+    exit 1
+fi
+
+exit 0
diff --git a/stage2/stage2-additions b/stage2/stage2-additions
new file mode 100755 (executable)
index 0000000..5758270
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# System configuration informations (entered by the user)
+source ../sysinfos
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage2"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage2
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+source ../functions
+
+# Name and version of all packages to install
+source ../packages-list
+
+# Init log file
+mkdir -p ${LFS_LOG_DIR} &&
+if [ ! -f ${LFS_LOG_FILE} ]; then
+    touch ${LFS_LOG_FILE} || exit 1
+fi
+
+ipkg_ac        ${AUTOMAKE}
+run_script_log  "Installing HV-utilities" cis-hv-utilities
+
+# Return last error
+exit $?
diff --git a/stage2/stage2-install b/stage2/stage2-install
new file mode 100755 (executable)
index 0000000..f9d0058
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# System configuration informations (entered by the user)
+source ../sysinfos
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+# Finding the path, relative to ${LFS} of the sources directory.
+S1=$(pwd)
+CHROOT_WD=${S1#${LFS}}
+
+# We need /dev/null and /dev/console before udev is started.
+mkdir -p ${LFS}/dev &&
+if [ ! -c ${LFS}/dev/null ]; then
+    mknod ${LFS}/dev/null -m 0666 c 1 3 || exit 1
+fi
+if [ ! -c ${LFS}/dev/console ]; then
+    mknod ${LFS}/dev/console -m 0666 c 5 1 || exit 1
+fi
+
+# Mounting and populating /dev for the chroot environment.
+# May fail if it is already mountewd, but it is ok.
+mount -v --bind /dev ${LFS}/dev 1> /dev/null 2>&1
+
+# If something went wrong, proc, dev and devpts may still be mounted.
+umount -n ${LFS}/proc 1> /dev/null 2>&1
+umount -n ${LFS}/dev/pts 1> /dev/null 2>&1
+
+# Making sure that if a separate boot partition is defined, it is mounted.
+if [ -n "${BOOT_PARTITION}" ]; then
+    if ! grep "${BOOT_PARTITION}" /etc/mtab | grep "${LFS}/boot" 1> /dev/null 2>&1; then
+       echo "You defined \"${BOOT_PARTITION}\" as your boot partition,"
+       echo "but it is not mounted in your LFS partition. You must"
+       echo "mount it before running this script again."
+       exit 1;
+    fi
+fi
+
+# Option '-i' of env starts with a new environment.
+# The argument to the setup script is the working directory.
+chroot ${LFS} /tools/bin/env -i \
+    HOME=/root \
+    TERM=$TERM \
+    PS1='\u:\w\$ ' \
+    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
+    /tools/bin/bash -c "${CHROOT_WD}/setup ${CHROOT_WD}"
+
+# Unmounting /dev for the chroot environment.
+umount ${LFS}/dev
+
+# At the end, we should remove the '/tools' directory
+# mv /mnt/linux/tools /mnt/linux/tmp
+
+exit $?
diff --git a/stage2/symlinks b/stage2/symlinks
new file mode 100755 (executable)
index 0000000..cf1e175
--- /dev/null
@@ -0,0 +1,23 @@
+#!/tools/bin/sh
+
+# System configuration informations (entered by the user)
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Some programs hard-wire paths to programs which don't exist yet. In order to
+# satisfy these programs, we create a number of symbolic links which will be
+# replaced by real files when we're installing all the software.
+
+# We must not use "-sf" to force the creation of a symlink, because we don't want
+# to write over a valid program if the install script needs to be re-started.
+
+# Creating the /etc/mtab symlink
+ln -s /proc/mounts /etc/mtab
+
+ln -s /tools/bin/{bash,cat,pwd,stty} /bin
+ln -s /tools/bin/perl /usr/bin
+ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib
+ln -s bash /bin/sh
+
+exit 0
diff --git a/stage3/INSTALL b/stage3/INSTALL
new file mode 100644 (file)
index 0000000..dccb97e
--- /dev/null
@@ -0,0 +1,5 @@
+
+Installation instructions
+-------------------------
+
+1. ./stage3-install
diff --git a/stage3/TODO b/stage3/TODO
new file mode 100644 (file)
index 0000000..d90b860
--- /dev/null
@@ -0,0 +1,62 @@
+
+                      TODO
+
+Installer websvn
+Créer template de apsswd file pour svn (/etc/apache/security/svn/passwd)
+Utiliser l'usager svn au lieu de apache pour svn
+
+dhcpcd: -Au restart, attendre que le précédent 'dhcpcd' daemon ait terminé
+         (voir exemple dans le script /etc/rc.d/init.d/mysql)
+        -Ne pas utiliser l'option -K au shutdown (efface le cache); mais c'est
+         pas grave car ddclient a aussi une cache. Force removal of ddclient cache
+         each time?
+
+clamav: la première fois qu'on démarre clam-av, il faut appeler
+        fresh-clam pour construire la base de données dans /var/clamav
+
+sysinfos: Add PRINTER_SUPPORT="yes/no"
+
+BIND server: root.hints must be updated periodically with the
+             "dig" utility (use fcron job).
+
+XF86: Clavier selon sysinfos, et aussi loadkeys selon sysinfos. Combiner
+      les deux variables en une seule (utiliser un tableau pour sélectionner
+      ensuite les deux valeurs distinctes).
+
+Server: install Lynx text-based browser
+
+Créer un répertoire unique pour les icons et copier tous les icons dedans
+"/usr/share/icons" par exemple.
+
+install bitstream vera fonts and update fontconfig conf. file.
+
+ttmkfontdir: Problèmes de compilation avec freetype2.
+
+ipkg failure: afficher les 10 dernières lignes du logfile...
+
+Ethereal (après GLIB)
+
+Server, install:
+  Tuner correctement le firewall + blocker tous les ports sauf 2525, 8080, 22 et 993
+  Problem with firewall (even when stopping it, access is still denied).
+  DNS server
+
+junkbuster:
+  "install junkbuster /usr/local/bin"
+  copier le répertoire "junkbuster" dans /etc
+
+sane: create a link: /dev/scanner --> /dev/sg0 ???
+
+samba:
+   -faire "net join -S SERVEUR -u hvilleneuve"
+   -compiler module CIFS (Network File System)
+   -Installer mount utility pour CIFS:
+      $> gcc -o mount.cifs mount.cifs.c
+      $> install mount.cifs /sbin
+      $> ln -s /sbin/mount.cifs /usr/bin/cifsmount
+   -Add entry for Windows server in /etc/hosts:
+        192.168.16.2 Serveur
+   -smbclient //Serveur//LexmarkE -Uhvilleneuve -C "put file.ps"
+   -CUPS: sélectionner Add Printer, HP LaserJet
+      dans /etc/cups/client.conf, ajouter:
+           ServerName localhost
diff --git a/stage3/bootscripts/alsa b/stage3/bootscripts/alsa
new file mode 100755 (executable)
index 0000000..c0de296
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# alsa
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+alsactl=/usr/sbin/alsactl
+
+# See how we were called.
+case "$1" in
+    start)
+       cmd_run_log_box "Loading sound settings" ${alsactl} restore
+       ;;
+
+    stop)
+       cmd_run_log_box "Saving sound settings" ${alsactl} store
+       ;;
+    
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit ${EXIT_CODE_FAILURE}
+        ;;
+    
+esac
+
+exit 0
diff --git a/stage3/bootscripts/apache b/stage3/bootscripts/apache
new file mode 100755 (executable)
index 0000000..773839d
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# apache
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+APACHECTL=/usr/sbin/apachectl
+
+# Check that the ifconfig program is present and executable.
+if [ ! -x ${APACHECTL} ]; then
+    log_message "*** ERROR: ${APACHECTL} program not found."
+    exit ${EXIT_CODE_FAILURE}
+fi
+
+case "$1" in
+    start)
+       cmd_run_log_box "Starting Apache server" ${APACHECTL} -k start
+       ;;
+    
+    stop)
+       cmd_run_log_box "Stopping Apache server" ${APACHECTL} -k stop
+       ;;
+    
+    restart)
+       cmd_run_log_box "Re-starting Apache server" ${APACHECTL} -k restart
+       ;;
+
+    status)
+       statusproc httpd
+       ;;
+
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+    
+esac
+
+exit $?
diff --git a/stage3/bootscripts/clamav b/stage3/bootscripts/clamav
new file mode 100755 (executable)
index 0000000..5ffe846
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# clamav
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+SOCKET_DIR="/var/run/clamav"
+
+start()
+{
+    if statusproc clamd | grep "not running" 1> /dev/null 2>&1; then
+       # Not taking any chances, removing left-over files
+       rm -f ${SOCKET_DIR}/clamd.{sock,pid} || return 1
+    fi
+    loadproc /usr/sbin/clamd || return 1
+
+    sleep 1
+
+    if statusproc clamav-milter | grep "not running" 1> /dev/null 2>&1; then
+       # Not taking any chances, removing left-over files
+       rm -f ${SOCKET_DIR}/clmilter.sock || return 1
+    fi
+    # Option "--postmaster-only" is to send warnings only to postmaster.
+    loadproc /usr/sbin/clamav-milter --local --outgoing --headers --postmaster-only ${SOCKET_DIR}/clmilter.sock
+
+    return $?
+}
+
+stop()
+{
+    killproc clamd &&
+    killproc clamav-milter
+
+    return $?
+}
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Clam AntiVirus start" start
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "Clam AntiVirus stop" stop
+        ;;
+                
+    status)
+        statusproc clamd
+        statusproc clamav-milter
+        ;;
+    
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/cups b/stage3/bootscripts/cups
new file mode 100755 (executable)
index 0000000..77345d6
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# cups
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "CUPS start" loadproc cupsd
+       ;;
+
+    stop)
+       cmd_run_log_box_warn "CUPS stop" killproc cupsd
+       ;;
+   
+    reload)
+       cmd_run_log_box_warn "CUPS reload" reloadproc cupsd
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+
+    status)
+       statusproc cupsd
+       ;;
+    
+    *)
+       echo "Usage: $0 {reload|restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/dbus b/stage3/bootscripts/dbus
new file mode 100755 (executable)
index 0000000..4c21ac8
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# dbus
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+dbus_start() {
+    if statusproc dbus-daemon | grep "not running" 1> /dev/null 2>&1; then
+       if [ -f /var/run/dbus/pid ]; then
+           rm /var/run/dbus/pid
+       fi
+       if [ -f /var/run/dbus/system_bus_socket ]; then
+           rm /var/run/dbus/system_bus_socket
+       fi
+    else
+       echo "Already running..."
+       return ${EXIT_CODE_WARNING}
+    fi
+    
+    loadproc /usr/bin/dbus-daemon --config-file=/etc/dbus-1/system.conf
+
+    return $?
+}
+
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "D-Bus Messagebus Daemon start" dbus_start
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "D-Bus Messagebus Daemon stop" killproc dbus-daemon &&
+       rm /var/run/dbus/pid &&
+       rm /var/run/dbus/system_bus_socket
+        ;;
+                
+    status)
+        statusproc dbus-daemon
+        ;;
+        
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/fcron b/stage3/bootscripts/fcron
new file mode 100755 (executable)
index 0000000..f6b1c46
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# fcron
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# See how we were called.
+case "$1" in
+    start)
+        cmd_run_log_box_warn "FCRON start" loadproc fcron -b -c /etc/fcron/fcron.conf
+        ;;
+    
+    stop)
+       cmd_run_log_box_warn "FCRON stop" killproc fcron
+        ;;
+    
+    reload)
+       cmd_run_log_box_warn "FCRON reload" reloadproc fcron
+        ;;
+    
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    status)
+        statusproc fcron
+        ;;
+    
+    *)
+        echo "Usage: $0 {start|stop|reload|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+        ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/firewall b/stage3/bootscripts/firewall
new file mode 100755 (executable)
index 0000000..da82d67
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/sh
+
+# firewall
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Load global network parameters
+source /etc/sysconfig/network/network-parameters
+
+if [ "x${FIREWALL_ENA}" != "xyes" -a "x${FIREWALL_ENA}" != "xYes" -a "x${FIREWALL_ENA}" != "xYES" ]; then
+    # Firewall is not enabled
+    msg_log "Firewall disabled in '/etc/sysconfig/network/network-parameters'"
+    exit ${EXIT_CODE_WARNING}
+fi
+
+# Setting the EXTERNAL and INTERNAL interfaces for the network
+# from values in /etc/sysconfig/network/network-parameters:
+INTERNET=${FIREWALL_WWW}
+INTRANET=${FIREWALL_LAN}
+
+firewall_start()
+{
+    # Insert iptables modules (not needed if built into the kernel).
+    modprobe ip_tables &&
+    modprobe iptable_filter &&
+    modprobe ip_conntrack &&
+    modprobe ip_conntrack_ftp &&
+    modprobe ipt_state &&
+    modprobe iptable_nat &&
+    modprobe ip_nat_ftp &&
+    modprobe ipt_MASQUERADE &&
+    modprobe ipt_LOG &&
+    modprobe ipt_REJECT &&
+
+    # Clearing any previous configuration.
+    #   Unless specified, the defaults for INPUT and OUTPUT is ACCEPT.
+    #   The default for FORWARD is REJECT.
+    iptables -F INPUT &&
+    iptables -F OUTPUT &&
+    iptables -F FORWARD &&
+    iptables -t nat -F &&
+
+    # Allow local-only connections
+    iptables -A INPUT  -i lo -j ACCEPT &&
+    iptables -A INPUT  -i ${INTRANET} -j ACCEPT &&
+    iptables -A INPUT  -i ${INTERNET} -j ACCEPT &&
+    iptables -A OUTPUT -o lo -j ACCEPT &&
+    iptables -A OUTPUT -o ${INTRANET} -j ACCEPT &&
+    iptables -A OUTPUT -o ${INTERNET} -j ACCEPT &&
+
+    # Allow forwarding
+    iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT &&
+    iptables -A FORWARD -m state --state NEW -i ! ${INTERNET}+ -j ACCEPT &&
+
+    # Do masquerading
+    iptables -t nat -A POSTROUTING -o ${INTERNET}+ -j MASQUERADE &&
+
+    # Log everything for debugging (last of all rules, but before DROP/REJECT)
+    iptables -A INPUT   -j LOG --log-prefix "FIREWALL:INPUT  " &&
+    iptables -A FORWARD -j LOG --log-prefix "FIREWALL:FORWARD" &&
+    iptables -A OUTPUT  -j LOG --log-prefix "FIREWALL:OUTPUT " &&
+
+    # Set a sane policy
+    iptables -P INPUT   DROP &&
+    iptables -P FORWARD DROP &&
+    iptables -P OUTPUT  DROP &&
+
+    # Be verbose on dynamic ip-addresses
+    #   If you get your IP address dynamically from SLIP, PPP, or DHCP, enable
+    #   this following option.  This enables dynamic-address hacking which
+    #   makes the life with Diald and similar programs much easier.
+    echo 2 > /proc/sys/net/ipv4/ip_dynaddr &&
+
+    # Disable ExplicitCongestionNotification
+    echo 0 > /proc/sys/net/ipv4/tcp_ecn &&
+
+    # Activate TCPsyncookies
+    echo 1 > /proc/sys/net/ipv4/tcp_syncookies
+
+    if [ $? -ne 0 ]; then
+       return 1
+    fi
+    
+    # Activate Route-Verification = IP-Spoofing_protection
+    for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
+       echo 1 > $f || return 1
+    done
+
+    # Activate IP-Forwarding
+    echo 1 > /proc/sys/net/ipv4/ip_forward
+
+    return $?
+}
+
+
+firewall_stop()
+{
+    # Deactivate IP-Forwarding
+    echo 0 > /proc/sys/net/ipv4/ip_forward &&
+
+    iptables -Z &&
+    iptables -F &&
+    iptables -t nat    -F PREROUTING &&
+    iptables -t nat    -F OUTPUT &&
+    iptables -t nat    -F POSTROUTING &&
+    iptables -t mangle -F PREROUTING &&
+    iptables -t mangle -F OUTPUT &&
+    iptables -X &&
+    iptables -P INPUT   ACCEPT &&
+    iptables -P FORWARD ACCEPT &&
+    iptables -P OUTPUT  ACCEPT
+
+    return $?
+}
+
+
+firewall_restart()
+{
+    firewall_stop &&
+    firewall_start
+    
+    return $?
+}
+
+
+firewall_status()
+{
+    echo "iptables.mangling:"
+    iptables -t mangle  -v -L -n --line-numbers
+    
+    echo
+    echo "iptables.nat:"
+    iptables -t nat    -v -L -n --line-numbers
+    
+    echo
+    echo "iptables.filter:"
+    iptables    -v -L -n --line-numbers
+}
+
+
+case "$1" in
+    start)
+       cmd_run_log_box "Starting Firewall" firewall_start
+       ;;
+    
+    stop)
+       cmd_run_log_box "Stopping Firewall" firewall_stop
+       ;;
+    
+    restart)
+       cmd_run_log_box "Restarting Firewall" firewall_restart
+       ;;
+    status)
+       firewall_status
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+    
+esac
+
+exit $?
diff --git a/stage3/bootscripts/firewire b/stage3/bootscripts/firewire
new file mode 100755 (executable)
index 0000000..d3aa2c0
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box "Enabling IEEE-1394 support" modprobe ieee1394
+       cmd_run_log_box "Enabling OHCI IEEE-1394 support" modprobe ohci1394
+       cmd_run_log_box "Enabling raw1394 library support" modprobe raw1394
+       sleep 1
+       cmd_run_log_box_warn "Starting IEC61883-1 fwplugd" /etc/rc.d/init.d/fwplugd start
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "Stopping IEC61883-1 fwplugd" /etc/rc.d/init.d/fwplugd stop
+       cmd_run_log_box "Disabling raw1394 library support" rmmod raw1394
+       cmd_run_log_box "Disabling OHCI IEEE-1394 support" rmmod ohci1394
+       cmd_run_log_box "Disabling IEEE-1394 support" rmmod ieee1394
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart}"
+       exit 1
+       ;;
+esac
+
+exit $?
+
diff --git a/stage3/bootscripts/fwplugd b/stage3/bootscripts/fwplugd
new file mode 100755 (executable)
index 0000000..ad0a96b
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+prefix=/usr/local
+exec_prefix=${prefix}
+
+# Checking if the fwplugd daemon is running.
+pid=`ps ax | awk '{if (match($5, ".*/fwplugd$") || $5 == "fwplugd") print $1}'`
+
+# See how we were called.
+case "$1" in
+    start)
+       if test "$pid" = ""; then
+            ${exec_prefix}/bin/fwplugd
+           if test $? != 0; then
+               echo "fwplugd: unable to start daemon."
+               exit 1
+           fi
+       else
+           echo "fwplugd: already running."
+           exit 1
+       fi
+       echo "fwplugd: started daemon."
+       ;;
+    
+    stop)
+       if test "$pid" != ""; then
+           kill $pid
+       else
+           echo "fwplugd: not running."
+           exit 1
+       fi
+       echo "fwplugd: stopped daemon."
+       ;;
+   
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    status)
+       if test "$pid" = ""; then
+           echo "fwplugd: not running."
+       else
+           echo "fwplugd: running."
+       fi
+        ;;
+    
+    *)
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 1
+        ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/hald b/stage3/bootscripts/hald
new file mode 100755 (executable)
index 0000000..623f5fb
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# hald
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "HAL Daemon start" loadproc /usr/sbin/hald --use-syslog
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "HAL Daemon stop" killproc /usr/sbin/hald
+        ;;
+    
+    status)
+        statusproc hald
+        ;;
+    
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/inetd b/stage3/bootscripts/inetd
new file mode 100755 (executable)
index 0000000..94fe326
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting inetd daemon" loadproc inetd
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "Stopping inetd daemon" killproc inetd
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    status)
+       statusproc inetd
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+    
+esac
+
+exit $?
diff --git a/stage3/bootscripts/mailman b/stage3/bootscripts/mailman
new file mode 100755 (executable)
index 0000000..89aa0fc
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# mailman
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+PYTHON=/usr/bin/python
+MAILMANHOME=/usr/lib/mailman
+MAILMANCTL=${MAILMANHOME}/bin/mailmanctl
+
+case "$1" in
+    start)
+       # rm -f $MAILMANHOME/locks/*
+       cmd_run_log_box "Starting Mailman daemon" ${PYTHON} ${MAILMANCTL} -s -q start
+        ;;
+    
+    stop)
+       cmd_run_log_box "Stopping Mailman daemon" ${PYTHON} ${MAILMANCTL} -q stop
+       ;;
+    
+    restart)
+       ${PYTHON} ${MAILMANCTL} -q restart
+        ;;
+
+    status)
+       statusproc mailman
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/milter-greylist b/stage3/bootscripts/milter-greylist
new file mode 100755 (executable)
index 0000000..a771554
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# milter-greylist
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+prog="Milter-Greylist"
+
+pidfile="/var/run/milter-greylist/milter-greylist.pid"
+socket="/var/run/milter-greylist/milter-greylist.sock"
+OPTIONS="-P $pidfile -p $socket -v"
+
+if [ -f /etc/sysconfig/milter-greylist ]; then
+    . /etc/sysconfig/milter-greylist
+fi
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting $prog" loadproc /usr/bin/milter-greylist ${OPTIONS}
+        touch /var/lock/subsys/milter-greylist
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "Stopping $prog" killproc /usr/bin/milter-greylist
+        rm -f /var/lock/subsys/milter-greylist
+        ;;
+
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    status)
+        statusproc milter-greylist
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/milter-spf b/stage3/bootscripts/milter-spf
new file mode 100755 (executable)
index 0000000..b26502b
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Milter-SPF
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+prog="Milter-SPF"
+socket="/var/run/smfs/smf-spf.sock"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting $prog" loadproc /usr/sbin/smf-spf
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "Stopping $prog" killproc /usr/sbin/smf-spf
+        ;;
+
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    status)
+        statusproc smf-spf
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/mysql b/stage3/bootscripts/mysql
new file mode 100755 (executable)
index 0000000..3c5f935
--- /dev/null
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+# mysql
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+pid_file=/srv/mysql/`/bin/hostname`.pid
+
+mysql_start()
+{
+    if [ -f "$pid_file" ]; then
+        if /bin/ps p `cat $pid_file` | grep mysqld >/dev/null; then
+           # Warning, running...
+           return 0
+       else
+           rm -f $pid_file
+           if [ -f $pid_file ]; then
+               return 1
+           fi
+        fi
+    fi
+    
+    /usr/bin/mysqld_safe --user=mysql 2>&1 >/dev/null &
+    return $?
+}
+
+mysql_stop()
+{
+    if [ -s "$pid_file" ]; then
+        kill `cat $pid_file`
+        sleep 1
+        while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
+          do
+         [ -z "$flags" ]
+         flags=a$flags
+         sleep 1
+       done
+       if [ -s $pid_file ]; then
+           return 1
+       fi
+       return 0
+    else
+        # print_status warning not_running
+        return 1
+    fi
+}
+
+case "$1" in
+    start)
+       cmd_run_log_box "MySQL start" mysql_start
+       ;;
+    
+    stop)
+       cmd_run_log_box "MySQL stop" mysql_stop
+        ;;
+    
+    reload)
+       cmd_run_log_box "MySQL reload" reloadproc mysqld
+        ;;
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    status)
+        statusproc mysqld
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|reload|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/named b/stage3/bootscripts/named
new file mode 100755 (executable)
index 0000000..a527679
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+# Source the network parameters file for the domain name
+source /etc/sysconfig/network/network-parameters
+
+log_script_name "$0 $*"
+
+init_resolver()
+{
+    echo "search ${DOMAINNAME}" > /etc/resolv.conf &&
+    echo "nameserver 127.0.0.1"  >> /etc/resolv.conf
+}
+
+case $1 in
+    start)
+       cmd_run_log_box_warn "bind start" loadproc /usr/sbin/named -u named -t /home/named -c /etc/named.conf &&
+        init_resolver
+        ;;
+    
+    stop)
+       cmd_run_log_box_warn "named stop" killproc named
+        ;;
+    
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    reload)
+       cmd_run_log_box "Reloading named" /usr/sbin/rndc -c /etc/rndc.conf reload
+        ;;
+    
+    status)
+        statusproc named
+        ;;
+    
+    *)
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+        ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/openldap b/stage3/bootscripts/openldap
new file mode 100755 (executable)
index 0000000..2896184
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# openldap
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+piddir=/srv/ldap/run
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting LDAP Server" loadproc slapd
+        ;;
+    
+    stop)
+       cmd_run_log_box_warn "Stopping LDAP Server" killproc_path slapd ${piddir}
+        ;;
+                
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    status)
+       statusproc_path slapd ${piddir}
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/pulseaudio b/stage3/bootscripts/pulseaudio
new file mode 100755 (executable)
index 0000000..273b6a5
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# fcron
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+
+PULSE_SERVER="tcp:via:16002"
+ESPEAKER="via:16001"
+
+# See how we were called.
+case "$1" in
+    start)
+        cmd_run_log_box_warn "PulseAudio sound server start" loadproc pulseaudio
+        ;;
+    
+    stop)
+       cmd_run_log_box_warn "PulseAudio sound server stop" killproc pulseaudio
+        ;;
+    
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+    
+    status)
+        statusproc pulseaudio
+        ;;
+    
+    *)
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit ${EXIT_CODE_FAILURE}
+        ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/samba b/stage3/bootscripts/samba
new file mode 100755 (executable)
index 0000000..09e2bfe
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# See how we were called
+case "$1" in
+    start)
+       cmd_run_log_box_warn "Starting nmbd daemon" loadproc nmbd -D -d 1 -l /var/log/samba
+       cmd_run_log_box_warn "Starting smbd daemon" loadproc smbd -D -l /var/log/samba
+       ;;
+    
+    stop)
+       cmd_run_log_box_warn "Stopping smbd daemon" killproc smbd
+       cmd_run_log_box_warn "Stopping nmbd daemon" killproc nmbd
+       ;;
+    
+    restart)
+       $0 stop
+       sleep 1
+       $0 start
+       ;;
+    
+    status)
+       statusproc nmbd
+       statusproc smbd
+       ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit 1
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/saslauthd b/stage3/bootscripts/saslauthd
new file mode 100755 (executable)
index 0000000..6d271a5
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# saslauthd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "SASL daemon start" loadproc /usr/sbin/saslauthd -a shadow
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "SASL daemon stop" killproc saslauthd
+        ;;
+                
+    status)
+        statusproc saslauthd
+        ;;
+        
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/bootscripts/sendmail b/stage3/bootscripts/sendmail
new file mode 100755 (executable)
index 0000000..14aea57
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# sendmail
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "sendmail start" loadproc /usr/sbin/sendmail -bs -bd -q5m start
+        ;;
+
+    stop)
+       cmd_run_log_box_warn "sendmail stop" killproc sendmail
+        ;;
+
+    reload)
+        cmd_run_log_box_warn reloadproc sendmail
+        ;;
+                
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    status)
+        statusproc sendmail
+        ;;
+    
+    *)
+       echo "Usage: $0 {start|stop|reload|restart|status}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
diff --git a/stage3/cis-ac b/stage3/cis-ac
new file mode 120000 (symlink)
index 0000000..9214a69
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac
\ No newline at end of file
diff --git a/stage3/cis-ac-nobuild b/stage3/cis-ac-nobuild
new file mode 120000 (symlink)
index 0000000..06c3fe7
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac-nobuild
\ No newline at end of file
diff --git a/stage3/cis-alsa-lib b/stage3/cis-alsa-lib
new file mode 100755 (executable)
index 0000000..16b5052
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --enable-static &&
+make &&
+make install &&
+install -v -m644 -D doc/asoundrc.txt /usr/share/doc/${1}/asoundrc.txt &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-alsa-utils b/stage3/cis-alsa-utils
new file mode 100755 (executable)
index 0000000..352f2f0
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure &&
+make &&
+make install &&
+
+# The first time the alsa bootscript is run, it will complain that there is no state in
+# /etc/asound.state. You can prevent this by running the following commands after
+# installing alsa-utils:
+touch /etc/asound.state &&
+
+install -v -m740 ${CUR_DIR}/bootscripts/alsa /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rcS alsa 95 85
+
+# Return last error
+exit $?
diff --git a/stage3/cis-apache b/stage3/cis-apache
new file mode 100755 (executable)
index 0000000..e1eb209
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd ${APACHE_USER} &&
+hv_useradd -c WebServer -d /dev/null -g ${APACHE_USER} -s /bin/false ${APACHE_USER} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --enable-layout=FHS \
+    --enable-mods-shared=all \
+    --enable-ssl \
+    --with-z &&
+#    --enable-rewrite \
+#    --enable-deflate \
+#    --enable-dav \
+make &&
+make install &&
+
+# There's a problem with the ISAPI DSO module caused from compiling with GCC-4.1.2.
+# Commenting out the module from the configuration:
+if grep "LoadModule isapi_module" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
+    sed -i -e "s/^LoadModule isapi_module/# &/" /etc/apache/httpd.conf
+fi &&
+
+# Modifying the listening port if an alternate one is specified.
+if [ -n "${HTTPD_PORT}" ]; then
+    if ! grep "Listen ${HTTPD_PORT}" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
+       # Adding alternate port to default port of 80
+       sed -i -e "s%\(Listen 80\)%\1\nListen ${HTTPD_PORT}%" /etc/apache/httpd.conf
+    fi
+fi &&
+
+# Modifying the configuration file to run the server as a dedicated user:
+sed -i \
+    -e "s!^\(User\).*!\1 ${APACHE_USER}!g" \
+    -e "s!^\(Group\).*!\1 ${APACHE_USER}!g" \
+    /etc/apache/httpd.conf &&
+
+# SSL Certificates generation script
+cat > /etc/apache/generate-ssl-certs << "EOF" &&
+#!/bin/sh
+
+# Creation of SSL directories for Apache
+cd /etc/apache &&
+mkdir -p ssl &&
+
+cd ssl &&
+
+echo "-------------------------------------------------" &&
+echo "Generation of the RSA private key" &&
+echo "-------------------------------------------------" &&
+openssl genrsa -des3 -rand file1:file2:file3:file4:file5 -out server.key 1024 &&
+
+echo "-------------------------------------------------" &&
+echo "Removing pass-phrase from the private key" &&
+echo "-------------------------------------------------" &&
+cp server.key server.key.orig &&
+openssl rsa -in server.key.orig -out server.key &&
+# The unencrypted key must be readable only by root!
+chown root:root server.* &&
+chmod 0400 server.* &&
+
+echo "-------------------------------------------------" &&
+echo "Generation of a Certificate Signing Request (CSR)" &&
+echo "" &&
+echo "Example fields:" &&
+echo "Country name:             CA" &&
+echo "State or Province Name:   Quebec" &&
+echo "Locality Name:            Montreal" &&
+echo "Organization Name:        Hugo Villeneuve" &&
+echo "Organizational Unit Name: ." &&
+echo "Common Name:              www.hugovil.com" &&
+echo "Email Address:            webmaster@hugovil.com" &&
+echo "" &&
+echo "Please enter the following 'extra' attributes" &&
+echo "to be sent with your certificate request" &&
+echo "A challenge password []:     (press enter)   " &&
+echo "An optional company name []: (press enter)   " &&
+echo "" &&
+echo "-------------------------------------------------" &&
+
+openssl req -new -key server.key -out server.csr &&
+
+echo "-------------------------------------------------" &&
+echo "Generation of a self-signed certificate" &&
+echo "-------------------------------------------------" &&
+openssl x509 -req -days 10000 -in server.csr -signkey server.key -out server.crt &&
+
+exit $?
+EOF
+
+chmod 740 /etc/apache/generate-ssl-certs &&
+
+mkdir -p /etc/apache/ssl &&
+cp /etc/apache/extra/httpd-ssl.conf /etc/apache/ssl/ssl.conf &&
+
+sed -i -e "s!^<IfModule ssl_module>!<IfModule ssl_module>\n  Include /etc/apache/ssl/ssl.conf!" /etc/apache/httpd.conf &&
+
+mkdir -p /srv/www/htdocs/ssl &&
+chown apache:apache /srv/www/htdocs/ssl &&
+
+sed -i -e "s!^DocumentRoot .*!DocumentRoot /srv/www/htdocs/ssl!" /etc/apache/ssl/ssl.conf &&
+sed -i -e "s!^ServerName .*:443!ServerName www.${DOMAIN}:443!" /etc/apache/ssl/ssl.conf &&
+sed -i -e "s!^ServerAdmin .*!ServerAdmin webmaster@${DOMAIN}!" /etc/apache/ssl/ssl.conf &&
+sed -i -e "s!/etc/apache!/etc/apache/ssl!" /etc/apache/ssl/ssl.conf &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/apache /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 apache 70 20
+
+# Return last error
+exit $?
diff --git a/stage3/cis-audacity b/stage3/cis-audacity
new file mode 100755 (executable)
index 0000000..b0ac782
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-libsamplerate \
+    --with-libmad &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-bind b/stage3/cis-bind
new file mode 100755 (executable)
index 0000000..23161c7
--- /dev/null
@@ -0,0 +1,180 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd named &&
+hv_useradd -c BindOwner -g named -m -s /bin/false named &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --mandir=/usr/share/man \
+    --enable-threads \
+    --with-libtool &&
+# Use updated address for L.ROOT-SERVERS.NET.
+sed -i "s@198.32.64.12@199.7.83.42@" lib/dns/rootns.c &&
+make &&
+make install &&
+
+# Enable the execute bit to prevent a warning when using ldd to check library dependencies.
+chmod 755 /usr/lib/lib{bind9,isc{,cc,cfg},lwres,dns}.so.*.?.? &&
+
+cd doc &&
+install -d -m755 /usr/share/doc/${1}/{arm,draft,misc,rfc} &&
+install -m644 arm/*.html /usr/share/doc/${1}/arm &&
+install -m644 draft/*.txt /usr/share/doc/${1}/draft &&
+install -m644 rfc/* /usr/share/doc/${1}/rfc &&
+install -m644 misc/{dnssec,ipv6,migrat*,options,rfc-compliance,roadmap,sdb} \
+    /usr/share/doc/${1}/misc &&
+
+# Generation of a key for use in the named.conf and rdnc.conf files using the rndc-confgen command.
+BINDKEY=$(rndc-confgen -b 512 | grep -m 1 "secret" | cut -d '"' -f 2) &&
+
+cd /home/named &&
+mkdir -p dev etc/namedb/{pz,slave} var/run &&
+rm -f /home/named/dev/null &&
+mknod /home/named/dev/null c 1 3 &&
+rm -f /home/named/dev/random &&
+mknod /home/named/dev/random c 1 8 &&
+chmod 666 /home/named/dev/{null,random} &&
+cp /etc/localtime /home/named/etc &&
+
+# Creating the named.conf file from which named will read the location of zone files,
+# root name servers and secure DNS keys.
+cat > /home/named/etc/named.conf << "EOF" &&
+ options {
+     directory "/etc/namedb";
+    pid-file "/var/run/named.pid";
+    statistics-file "/var/run/named.stats";
+       
+ };
+ controls {
+     inet 127.0.0.1 allow { localhost; } keys { rndc_key; };
+ };
+ key "rndc_key" {
+     algorithm hmac-md5;
+     secret "_BIND_KEY_";
+ };
+ zone "." {
+     type hint;
+     file "root.hints";
+ };
+ zone "0.0.127.in-addr.arpa" {
+     type master;
+     file "pz/127.0.0";
+ };
+
+// Bind 9 now logs by default through syslog (except debug).
+// These are the default logging rules.
+
+logging {
+     category default { default_syslog; default_debug; };
+     category unmatched { null; };
+
+  channel default_syslog {
+      syslog daemon;                      // send to syslog's daemon
+                                          // facility
+      severity info;                      // only send priority info
+                                          // and higher
+  };
+
+  channel default_debug {
+      file "named.run";                   // write to named.run in
+                                          // the working directory
+                                          // Note: stderr is used instead
+                                          // of "named.run"
+                                          // if the server is started
+                                          // with the '-f' option.
+      severity dynamic;                   // log at the server's
+                                          // current debug level
+  };
+
+  channel default_stderr {
+      stderr;                             // writes to stderr
+      severity info;                      // only send priority info
+                                          // and higher
+  };
+
+  channel null {
+     null;                                // toss anything sent to
+                                          // this channel
+  };
+};
+EOF
+sed -i -e "s!_BIND_KEY_!${BINDKEY}!g" /home/named/etc/named.conf &&
+
+cat > /etc/rndc.conf << "EOF" &&
+key rndc_key {
+algorithm "hmac-md5";
+    secret
+    "_BIND_KEY_";
+    };
+options {
+    default-server localhost;
+    default-key    rndc_key;
+};
+EOF
+sed -i -e "s!_BIND_KEY_!${BINDKEY}!g" /etc/rndc.conf &&
+
+cat > /home/named/etc/namedb/pz/127.0.0 << "EOF" &&
+$TTL 3D
+@      IN      SOA     ns.local.domain. hostmaster.local.domain. (
+                        1       ; Serial
+                        8H      ; Refresh
+                        2H      ; Retry
+                        4W      ; Expire
+                        1D)     ; Minimum TTL
+                NS      ns.local.domain.
+1               PTR     localhost.
+EOF
+
+cat > /home/named/etc/namedb/root.hints << "EOF" &&
+.                       6D  IN      NS      A.ROOT-SERVERS.NET.
+.                       6D  IN      NS      B.ROOT-SERVERS.NET.
+.                       6D  IN      NS      C.ROOT-SERVERS.NET.
+.                       6D  IN      NS      D.ROOT-SERVERS.NET.
+.                       6D  IN      NS      E.ROOT-SERVERS.NET.
+.                       6D  IN      NS      F.ROOT-SERVERS.NET.
+.                       6D  IN      NS      G.ROOT-SERVERS.NET.
+.                       6D  IN      NS      H.ROOT-SERVERS.NET.
+.                       6D  IN      NS      I.ROOT-SERVERS.NET.
+.                       6D  IN      NS      J.ROOT-SERVERS.NET.
+.                       6D  IN      NS      K.ROOT-SERVERS.NET.
+.                       6D  IN      NS      L.ROOT-SERVERS.NET.
+.                       6D  IN      NS      M.ROOT-SERVERS.NET.
+A.ROOT-SERVERS.NET.     6D  IN      A       198.41.0.4
+B.ROOT-SERVERS.NET.     6D  IN      A       192.228.79.201
+C.ROOT-SERVERS.NET.     6D  IN      A       192.33.4.12
+D.ROOT-SERVERS.NET.     6D  IN      A       128.8.10.90
+E.ROOT-SERVERS.NET.     6D  IN      A       192.203.230.10
+F.ROOT-SERVERS.NET.     6D  IN      A       192.5.5.241
+G.ROOT-SERVERS.NET.     6D  IN      A       192.112.36.4
+H.ROOT-SERVERS.NET.     6D  IN      A       128.63.2.53
+I.ROOT-SERVERS.NET.     6D  IN      A       192.36.148.17
+J.ROOT-SERVERS.NET.     6D  IN      A       192.58.128.30
+K.ROOT-SERVERS.NET.     6D  IN      A       193.0.14.129
+L.ROOT-SERVERS.NET.     6D  IN      A       198.32.64.12
+M.ROOT-SERVERS.NET.     6D  IN      A       202.12.27.33
+EOF
+
+chown -R named.named /home/named &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/named /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 named 25 65
+
+# Return last error
+exit $?
diff --git a/stage3/cis-boost b/stage3/cis-boost
new file mode 100755 (executable)
index 0000000..87069d7
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+./configure \
+    --prefix=/usr &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-cdrtools b/stage3/cis-cdrtools
new file mode 100755 (executable)
index 0000000..b9e00d4
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make INS_BASE=/usr DEFINSUSR=root DEFINSGRP=root &&
+make INS_BASE=/usr DEFINSUSR=root DEFINSGRP=root install &&
+
+cat > /etc/sysconfig/cdrecord << "EOF"
+#!/bin/sh
+
+# If you know exactly the device to use with cdrecord,
+# enter it in this variable. If this variable is empty,
+# cdrecord scripts will try to autodetect the device
+# using the CDR_DEVICE_DESC variable.
+#CDREC_DEVICE="ATAPI:1,1,0"
+#CDROM_DEVICE="ATAPI:1,0,0"
+
+# This variable contains the identification string that
+# cdrecord scripts will look for when calling cdrecord
+# with the "-scanbus" option
+CDREC_DEVICE_DESC="CD-Writer+ 8200"
+CDROM_DEVICE_DESC="CDR-8235"
+EOF
+
+# Return last error
+exit $?
diff --git a/stage3/cis-clamav b/stage3/cis-clamav
new file mode 100755 (executable)
index 0000000..b76a000
--- /dev/null
@@ -0,0 +1,214 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd  clamav &&
+hv_useradd -g clamav -s /bin/false -c Clam-AntiVirus clamav &&
+
+cd ${LFS_TMP}/${1} &&
+SENDMAIL="/usr/sbin/sendmail" ./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-dbdir=/srv/clamav \
+    --enable-milter &&
+make &&
+make install &&
+touch /var/log/clamd.log &&
+chmod 600 /var/log/clamd.log &&
+chown clamav /var/log/clamd.log &&
+touch /var/log/freshclam.log &&
+chmod 600 /var/log/freshclam.log &&
+chown clamav /var/log/freshclam.log &&
+
+# Addition to /etc/fcron/fcrontab to update virus database
+string_add "Update the Clam AV database every hour"            /etc/fcron/fcrontab &&
+string_add "&mail(false) 0 * * * * /usr/bin/freshclam --quiet" /etc/fcron/fcrontab &&
+
+# Configuration file
+cat > /etc/clamd.conf << "EOF" &&
+# clamd.conf
+# Configuration file for the Clam AV daemon
+
+# Uncomment this option to enable logging.
+# LogFile must be writable for the user running the daemon.
+# A full path is required.
+LogFile /var/log/clamd.log
+
+# Maximal size of the log file. Default is 1 Mb.
+# Value of 0 disables the limit.
+# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes)
+# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size
+# in bytes just don't use modifiers.
+LogFileMaxSize 0
+
+# Log time with each message.
+LogTime 1
+
+# Enable verbose logging.
+#LogVerbose
+
+# This option allows you to save the process identifier of the listening
+# daemon (main thread).
+PidFile /var/run/clamav/clamd.pid
+
+# Path to the database directory.
+# Default: hardcoded (depends on installation options)
+DatabaseDirectory /srv/clamav
+
+# The daemon works in a local OR a network mode. Due to security reasons we
+# recommend the local mode.
+
+# Path to a local socket file the daemon will listen on.
+LocalSocket /var/run/clamav/clamd.sock
+
+# Remove stale socket after unclean shutdown.
+FixStaleSocket 1
+
+# Maximal number of a threads running at the same time.
+# Default is 5, and it should be sufficient for a typical workstation.
+# You may need to increase threads number for a server machine.
+MaxThreads 200
+
+# Maximal depth directories are scanned at.
+# Default: 15
+MaxDirectoryRecursion 15
+
+# Follow directory symlinks.
+# Default: disabled
+#FollowDirectorySymlinks
+
+# Follow regular file symlinks.
+# Default: disabled
+#FollowFileSymlinks
+
+# Perform internal sanity check (database integrity and freshness).
+# Default: 1800 (30 min)
+#SelfCheck 600
+
+# Execute a command when virus is found. In the command string %v will
+# be replaced by a virus name.
+# Default: disabled
+#VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v"
+
+# Run as a selected user (clamd must be started by root).
+# Default: disabled
+User clamav
+
+# By default clamd uses scan options recommended by libclamav. This option
+# disables recommended options and allows you to enable selected ones below.
+# DO NOT TOUCH IT unless you know what you are doing.
+# Default: disabled
+#DisableDefaultScanOptions
+
+##
+## Documents
+##
+
+# This option enables scanning of Microsoft Office document macros.
+ScanOLE2 1
+
+##
+## Mail files
+##
+
+# Enable internal e-mail scanner.
+ScanMail 1
+
+##
+## Archives
+##
+
+# ClamAV can scan within archives and compressed files.
+ScanArchive 1
+
+# The options below protect your system against Denial of Service attacks
+# using archive bombs.
+
+# Files larger than this limit won't be scanned.
+# Value of 0 disables the limit.
+MaxFileSize 10M
+
+# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR
+# file, all files within it will also be scanned. This options specifies how
+# deep the process should be continued.
+# Value of 0 disables the limit.
+MaxRecursion 100
+
+# Number of files to be scanned within an archive.
+# Value of 0 disables the limit.
+MaxFiles 0
+EOF
+
+
+# Freshclam configuration file
+cat > /etc/freshclam.conf << "EOF" &&
+# freshclam.conf
+# Configuration file for Freshclam
+
+# Path to the database directory.
+DatabaseDirectory /srv/clamav
+
+# Path to the log file (make sure it has proper permissions)
+UpdateLogFile /var/log/freshclam.log
+
+# Enable verbose logging.
+#LogVerbose
+
+# By default when started freshclam drops privileges and switches to the
+# "clamav" user. This directive allows you to change the database owner.
+DatabaseOwner clamav
+
+# Use DNS to verify virus database version. Freshclam uses DNS TXT records
+# to verify database and software versions. We highly recommend enabling
+# this option.
+DNSDatabaseInfo current.cvd.clamav.net
+
+# Uncomment the following line and replace XY with your country
+# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
+DatabaseMirror db.ca.clamav.net
+
+# database.clamav.net is a round-robin record which points to our most 
+# reliable mirrors. It's used as a fall back in case db.XY.clamav.net is 
+# not working.
+DatabaseMirror database.clamav.net
+
+# Send the RELOAD command to clamd.
+# Default: disabled
+#NotifyClamd
+
+# Run command after successful database update.
+# Default: disabled
+#OnUpdateExecute command
+
+# Run command when database update process fails.
+# Default: disabled
+#OnErrorExecute command
+EOF
+
+# Create the DB directory
+mkdir -p /srv/clamav &&
+chown clamav:clamav /srv/clamav &&
+chmod 755 /srv/clamav &&
+
+# Create the run directory
+mkdir -p /var/run/clamav &&
+chown clamav:clamav /var/run/clamav &&
+chmod 755 /var/run/clamav &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/clamav /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 clamav 55 35
+
+# Return last error
+exit $?
diff --git a/stage3/cis-cups b/stage3/cis-cups
new file mode 100755 (executable)
index 0000000..b56b7e7
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# When using Linux-PAM, some files need to be modified so CUPS
+# can find needed headers.
+sed -i -e "s@pam/pam@security/pam@g" \
+    {config-scripts/cups-pam.m4,scheduler/auth.c,configure} &&
+
+./configure &&
+make &&
+make install &&
+
+# For a remote CUPS print server
+if [ -n "${CUPS_SERVER}" ]; then
+    cat > /etc/cups/client.conf << "EOF" &&
+########################################################################
+#                                                                      #
+# This is the CUPS client configuration file.  This file is used to    #
+# define client-specific parameters, such as the default server or     #
+# default encryption settings.                                         #
+#                                                                      #
+########################################################################
+
+#
+# ServerName: the hostname of your server.  By default CUPS will use the
+# hostname of the system or the value of the CUPS_SERVER environment
+# variable.  ONLY ONE SERVER NAME MAY BE SPECIFIED AT A TIME.  To use
+# more than one server you must use a local scheduler with browsing
+# and possibly polling.
+#
+EOF
+    echo "ServerName ${CUPS_SERVER}" >> /etc/cups/client.conf
+    evaluate_retval
+fi
+
+# Modification to allow access from all hosts in internal LAN (192.168.0.x)
+sed -i -e "s!\(Allow From 127\.0\.0\.1\)!\1\nAllow From 192\.168\.0\.0/24!g" /etc/cups/cupsd.conf &&
+
+install -v -m740 ${CUR_DIR}/bootscripts/cups /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 cups 40 50
+
+# Return last error
+exit $?
diff --git a/stage3/cis-dbus b/stage3/cis-dbus
new file mode 100755 (executable)
index 0000000..d118d52
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd -g 18 messagebus &&
+hv_useradd -c D-BUS-Message-Daemon-User -d /dev/null \
+    -u 18 -g messagebus -s /bin/false messagebus &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var &&
+make &&
+make install &&
+ldconfig &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/dbus /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 dbus 92 20
+
+# Starting the session daemon here has the added bonus that it will exit
+# when you log out of your GNOME session. If you wish to start the daemon
+#here, use the following command instead of the one shown above:
+######echo "exec dbus-launch --exit-with-session gnome-session" >> ~/.xinitrc &&
+
+# Return last error
+exit $?
diff --git a/stage3/cis-ddclient b/stage3/cis-ddclient
new file mode 100755 (executable)
index 0000000..7a4df53
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+install ddclient /usr/sbin &&
+mkdir -p /etc/ddclient &&
+cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf &&
+
+cat > /var/lib/dhcpc/dhcpcd.exe << "EOF" &&
+#!/bin/sh
+
+## Update the DNS server unless the IP address is a private address
+## that may be used as a internal LAN address. This may be true if
+## other interfaces are assigned private addresses from internal
+## DHCP server.
+
+# Arg #1: <HostInfoFilePath>
+# Arg #2: <up|down|new>
+# Arg #3: -d option
+
+source ${1}
+
+case "${IPADDR}" in
+    10.*)
+       ;;
+    
+    172.1[6-9].* | 172.2[0-9].* | 172.3[0-1].*)
+        ;;
+    
+    192.168.*)
+       ;;
+
+    *)
+       case "${2}" in
+           up)
+               logger -t dhcpcd "IP address remaining at ${IPADDR}"
+               ;;
+           down)
+               ;;
+           new)
+               logger -t dhcpcd "IP address changed to ${IPADDR}" &&
+               ddclient -daemon=0 -syslog -use=ip -ip=${IPADDR} >/dev/null 2>&1
+               ;;
+       esac
+       ;;
+esac
+
+exit $?
+EOF
+
+chmod 740 /var/lib/dhcpc/dhcpcd.exe
+
+# Return last error
+exit $?
diff --git a/stage3/cis-docbook-dsssl b/stage3/cis-docbook-dsssl
new file mode 100755 (executable)
index 0000000..8f72460
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+install -m755 bin/collateindex.pl /usr/bin &&
+install -m644 bin/collateindex.pl.1 /usr/share/man/man1 &&
+install -d -m755 /usr/share/sgml/docbook/dsssl-stylesheets-${DOCBOOK_DSSSL_VER} &&
+cp -R * /usr/share/sgml/docbook/dsssl-stylesheets-${DOCBOOK_DSSSL_VER} &&
+install-catalog --add /etc/sgml/dsssl-docbook-stylesheets.cat \
+    /usr/share/sgml/docbook/dsssl-stylesheets-${DOCBOOK_DSSSL_VER}/catalog &&
+install-catalog --add /etc/sgml/dsssl-docbook-stylesheets.cat \
+    /usr/share/sgml/docbook/dsssl-stylesheets-${DOCBOOK_DSSSL_VER}/common/catalog &&
+install-catalog --add /etc/sgml/sgml-docbook.cat \
+    /etc/sgml/dsssl-docbook-stylesheets.cat
+
+# Return last error
+exit $?
diff --git a/stage3/cis-docbook-utils b/stage3/cis-docbook-utils
new file mode 100755 (executable)
index 0000000..da0a79f
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i 's:/html::' doc/HTML/Makefile.in &&
+./configure \
+    --prefix=/usr &&
+make &&
+make install &&
+
+for doctype in html ps dvi man pdf rtf tex texi txt; do
+    ln -sf docbook2$doctype /usr/bin/db2$doctype || exit 1
+done
+
+# Return last error
+exit $?
diff --git a/stage3/cis-docbook-xml b/stage3/cis-docbook-xml
new file mode 100755 (executable)
index 0000000..35acbdb
--- /dev/null
@@ -0,0 +1,112 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+install -d -m755 /usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER} &&
+install -d -m755 /etc/xml &&
+chown -R root:root . &&
+cp -af docbook.cat *.dtd ent/ *.mod \
+    /usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER} &&
+
+if [ ! -e /etc/xml/docbook ]; then
+    xmlcatalog --noout --create /etc/xml/docbook || exit 1
+fi &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//DTD DocBook XML V${DOCBOOK_XML_VER}//EN" \
+    "http://www.oasis-open.org/docbook/xml/${DOCBOOK_XML_VER}/docbookx.dtd" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//DTD DocBook XML CALS Table Model V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/calstblx.dtd" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/soextblx.dtd" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ELEMENTS DocBook XML Information Pool V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/dbpoolx.mod" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/dbhierx.mod" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ELEMENTS DocBook XML HTML Tables V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/htmltblx.mod" \
+    /etc/xml/docbook
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ENTITIES DocBook XML Notations V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/dbnotnx.mod" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ENTITIES DocBook XML Character Entities V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/dbcentx.mod" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "public" \
+    "-//OASIS//ENTITIES DocBook XML Additional General Entities V${DOCBOOK_XML_VER}//EN" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}/dbgenent.mod" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "rewriteSystem" \
+    "http://www.oasis-open.org/docbook/xml/${DOCBOOK_XML_VER}" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}" \
+    /etc/xml/docbook &&
+xmlcatalog --noout --add "rewriteURI" \
+    "http://www.oasis-open.org/docbook/xml/${DOCBOOK_XML_VER}" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}" \
+    /etc/xml/docbook &&
+
+if [ ! -e /etc/xml/catalog ]; then
+    xmlcatalog --noout --create /etc/xml/catalog
+fi &&
+xmlcatalog --noout --add "delegatePublic" \
+    "-//OASIS//ENTITIES DocBook XML" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog &&
+xmlcatalog --noout --add "delegatePublic" \
+    "-//OASIS//DTD DocBook XML" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog &&
+xmlcatalog --noout --add "delegateSystem" \
+    "http://www.oasis-open.org/docbook/" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog &&
+xmlcatalog --noout --add "delegateURI" \
+    "http://www.oasis-open.org/docbook/" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog &&
+
+for DTDVERSION in ${DOCBOOK_XML_VER_PREV}
+do
+  xmlcatalog --noout --add "public" \
+    "-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
+    "http://www.oasis-open.org/docbook/xml/$DTDVERSION/docbookx.dtd" \
+    /etc/xml/docbook &&
+  xmlcatalog --noout --add "rewriteSystem" \
+    "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}" \
+    /etc/xml/docbook &&
+  xmlcatalog --noout --add "rewriteURI" \
+    "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
+    "file:///usr/share/xml/docbook/xml-dtd-${DOCBOOK_XML_VER}" \
+    /etc/xml/docbook &&
+  xmlcatalog --noout --add "delegateSystem" \
+    "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog &&
+  xmlcatalog --noout --add "delegateURI" \
+    "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
+    "file:///etc/xml/docbook" \
+    /etc/xml/catalog
+done
+
+# Return last error
+exit $?
diff --git a/stage3/cis-docbook-xsl b/stage3/cis-docbook-xsl
new file mode 100755 (executable)
index 0000000..0484f3f
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+install -d /usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION} &&
+chown -R root:root . &&
+cp -af INSTALL VERSION common eclipse extensions fo html htmlhelp \
+    images javahelp lib manpages params profiling template xhtml \
+    /usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION} &&
+install -d /usr/share/doc/xml &&
+cp -af doc/* /usr/share/doc/xml &&
+cd /usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION} &&
+sh INSTALL
+evaluate_retval
+if [ ! -f /etc/xml/catalog ]; then
+    mkdir -p /etc/xml || exit 1
+    xmlcatalog --noout --create /etc/xml/catalog || exit 1
+fi
+if [ ! -e /etc/xml/docbook ]; then
+    xmlcatalog --noout --create /etc/xml/docbook || exit 1
+fi
+xmlcatalog --noout --add "rewriteSystem" \
+    "http://docbook.sourceforge.net/release/xsl/current" \
+    "/usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION}" /etc/xml/catalog &&
+xmlcatalog --noout --add "rewriteURI" \
+    "http://docbook.sourceforge.net/release/xsl/current" \
+    "/usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION}" /etc/xml/catalog &&
+xmlcatalog --noout --add "delegateSystem" \
+    "http://docbook.sourceforge.net/release/xsl/" \
+    "file:///etc/xml/docbook" /etc/xml/catalog &&
+xmlcatalog --noout --add "delegateURI" \
+    "http://docbook.sourceforge.net/release/xsl/" \
+    "file:///etc/xml/docbook" /etc/xml/catalog &&
+
+var_add_str "XML_CATALOG_FILES" /etc/profile \
+    "/usr/share/xml/docbook/xsl-stylesheets-${DOCBOOK_XSL_VERSION}/catalog.xml /etc/xml/catalog" &&
+var_export  "XML_CATALOG_FILES" /etc/profile
+
+# Return last error
+exit $?
diff --git a/stage3/cis-dvd-rw-tools b/stage3/cis-dvd-rw-tools
new file mode 100755 (executable)
index 0000000..b09da3e
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make all rpl8 btcflash &&
+make prefix=/usr install &&
+install -v -m644 -D index.html /usr/share/doc/${1}/index.html &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-emacs b/stage3/cis-emacs
new file mode 100755 (executable)
index 0000000..47d714c
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations &&
+
+olddir=$(pwd) &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --with-x-toolkit=gtk &&
+make bootstrap &&
+make install &&
+ldconfig &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags &&
+
+cat > /etc/skel/.emacs << "EOF" &&
+;; ~/.emacs
+
+;; Emacs initialization file
+
+;; Are we running XEmacs or Emacs?
+(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
+
+;; Set up the keyboard so the delete key on both the regular keyboard
+;; and the keypad delete the character under the cursor and to the right
+;; under X, instead of the default, backspace behavior.
+(global-set-key [delete] 'delete-char)
+(global-set-key [kp-delete] 'delete-char)
+
+;; Do not display a splash screen on startup
+(setq inhibit-splash-screen t)
+
+;; Turn on font-lock mode for Emacs
+(cond ((not running-xemacs)
+       (global-font-lock-mode t)
+))
+
+;; Always end a file with a newline
+(setq require-final-newline t)
+
+;; Stop at the end of the file, not just add lines
+(setq next-line-add-newlines nil)
+
+;; Enable wheelmouse support by default
+(mwheel-install)
+(setq mwheel-follow-mouse t)
+
+;; Replaces tabs in files with spaces
+(setq-default indent-tabs-mode nil)
+
+;; Makes the compilation buffer always scrolls to follow
+;; output as it comes in.
+(setq compilation-scroll-output t)
+EOF
+
+# This is to remove a warning in WindowMaker when emacs is started.
+cp ${olddir}/resources/ColorGNU.xpm /usr/share/pixmaps &&
+chmod 644 /usr/share/pixmaps/ColorGNU.xpm
+
+# Return last error
+exit $?
diff --git a/stage3/cis-espgs b/stage3/cis-espgs
new file mode 100755 (executable)
index 0000000..656f9d0
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+GS_FONTS_PATH="${HV_FONTS_PATH}/ghostscript"
+
+# Unpack all the fonts to ${GS_FONTS_PATH}
+install -v -m755 -d ${GS_FONTS_PATH} &&
+decompress_package ${GHOSTSCRIPT_FONTS_STD} &&
+decompress_package ${GHOSTSCRIPT_FONTS_OTHER} &&
+mv ${LFS_TMP}/fonts/* ${GS_FONTS_PATH} &&
+rmdir ${LFS_TMP}/fonts &&
+chown -v -R root:root ${GS_FONTS_PATH} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i "s/bbox.dev$/x11.dev/" Makefile.in &&
+./configure \
+    --prefix=/usr \
+    --enable-threads \
+    --without-omni \
+    --with-fontpath=${GS_FONTS_PATH} &&
+make &&
+make install &&
+#rmdir -v /usr/lib/ghostscript/$(get_pkg_ver_base ${1}) /usr/lib/ghostscript &&
+ln -v -s ../ghostscript/$(get_pkg_ver_base ${1})/doc /usr/share/doc/${1} &&
+for INSTFILE in `ls doc`; do
+    if [ ! -f /usr/share/doc/${1}/${INSTFILE} ]; then
+       install -v -m644 doc/${INSTFILE} /usr/share/doc/${1}/
+    fi
+done &&
+
+# Checking if X is installed...
+if [ -d /usr/X11R6 ]; then
+    # Adding our local fonts directory to local configuration file
+    sed -i -e "s!^</fontconfig>!<dir>${GS_FONTS_PATH}</dir>\n</fontconfig>!" \
+       /etc/fonts/local.conf &&
+    
+    # Updating fonts cache database.
+    fc-cache -f
+fi &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-fcron b/stage3/cis-fcron
new file mode 100755 (executable)
index 0000000..f83968d
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd fcron &&
+hv_useradd -c fcron -g fcron fcron &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --with-sendmail \
+    --with-answer-all=no &&
+make &&
+make install &&
+
+rm -f /etc/fcron.conf &&
+mkdir -p /etc/fcron &&
+mv -f /etc/fcron.allow /etc/fcron &&
+mv -f /etc/fcron.deny /etc/fcron &&
+
+cat > /etc/fcron/fcron.conf << "EOF" &&
+# fcron.conf - Configuration file for fcron(8) and fcrontab(1).
+#       See fcron.conf(5) for syntax and explanations.
+#
+# WARNING : this file must be owned by root:fcron and 640.
+#
+#
+# The spool directory where fcron stores its files
+fcrontabs  = /var/spool/fcron
+#
+# The locations of the pid file and the fifo file
+pidfile    = /var/run/fcron.pid
+fifofile   = /var/run/fcron.fifo
+#
+# allow/deny files to determine which users are allowed to use fcrontab
+fcronallow = /etc/fcron/fcron.allow
+fcrondeny  = /etc/fcron/fcron.deny
+#
+# Location of the programs used by fcron
+shell      = /bin/sh
+sendmail   = /usr/sbin/sendmail
+#
+# Location of the default editor for "fcrontab -e"
+editor     = /usr/bin/vi
+EOF
+chmod 640 /etc/fcron/fcron.conf &&
+
+cat > /etc/fcron/fcrontab << "EOF" &&
+# &options min hrs day-of-month month day-of-week command
+# Run rotatelogs every day at 00:05
+#&mail(false) 05 00 * * * /usr/local/bin/rotatelogs
+EOF
+chmod 640 /etc/fcron/fcrontab &&
+chown -R root.fcron /etc/fcron &&
+
+cat > /etc/fcron/configure << "EOF" &&
+#!/bin/sh
+
+fcrontab -c /etc/fcron/fcron.conf /etc/fcron/fcrontab
+
+exit $?
+EOF
+chmod 740 /etc/fcron/configure &&
+
+# Executing fcron configure script.
+/etc/fcron/configure &&
+
+install -v -m740 ${CUR_DIR}/bootscripts/fcron /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rcS fcron 95 84
+
+# Return last error
+exit $?
diff --git a/stage3/cis-firefox b/stage3/cis-firefox
new file mode 100755 (executable)
index 0000000..5062900
--- /dev/null
@@ -0,0 +1,121 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Get the name of the decompressed directory
+SOURCE_DIR=$(static_decompressed_dirname ${1})
+
+FIREFOX_BUILD_DIR="${1}-build"
+
+cd ${LFS_TMP}/${SOURCE_DIR} &&
+cat > .mozconfig << "EOF"
+# This file contains the options used in the Firefox build.
+
+# Use the default settings specified in the source tree
+. $topsrcdir/browser/config/mozconfig
+
+# Create an object directory and specify to build the package in that
+# directory. If desired, modify the location of the object directory
+# to a directory inside the source tree by removing '../' from the
+# line below.
+mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../_FIREFOX_BUILD_DIR_
+
+# Specify the installation prefix. If you would prefer Firefox
+# installed in a different prefix, modify the line below to fit
+# your needs. You'll also need to modify some of the instructions in
+# the BLFS book to point to your desired prefix.
+ac_add_options --prefix=/usr
+
+# These options are used so that the Firefox binaries are linked to
+# the system-installed copies of the specified libraries instead of
+# the source tree code which may not be the most recent versions.
+ac_add_options --with-system-zlib
+ac_add_options --with-system-jpeg
+ac_add_options --enable-system-cairo
+# --with-system-png: Problem with missing apng support
+
+# This option causes the installed binaries to have the official
+# Firefox name embedded in them. Due to license restrictions, you
+# may not distribute binaries created using this option.
+ac_add_options --enable-official-branding
+
+# This option is used to enable support for rendering SVG files in the
+# Firefox browser. Comment out the line to disable the option.
+ac_add_options --enable-svg
+
+# This option is used so that the debugging symbols are removed from
+# the installed binaries during the installation process. Comment out
+# this option if you may have a need to retain the debugging symbols
+# in the installed binaries. Note that this can substantially
+# increase the size of the installed binaries.
+ac_add_options --enable-strip
+
+# This option is added so that test libraries and programs are not
+# built. These would only be required for debugging purposes.
+ac_add_options --disable-tests
+
+# This option is added so that the Mozilla Installer program is not
+# built or installed. The program is not required for a BLFS
+# installation of Firefox.
+ac_add_options --disable-installer
+
+# This option is used to disable the a11y support in the Firefox
+# binaries. Comment out this option if you require a11y support.
+ac_add_options --disable-accessibility
+
+# This option is used to enable source tree included LDAP support in
+# the Firefox binaries.
+###################################################################
+#
+# NOTE: You must uncomment this option if there is any chance of
+# compiling the OpenOffice package from source code using this copy
+# of Firefox for your Mozilla support.
+#
+###################################################################
+# Removed this option to fix bug with:
+#   make[3]: Entering directory `/tmp/firefox-3.0.1-build/directory/c-sdk'
+#   make[3]: *** No targets specified and no makefile found.  Stop.
+######ac_add_options --enable-ldap
+
+# These two options enable support for building Firefox with
+# system-installed versions of the Network Security Services (NSS)
+# and Netscape Portable Runtime (NSPR) libraries. Uncomment both
+# lines to enable support for system-installed NSS/NSPR.
+#ac_add_options --with-system-nss
+# --with-system-nss: Problem with missing nss-config in nss-3.12!!!
+#ac_add_options --with-system-nspr
+EOF
+
+sed -i -e "s!_FIREFOX_BUILD_DIR_!${FIREFOX_BUILD_DIR}!g" .mozconfig &&
+
+make -f client.mk build &&
+make -f client.mk install &&
+
+# Many applications look for netscape when they need to open a browser...
+ln -v -sf firefox /usr/bin/netscape &&
+
+# Remove old links
+rm -f /usr/lib/mozilla &&
+rm -f /usr/lib/firefox &&
+rm -f /usr/lib/${1}/plugins/libjavaplugin_oji.so &&
+
+ln -v -sf ${1} /usr/lib/mozilla &&
+ln -v -sf ${1} /usr/lib/firefox &&
+# To use the installed Java plugin.
+ln -v -s ${JAVA_HOME}/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/${1}/plugins &&
+
+# Addition to /etc/ld.so.conf
+# This is necessary for shared library libmozjs.so (needed by gxine)
+string_add "/usr/lib/${1}" /etc/ld.so.conf &&
+
+ldconfig
+
+ # Return last error
+exit $?
diff --git a/stage3/cis-firewire b/stage3/cis-firewire
new file mode 100755 (executable)
index 0000000..c410fad
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Grabbing latest version of libraw1394
+svn co svn://svn.linux1394.org/libraw1394/trunk /usr/src/libraw1394 &&
+
+# Grabbing latest version of libiec61883
+svn co svn://svn.linux1394.org/libiec61883/trunk /usr/src/libiec61883 &&
+
+# Grabbing latest version of hv-firewire utilities
+svn co http://hugovil.com:8080/svn/firewire/trunk /usr/src/hv-firewire &&
+
+cd /usr/src/libraw1394 &&
+./autogen.sh &&
+./configure \
+    --prefix=/usr &&
+make &&
+make dev &&
+make install &&
+
+cd /usr/src/libiec61883 &&
+./autogen.sh &&
+./configure \
+    --prefix=/usr &&
+make &&
+make install &&
+
+cd /usr/src/hv-firewire &&
+#./autogen.sh &&
+#./configure \
+#    --prefix=/usr &&
+#make &&
+#make install &&
+
+# Firewire Start/Stop script
+install -v -m740 ${CUR_DIR}/bootscripts/firewire /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 firewire 80 40 &&
+
+# Firewire plugs daemon Start/Stop script
+install -v -m740 bootscripts/fwplugd /etc/rc.d/init.d &&
+
+chmod 740 /etc/rc.d/init.d/fwplugd
+
+# Return last error
+exit $?
diff --git a/stage3/cis-flashplugin b/stage3/cis-flashplugin
new file mode 100755 (executable)
index 0000000..433658f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PLUGINS_DIR=/usr/lib/firefox/plugins
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Decompression of a package
+# First argument: package name
+# Second argument: directory where decompressing (optional)
+decompress_package ${1} &&
+
+if [ ! -d ${PLUGINS_DIR} ]; then
+    echo "Plugins directory not found."
+    return 1
+fi &&
+
+install -v -m755 ${LFS_TMP}/${1}/flashplayer.xpt   ${PLUGINS_DIR} &&
+install -v -m755 ${LFS_TMP}/${1}/libflashplayer.so ${PLUGINS_DIR}
+
+# Return last error
+exit $?
diff --git a/stage3/cis-fontconfig b/stage3/cis-fontconfig
new file mode 100755 (executable)
index 0000000..b2e1e0d
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --disable-docs &&
+make &&
+make install &&
+# Manually installing documentation.
+cd ${LFS_TMP}/${1} &&
+install -v -m644 doc/*.3 /usr/share/man/man3 &&
+install -v -m644 doc/*.5 /usr/share/man/man5 &&
+install -v -m755 -d /usr/share/doc/${1}/fontconfig-devel &&
+install -v -m644 doc/*.{html,pdf,txt} /usr/share/doc/${1} &&
+install -v -m644 doc/fontconfig-devel/* /usr/share/doc/${1}/fontconfig-devel &&
+
+mkdir -v -p ${HV_FONTS_PATH}/{TrueType,Type1} &&
+mkdir -v -p /etc/fonts &&
+
+if [ -f /etc/fonts/local.conf ]; then
+    mv -v /etc/fonts/local.conf /etc/fonts/local.conf.old || exit 1
+fi &&
+
+# Adding X and our local fonts directory to local configuration file
+cat > /etc/fonts/local.conf << "EOF" &&
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<!-- /etc/fonts/local.conf file for local customizations -->
+<fontconfig>
+    <dir>_HV_FONTS_PATH_/TrueType</dir>
+    <dir>_HV_FONTS_PATH_/Type1</dir>
+    <dir>/usr/X11R6/lib/X11/fonts</dir>
+<dir>/usr/share/fonts/ghostscript</dir>
+</fontconfig>
+EOF
+
+sed -i -e "s!_HV_FONTS_PATH_!${HV_FONTS_PATH}!g" /etc/fonts/local.conf &&
+
+# Updating cache database.
+fc-cache -f
+
+# Return last error
+exit $?
diff --git a/stage3/cis-fox b/stage3/cis-fox
new file mode 100755 (executable)
index 0000000..ced855a
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Temporary: custom script needed to regenerate configure with
+# patch that modifies configure.in...
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-xft \
+    --enable-release &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-gcc3 b/stage3/cis-gcc3
new file mode 100755 (executable)
index 0000000..771b498
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/opt/${1} \
+    --enable-shared \
+    --enable-threads=posix \
+    --enable-languages=c,c++ &&
+make bootstrap &&
+make install &&
+
+# Addition to /etc/ld.so.conf
+string_add "/opt/${1}/lib" /etc/ld.so.conf &&
+ldconfig &&
+
+chown -v -R root:root \
+    /opt/${1}/lib/gcc/i686-pc-linux-gnu/$(get_pkg_ver ${1})/include &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage3/cis-getdate b/stage3/cis-getdate
new file mode 100755 (executable)
index 0000000..6a96516
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make &&
+make install &&
+make installman &&
+
+cat > /usr/local/bin/hvgetdate << EOF &&
+#!/bin/sh
+
+# Time server informations:
+# US VA: nist1.aol-va.truetime.com (205.188.185.33)
+# Location: AOL Time Warner facility, Dulles, Virginia
+# Synchronization: Lockclock Algorithm and ACTS dial-up, GPS-stabilized oscillator for short-term stabilization
+# Service Area: Eastern US
+# Access Policy: Open access for up to 20 queries per hour (one-day average) from any one address, others by arrangement
+# Contact: Judah Levine, jlevine@boulder.nist.gov, 303 492 7785
+NTP_HOST1=205.188.185.33
+
+#CA time.nrc.ca (132.246.168.148)
+#Location: National Research Council of Canada, Ottawa, Ontario, Canada
+#Geographic Coordinates: 45:27N, 75:37W
+#Synchronization: NTP V3 secondary (stratum 2), PC/Linux
+#Service Area: Canada
+#Access Policy: open access
+#Contact: time@nrc.ca
+#Note: time is an alias and the IP address may change; please use DNS. 
+NTP_HOST2=132.246.168.148
+
+echo -n "Synchronizing kernel time via NTP server:"
+getdate -adjust 1 600 \${NTP_HOST1} \${NTP_HOST2}
+exit 0
+EOF
+chmod 740 /usr/local/bin/hvgetdate &&
+
+# Adding fcron entry
+string_add "# Run after five minutes of execution the first time, then run every hours" \
+    /etc/fcron/fcrontab &&
+string_add "@mail(false),first(5) 6h /usr/local/bin/hvgetdate" \
+    /etc/fcron/fcrontab
+
+# Return last error
+exit $?
diff --git a/stage3/cis-git-manpages b/stage3/cis-git-manpages
new file mode 100755 (executable)
index 0000000..86ea138
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+cp -a * /usr/share/man
+
+# Return last error
+exit $?
diff --git a/stage3/cis-gsview b/stage3/cis-gsview
new file mode 100755 (executable)
index 0000000..3d01ba7
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# gsview uses netscape to browse through the online help. So simply edit srcunx/gvxreg.c
+# using the following sed script to use another browser:
+# Not GNU package
+cd ${LFS_TMP}/${1} &&
+mv srcunx/gvxreg.c srcunx/gvxreg.old &&
+cat srcunx/gvxreg.old | sed s/netscape/mozilla/ > srcunx/gvxreg.c &&
+sed 's|GSVIEW_ROOT=/usr/local|GSVIEW_ROOT=/usr|' srcunx/unx.mak > Makefile &&
+make &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage3/cis-guile b/stage3/cis-guile
new file mode 100755 (executable)
index 0000000..2d1bf38
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+sed -i -e '20,$ d' \
+       -e 's|slib)|&)\n(load-from-path "slib/guile.init")|' \
+       ice-9/slib.scm &&
+
+cd ${LFS_TMP}/${PACKAGE}-build &&
+../${PACKAGE}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-hal b/stage3/cis-hal
new file mode 100755 (executable)
index 0000000..3b66cad
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd -g 19 haldaemon &&
+hv_useradd -c HAL-Daemon-User -d /dev/null -u 19 \
+    -g haldaemon -s /bin/false haldaemon &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --libexecdir=/usr/lib/hal \
+    --localstatedir=/var \
+    --with-hwdata=/usr/share/pciutils/pci.ids &&
+make &&
+make install &&
+install -v -m755 -d /var/run/hald &&
+ldconfig &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/hald /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 hald 93 19
+
+# If the system-wide D-BUS daemon was running during the
+# installation of HAL, ensure you stop and restart the
+# D-BUS daemon before attempting to start the hald daemon.
+#/etc/rc.d/init.d/dbus restart &&
+
+# Starting daemon
+#/etc/rc.d/init.d/hal start
+
+# Return last error
+exit $?
diff --git a/stage3/cis-inetutils b/stage3/cis-inetutils
new file mode 100755 (executable)
index 0000000..3e4074a
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --infodir=/usr/share/info \
+    --mandir=/usr/share/man \
+    --disable-dependancy-tracking \
+    --disable-syslogd \
+    --with-pam \
+    --with-wrap &&
+make &&
+make install &&
+mv /usr/bin/ping /bin &&
+
+# Creating /etc/inetd.conf
+touch /etc/inetd.conf &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/inetd /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 inetd 30 60
+
+# Return last error
+exit $?
diff --git a/stage3/cis-iptables b/stage3/cis-iptables
new file mode 100755 (executable)
index 0000000..5b5587a
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make PREFIX=/usr &&
+make PREFIX=/usr install &&
+
+# Firewall boot script
+install -v -m740 ${CUR_DIR}/bootscripts/firewall /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 firewall 35 55
+
+# Return last error
+exit $?
diff --git a/stage3/cis-jadetex b/stage3/cis-jadetex
new file mode 100755 (executable)
index 0000000..c5a44c2
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i.orig -e "s/original texmf.cnf/modified texmf.cnf/" \
+    -e "s/memory hog.../&\npool_size.context = 750000/" \
+    $(kpsewhich texmf.cnf) &&
+cat >> $(kpsewhich texmf.cnf) << "EOF" &&
+
+% The following 3 sections added for JadeTeX
+
+% latex settings
+main_memory.latex = 1100000
+param_size.latex = 1500
+stack_size.latex = 1500
+hash_extra.latex = 15000
+string_vacancies.latex = 45000
+pool_free.latex = 47500
+nest_size.latex = 500
+save_size.latex = 5000
+pool_size.latex = 500000
+max_strings.latex = 55000
+font_mem_size.latex= 400000
+
+% jadetex settings
+main_memory.jadetex = 1500000
+param_size.jadetex = 1500
+stack_size.jadetex = 1500
+hash_extra.jadetex = 50000
+string_vacancies.jadetex = 45000
+pool_free.jadetex = 47500
+nest_size.jadetex = 500
+save_size.jadetex = 5000
+pool_size.jadetex = 500000
+max_strings.jadetex = 55000
+
+% pdfjadetex settings
+main_memory.pdfjadetex = 2500000
+param_size.pdfjadetex = 1500
+stack_size.pdfjadetex = 1500
+hash_extra.pdfjadetex = 50000
+string_vacancies.pdfjadetex = 45000
+pool_free.pdfjadetex = 47500
+nest_size.pdfjadetex = 500
+save_size.pdfjadetex = 5000
+pool_size.pdfjadetex = 500000
+max_strings.pdfjadetex = 55000
+
+EOF
+
+LATEX_FMT_DIR="$(kpsewhich -expand-var '$TEXMFSYSVAR')/web2c" &&
+mv -v $(kpsewhich latex.fmt) $(kpsewhich latex.fmt).orig &&
+mv -v $LATEX_FMT_DIR/latex.log $LATEX_FMT_DIR/latex.log.orig &&
+fmtutil-sys --byfmt latex &&
+
+make &&
+
+install -v -m755 -d \
+    $(kpsewhich -expand-var '$TEXMFLOCAL')/tex/jadetex/config &&
+install -v -m644 dsssl.def jadetex.ltx *.sty \
+    $(kpsewhich -expand-var '$TEXMFLOCAL')/tex/jadetex &&
+install -v -m644 {,pdf}jadetex.ini \
+    $(kpsewhich -expand-var '$TEXMFLOCAL')/tex/jadetex/config &&
+FMTUTIL_CNF="$(kpsewhich fmtutil.cnf)" &&
+mv $FMTUTIL_CNF $FMTUTIL_CNF.orig &&
+cat $FMTUTIL_CNF.orig - >> $FMTUTIL_CNF << "EOF" &&
+
+# JadeTeX formats:
+jadetex         etex            -               "&latex"     jadetex.ini
+pdfjadetex      pdfetex         -               "&pdflatex"  pdfjadetex.ini
+
+EOF
+mv -v $(kpsewhich -expand-var '$TEXMFMAIN')/ls-R \
+    $(kpsewhich -expand-var '$TEXMFMAIN')/ls-R.orig &&
+mv -v $(kpsewhich -expand-var '$TEXMFSYSVAR')/ls-R \
+    $(kpsewhich -expand-var '$TEXMFSYSVAR')/ls-R.orig &&
+mktexlsr &&
+fmtutil-sys --byfmt jadetex &&
+fmtutil-sys --byfmt pdfjadetex &&
+mktexlsr &&
+ln -v -sf etex /usr/bin/jadetex &&
+ln -v -sf pdfetex /usr/bin/pdfjadetex &&
+install -v -m644 -D index.html \
+    /usr/share/doc/jadetex-3.13/index.html &&
+install -v -m644 *.1 /usr/share/man/man1
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-java b/stage3/cis-java
new file mode 100755 (executable)
index 0000000..e053da0
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+install -v -d /usr/java &&
+cp -a ${LFS_TMP}/${1}/* /usr/java &&
+
+ln -svf ../java/bin/java /usr/bin/java &&
+
+var_add_path JAVA_HOME /etc/profile "/usr/java" &&
+var_export   JAVA_HOME /etc/profile
+
+# Return last error
+exit $?
diff --git a/stage3/cis-krb5 b/stage3/cis-krb5
new file mode 100755 (executable)
index 0000000..95f6ce8
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}/src &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var/lib \
+    --mandir=/usr/share/man \
+    --enable-dns \
+    --enable-static &&
+make &&
+make install &&
+mv -v /usr/bin/ksu /bin &&
+mv -v /usr/lib/libkrb5.so.3* /lib &&
+mv -v /usr/lib/libkrb4.so.2* /lib &&
+mv -v /usr/lib/libdes425.so.3* /lib &&
+mv -v /usr/lib/libk5crypto.so.3* /lib &&
+mv -v /usr/lib/libcom_err.so.3* /lib &&
+ln -v -sf ../../lib/libkrb5.so.3 /usr/lib/libkrb5.so &&
+ln -v -sf ../../lib/libkrb4.so.2 /usr/lib/libkrb4.so &&
+ln -v -sf ../../lib/libdes425.so.3 /usr/lib/libdes425.so &&
+ln -v -sf ../../lib/libk5crypto.so.3 /usr/lib/libk5crypto.so &&
+ln -v -sf ../../lib/libcom_err.so.3 /usr/lib/libcom_err.so &&
+ldconfig &&
+
+cat > /etc/krb5.conf << EOF
+[libdefaults]
+    default_realm = <LFS.ORG>
+    encrypt = true
+
+[realms]
+    <LFS.ORG> = {
+        kdc = <belgarath.lfs.org>
+        admin_server = <belgarath.lfs.org>
+    }
+
+[domain_realm]
+    .<lfs.org> = <LFS.ORG>
+
+[logging]
+    kdc = SYSLOG[:INFO[:AUTH]]
+    admin_server = SYSLOG[INFO[:AUTH]]
+    default = SYSLOG[[:SYS]]
+EOF
+
+# Return last error
+exit $?
diff --git a/stage3/cis-libid3tag b/stage3/cis-libid3tag
new file mode 100755 (executable)
index 0000000..acb5836
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+
+# Some packages check for the pkg-config file for libid3tag.
+# This file is particularly needed so that gst-plugins-ugly can
+# recognize the installed libid3tag.
+cat > /usr/lib/pkgconfig/id3tag.pc << "EOF" &&
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: id3tag
+Description: ID3 tag library
+Requires:
+Version: _LIBID3TAG_VERSION_
+Libs: -L${libdir} -lid3tag -lz
+Cflags: -I${includedir}
+EOF
+
+sed -i -e "s!_LIBID3TAG_VERSION_!$(get_pkg_ver ${1})!g" /usr/lib/pkgconfig/id3tag.pc &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-libmad b/stage3/cis-libmad
new file mode 100755 (executable)
index 0000000..00103fd
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+
+# Some packages check for the pkg-config file for libmad.
+# This file is particularly needed so that Cdrdao can
+# recognize the installed libmad.
+cat > /usr/lib/pkgconfig/mad.pc << "EOF" &&
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: mad
+Description: MPEG audio decoder
+Requires:
+Version: _LIBMAD_VERSION_
+Libs: -L${libdir} -lmad
+Cflags: -I${includedir}
+EOF
+
+sed -i -e "s!_LIBMAD_VERSION_!$(get_pkg_ver ${1})!g" /usr/lib/pkgconfig/mad.pc &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-libmng b/stage3/cis-libmng
new file mode 100755 (executable)
index 0000000..eb0ed8f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+cp makefiles/makefile.linux Makefile &&
+make prefix=/usr install &&
+
+# The documentation files are not installed by the installation procedure,
+# so they are copied manually.
+install -v -m644 doc/man/*.3 /usr/share/man/man3 &&
+install -v -m644 doc/man/*.5 /usr/share/man/man5 &&
+install -v -m755 -d /usr/share/doc/${1} &&
+install -v -m644 doc/*.{png,txt} /usr/share/doc/${1} &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-libusb b/stage3/cis-libusb
new file mode 100755 (executable)
index 0000000..4c01940
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --disable-build-docs &&
+make &&
+make install &&
+
+hv_groupadd -g 14 usb &&
+
+# Checking if string exists
+if ! grep "/proc/bus/usb" /etc/fstab 1> /dev/null 2>&1; then
+    echo "usbfs            /proc/bus/usb      usbfs    ddevgid=14,devmode=0660  0 0" >> /etc/fstab || exit 1
+fi &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-ltsp b/stage3/cis-ltsp
new file mode 100755 (executable)
index 0000000..8574edb
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+LTSROOT="/opt/ltsp/i386"
+MAC_ADDRESS="01-00-40-63-c0-35-8f"
+LTSP_KERNEL="2.6.17.8-ltsp-1"
+LTSP_SERVER="192.168.0.4"
+
+if [ -d /tftpboot ]; then
+    if [ -d /srv/tftpboot ]; then
+       rm -v -rf /srv/tftpboot || exit 1
+    fi
+
+    mv -v /tftpboot /srv/tftpboot || exit 1
+fi
+
+cd /srv/tftpboot/lts/${LTSP_KERNEL}/pxelinux.cfg &&
+ln -v -s -f default ${MAC_ADDRESS} &&
+
+cat > ${LTSROOT}/etc/lts.conf << "EOF" &&
+[Default]
+  # Uncomment to use custom XF86Config:
+  ### XF86CONFIG_FILE = /tmp/XF86Config.1
+
+  RAMDISK_SIZE       = "8192"
+
+  SERVER             = _LTSP_SERVER_
+  XSERVER            = trident
+  X_HORZSYNC         = "31.5-80"
+  X_VERTREFRESH      = "60-70"
+  X_COLOR_DEPTH      = 16
+  X_MODE_0           = 1280x1024
+  X_MODE_1           = 1024x768
+
+  # Keyboard configuration
+  XkbLayout          = "ca_enhanced"
+
+  # Mouse configuration
+  X_MOUSE_PROTOCOL    = "IMPS/2"
+  X_MOUSE_DEVICE      = "/dev/input/mice"
+
+  X_MOUSE_RESOLUTION  = "400"
+  X_MOUSE_BUTTONS     = "5"
+  X_MOUSE_EMULATE3BTN = "Y"
+  X_ZAxisMapping      = "4 5"
+
+  USE_XFS            = N
+  LOCAL_APPS         = N
+  USE_NFS_SWAP       = N
+
+  SCREEN_01          = startx
+  SCREEN_02          = shell
+
+  SOUND = Y
+  SOUND_DAEMON = esd
+EOF
+
+sed -i -e "s!_LTSP_SERVER_!${LTSP_SERVER}!g" ${LTSROOT}/etc/lts.conf &&
+
+# LTSP-4.2 update 4: The "-public" option is absolutely necessary...
+sed -i -e "s!\( */bin/esd -nobeeps -tcp -port 16001\)\( -as 1 &\)!\1 -public\2!g" \
+    ${LTSROOT}/etc/rc.sound &&
+
+string_add "${LTSROOT}   192.168.0.0/24(rw,sync,no_root_squash)" /etc/exports &&
+
+string_add "option root-path  \"${LTSP_SERVER}:${LTSROOT}\";" /etc/dhcpd.conf &&
+
+# no spaces but tabs to separate items.
+sed -i -e "s!^#\*\(.*#any host.*\)!\*\1!g" /etc/X11/xdm/Xaccess &&
+
+# By default this line is set, so that it is not listening to XDMCP connection.
+# This is for security reasons.
+sed -i -e "s%\(^DisplayManager\.requestPort:.*\)%!\1%g" /etc/X11/xdm/xdm-config
+
+exit $?
diff --git a/stage3/cis-ltsp-utils b/stage3/cis-ltsp-utils
new file mode 100755 (executable)
index 0000000..cd7a89f
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/ltsp-utils &&
+./install.sh
+
+# Return last error
+exit $?
diff --git a/stage3/cis-mailman b/stage3/cis-mailman
new file mode 100755 (executable)
index 0000000..16ce27a
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+MMPREFIX="/usr/lib/mailman"
+
+hv_groupadd mailman &&
+hv_useradd -c "GNU-Mailman" -d ${MMPREFIX} -g mailman -s /bin/false mailman &&
+
+# Creating installation directory with correct permissions and ownerships.
+install --owner=mailman --group=mailman --mode=02775 -d ${MMPREFIX} &&
+
+# Problems when using a separate build directory
+cd ${LFS_TMP}/${1} &&
+../${1}/configure \
+    --prefix=${MMPREFIX} \
+    --with-cgi-gid=${APACHE_USER} \
+    --with-mail-gid=${SENDMAIL_GID} \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+# Checking installation directory permissions
+${MMPREFIX}/bin/check_perms -f &&
+
+# Configure the web server to enable CGI script permission in the $prefix/cgi-bin
+# to run CGI scripts.
+string_add "ScriptAlias /mailman/ ${MMPREFIX}/cgi-bin/" /etc/apache/httpd.conf
+
+# Creating directory for mailman icons with correct permissions and ownerships.
+install --owner=mailman --group=mailman --mode=2775 -d /srv/www/icons/mailman &&
+# Copy the Mailman, Python, and GNU logos to a location accessible to the web server.
+cp ${MMPREFIX}/icons/*.{jpg,png} /srv/www/icons/mailman &&
+# Specify location of icons directory in mailman configuration file.
+string_add "IMAGE_LOGOS = '/icons/mailman/'" ${MMPREFIX}/Mailman/mm_cfg.py &&
+
+# Addition to /etc/apache/httpd.conf
+# First, checking if section exists
+if ! grep "/pipermail/" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
+    echo "Alias /pipermail/ ${MMPREFIX}/archives/public/" >> /etc/apache/httpd.conf &&
+    echo "<Directory /usr/lib/mailman/archives/public/>" >> /etc/apache/httpd.conf &&
+    echo "    Options FollowSymLinks" >> /etc/apache/httpd.conf &&
+    echo "    AllowOverride None" >> /etc/apache/httpd.conf &&
+    echo "    AddDefaultCharset Off" >> /etc/apache/httpd.conf &&
+    echo "</Directory>" >> /etc/apache/httpd.conf || exit 1
+fi &&
+
+# Setting default password
+/usr/lib/mailman/bin/mmsitepass mailman &&
+
+# Adding cron entries
+cat > /etc/fcron/mailman.crontab << "EOF" &&
+#
+# !mailto(postmaster)
+#
+# This is needed because the mailman user doesn't have a
+# login shell defined in /etc/passwd.
+SHELL = /bin/sh
+#
+# At 8AM every day, mail reminders to admins as to pending requests.
+# They are less likely to ignore these reminders if they're mailed
+# early in the morning, but of course, this is local time... ;)
+0 8 * * * /usr/bin/python -S _MMPREFIX_/cron/checkdbs
+#
+# At 9AM, send notifications to disabled members that are due to be
+# reminded to re-enable their accounts.
+0 9 * * * /usr/bin/python -S _MMPREFIX_/cron/disabled
+#
+# Noon, mail digests for lists that do periodic as well as threshhold delivery.
+0 12 * * * /usr/bin/python -S _MMPREFIX_/cron/senddigests
+#
+# 5 AM on the first of each month, mail out password reminders.
+0 5 1 * * /usr/bin/python -S _MMPREFIX_/cron/mailpasswds
+#
+# Every 5 mins, try to gate news to mail.  You can comment this one out
+# if you don't want to allow gating, or don't have any going on right now,
+# or want to exclusively use a callback strategy instead of polling.
+#0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/python -S _MMPREFIX_/cron/gate_news
+#
+# At 3:27am every night, regenerate the gzip'd archive file.  Only
+# turn this on if the internal archiver is used and
+# GZIP_ARCHIVE_TXT_FILES is false in mm_cfg.py
+#27 3 * * * /usr/bin/python -S _MMPREFIX_/cron/nightly_gzip
+EOF
+sed -i -e "s!_MMPREFIX_!${MMPREFIX}!g" /etc/fcron/mailman.crontab &&
+string_add "fcrontab -u mailman -c /etc/fcron/fcron.conf /etc/fcron/mailman.crontab" \
+    /etc/fcron/configure &&
+# Reloading cron configuration
+/etc/fcron/configure &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/mailman /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 mailman 75 15 &&
+
+# URL
+string_add "DEFAULT_EMAIL_HOST = '_DOMAIN_'" ${MMPREFIX}/Mailman/mm_cfg.py &&
+string_add "DEFAULT_URL_HOST = 'www._DOMAIN_'" ${MMPREFIX}/Mailman/mm_cfg.py || exit 1
+if test -n ${HTTPD_PORT}; then
+    string_add "DEFAULT_URL_PATTERN = 'http://%s:_DOMAIN_/mailman'" ${MMPREFIX}/Mailman/mm_cfg.py &&
+    string_add "PUBLIC_ARCHIVE_URL = 'http://%(hostname)s:_HTTPD_PORT_/pipermail/%(listname)s'" ${MMPREFIX}/Mailman/mm_cfg.py || exit 1
+fi
+string_add "add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" \
+    ${MMPREFIX}/Mailman/mm_cfg.py &&
+sed -i -e "s!_HTTPD_PORT_!${HTTPD_PORT}!g" ${MMPREFIX}/Mailman/mm_cfg.py &&
+sed -i -e "s!_DOMAIN_!${DOMAIN}!g" ${MMPREFIX}/Mailman/mm_cfg.py
+
+# Return last error
+exit $?
diff --git a/stage3/cis-milter-greylist b/stage3/cis-milter-greylist
new file mode 100755 (executable)
index 0000000..836fcdc
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var/run &&
+make &&
+make install &&
+
+# Configuration file
+cat > /etc/mail/greylist.conf << EOF
+# greylist.conf
+
+pidfile "/var/run/milter-greylist/milter-greylist.pid"
+socket "/var/run/milter-greylist/milter-greylist.sock"
+dumpfile "/var/run/milter-greylist/greylist.db"
+user "root"
+
+# Be verbose (or use -v flag)
+verbose
+
+# Do not tell spammer how long they have to wait
+quiet
+
+# Your own network, which should not suffer greylisting
+list "my network" addr { 127.0.0.1/8 192.168.0.0/24 }
+
+# This is a list of broken MTAs that break with greylisting. Derived from
+# http://cvs.puremagic.com/viewcvs/greylisting/schema/whitelist_ip.txt?rev=1.16
+list "broken mta" addr {   \
+       12.5.136.141/32    \ # Southwest Airlines (unique sender)
+       12.5.136.142/32    \ # Southwest Airlines
+       12.5.136.143/32    \ # Southwest Airlines
+       12.5.136.144/32    \ # Southwest Airlines
+       12.107.209.244/32  \ # kernel.org (unique sender)
+       12.107.209.250/32  \ # sourceware.org (unique sender)
+       63.82.37.110/32    \ # SLmail
+       63.169.44.143/32   \ # Southwest Airlines
+       63.169.44.144/32   \ # Southwest Airlines
+       64.7.153.18/32     \ # sentex.ca (common pool)
+       64.12.136.0/24     \ # AOL (common pool)
+       64.12.137.0/24     \ # AOL
+       64.12.138.0/24     \ # AOL
+       64.124.204.39      \ # moveon.org (unique sender)
+       64.125.132.254/32  \ # collab.net (unique sender)
+       66.94.237.16/28    \ # Yahoo Groups servers (common pool)
+       66.94.237.32/28    \ # Yahoo Groups servers (common pool)
+       66.94.237.48/30    \ # Yahoo Groups servers (common pool)
+       66.100.210.82/32   \ # Groupwise?
+       66.135.192.0/19    \ # Ebay
+       66.162.216.166/32  \ # Groupwise?
+       66.206.22.82/32    \ # Plexor
+       66.206.22.83/32    \ # Plexor
+       66.206.22.84/32    \ # Plexor
+       66.206.22.85/32    \ # Plexor
+       66.218.66.0/23     \ # Yahoo Groups servers (common pool)
+       66.218.67.0/23     \ # Yahoo Groups servers (common pool)
+       66.218.68.0/23     \ # Yahoo Groups servers (common pool)
+       66.218.69.0/23     \ # Yahoo Groups servers (common pool)
+       66.27.51.218/32    \ # ljbtc.com (Groupwise)
+       152.163.225.0/24   \ # AOL
+       194.245.101.88/32  \ # Joker.com
+       195.235.39.19/32   \ # Tid InfoMail Exchanger v2.20
+       195.238.2.0/24     \ # skynet.be (wierd retry pattern, common pool)
+       195.238.3.0/24     \ # skynet.be
+       195.46.220.208/32  \ # mgn.net
+       195.46.220.209/32  \ # mgn.net
+       195.46.220.210/32  \ # mgn.net
+       195.46.220.211/32  \ # mgn.net
+       195.46.220.221/32  \ # mgn.net
+       195.46.220.222/32  \ # mgn.net
+       195.238.2.0/24     \ # skynet.be (wierd retry pattern)
+       195.238.3.0/24     \ # skynet.be
+       204.107.120.10/32  \ # Ameritrade (no retry)
+       205.188.0.0/16     \ # AOL
+       205.206.231.0/24   \ # SecurityFocus.com (unique sender)
+       207.115.63.0/24    \ # Prodigy - retries continually
+       207.171.168.0/24   \ # Amazon.com
+       207.171.180.0/24   \ # Amazon.com
+       207.171.187.0/24   \ # Amazon.com
+       207.171.188.0/24   \ # Amazon.com
+       207.171.190.0/24   \ # Amazon.com
+       209.132.176.174/32 \ # sourceware.org mailing lists (unique sender)
+       211.29.132.0/24    \ # optusnet.com.au (wierd retry pattern)
+       213.136.52.31/32   \ # Mysql.com (unique sender)
+       216.33.244.0/24    \ # Ebay
+       217.158.50.178/32  \ # AXKit mailing list (unique sender)
+}
+
+# List of users that want greylisting
+list "grey users" rcpt {  \
+       *@mydomain.com \
+}
+
+# List of senders that are automatically whitelisted
+list "white users" from { \
+     user@domain1 \
+     user@domain2 \
+}
+
+# Perform DNS Reverse Black List verification
+dnsrbl "SORBS DUN" dnsbl.sorbs.net 127.0.0.10
+
+# And here is the access list
+acl whitelist addr 127.0.0.0/8
+acl whitelist addr 192.168.0.0/24 
+
+acl greylist list "grey users" dnsrbl "SORBS DUN" delay 24h autowhite 3d
+acl greylist list "grey users" delay 10m autowhite 10d
+acl whitelist list "white users"
+acl whitelist default
+EOF
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/milter-greylist /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 milter-greylist 57 33 &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-milter-spf b/stage3/cis-milter-spf
new file mode 100755 (executable)
index 0000000..7f9ff44
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make &&
+make PREFIX=/usr install
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/milter-spf /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 milter-spf 56 34
+
+# Return last error
+exit $?
diff --git a/stage3/cis-mplayer b/stage3/cis-mplayer
new file mode 100755 (executable)
index 0000000..3817eee
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+CFLAGS="-pipe -O2 -fomit-frame-pointer -march=athlon-xp"
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+CODECS_PATH=/usr/lib/mplayer/codecs
+SKIN_PATH=/usr/share/mplayer/Skin
+
+# First, install skins
+install -v -d -m755 ${SKIN_PATH} &&
+cp -v -a ${LFS_TMP}/${1}/Skin/* ${SKIN_PATH} &&
+chown -v -R root:root ${SKIN_PATH} &&
+chmod -v 755 ${SKIN_PATH}/Blue{,/icons} &&
+ln -sfv Blue ${SKIN_PATH}/default &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --confdir=/etc/mplayer \
+    --enable-largefiles \
+    --enable-dynamic-plugins \
+    --enable-gui \
+    --with-codecsdir=${CODECS_PATH} &&
+make &&
+make install &&
+install -v -m755 -d /usr/share/doc/${1} &&
+cp -v -R DOCS/*     /usr/share/doc/${1} &&
+
+install -m644 etc/codecs.conf /etc/mplayer &&
+install -m644 etc/*.conf /etc/mplayer &&
+
+# MPlayer requires that the RTC run at a frequency of 1024 Hz.
+# Make this setting change at boot-time by adding a line to /etc/sysctl.conf:
+if [ ! -f /etc/sysctl.conf ]; then
+    touch /etc/sysctl.conf || exit 1
+fi &&
+
+string_add "dev.rtc.max-user-freq=1024" /etc/sysctl.conf &&
+
+ldconfig &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage3/cis-mplayer-codecs b/stage3/cis-mplayer-codecs
new file mode 100755 (executable)
index 0000000..ec58a3a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+CODECS_PATH=/usr/lib/mplayer/codecs
+
+install -v -d -m755 ${CODECS_PATH} &&
+install -v -m644 ${LFS_TMP}/${1}/* ${CODECS_PATH}
+
+# Return last error
+exit $?
diff --git a/stage3/cis-mysql b/stage3/cis-mysql
new file mode 100755 (executable)
index 0000000..f89ac65
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd mysql &&
+hv_useradd -c mysql -d /dev/null -g mysql -s /bin/false mysql &&
+
+cd ${LFS_TMP}/${1} &&
+CPPFLAGS="-D_GNU_SOURCE" ./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --libexecdir=/usr/sbin \
+    --localstatedir=/srv/mysql \
+    --enable-thread-safe-client \
+    --enable-assembler \
+    --enable-local-infile \
+    --with-named-thread-libs=-lpthread \
+    --with-unix-socket-path=/var/run/mysql/mysql.sock \
+    --without-debug \
+    --without-bench \
+    --without-readline &&
+make testdir=/usr/lib/mysql/mysql-test &&
+make testdir=/usr/lib/mysql/mysql-test install &&
+cd /usr/lib &&
+ln -sf mysql/libmysqlclient{,_r}.so* . &&
+
+# Copying default configuration file.
+cp /usr/share/mysql/my-medium.cnf /etc/my.cnf &&
+
+mysql_install_db --user=mysql &&
+chgrp mysql /srv/mysql{,/test,/mysql} &&
+
+install -m750 -o mysql -g mysql -d /var/run/mysql &&
+
+# Further configuration requires that the MySQL server be running (see cis-postinstall)
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/mysql /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 mysql 45 45 &&
+
+# Addition to /etc/ld.so.conf
+string_add "/usr/lib/mysql" /etc/ld.so.conf &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-nss b/stage3/cis-nss
new file mode 100755 (executable)
index 0000000..5dea3fe
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Define to 1 to test this package.
+RUN_TESTS=0
+
+cd ${LFS_TMP}/${1} &&
+export WORKINGDIR=${PWD} &&
+
+# Non-debug optimized build
+export BUILD_OPT=1 &&
+
+cd mozilla/security/nss &&
+make nss_build_all &&
+
+cd ../.. &&
+
+export NSS_LINUXDIR=$(basename `ls -d $WORKINGDIR/mozilla/dist/Linux*`) || exit 1
+
+if [ ${RUN_TESTS} -eq 1 ]; then
+    # Running tests
+    export DOMSUF="${DOMAIN}" &&
+    export PATH=$PATH:$WORKINGDIR/mozilla/dist/$NSS_LINUXDIR/bin &&
+    export TEST_RESULTSDIR=$WORKINGDIR/mozilla/tests_results/security &&
+    cd security/nss/tests &&
+    sed -i 's/gmake/make/' common/init.sh &&
+    ./all.sh &&
+    TEST_RESULTS=$(grep Passed $TEST_RESULTSDIR/$(hostname --short).1/results.html | wc -l) || exit 1
+    if [ ${TEST_RESULTS} -ne 770 ]; then
+       echo "Number of tests that passed: ${TEST_RESULTS}"
+       echo "Number of tests expected to pass: 770"
+       exit 1
+    fi
+fi
+
+cd ${LFS_TMP}/${1}/mozilla &&
+install -v -m755 nsprpub/$NSS_LINUXDIR/config/nspr-config /usr/bin &&
+#install -v -m755 -d /usr/lib/pkgconfig &&
+#install -v -m644 nsprpub/lib/pkgconfig/nspr.pc \
+#    security/nss/lib/pkgconfig/nss.pc \
+#   /usr/lib/pkgconfig &&
+
+cd dist &&
+install -v -m755 $NSS_LINUXDIR/lib/*.so /usr/lib &&
+install -v -m644 $NSS_LINUXDIR/lib/{*.chk,libcrmf.a} /usr/lib &&
+install -v -m755 -d /usr/include/{nss,nspr} &&
+install -v -m644 {public,private}/nss/* /usr/include/nss &&
+cp -v -RL $NSS_LINUXDIR/include/* /usr/include/nspr &&
+chmod -v 644 /usr/include/nspr/prvrsion.h &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-openjade b/stage3/cis-openjade
new file mode 100755 (executable)
index 0000000..b56c9e5
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --enable-http \
+    --disable-static \
+    --enable-default-catalog=/etc/sgml/catalog \
+    --enable-default-search-path=/usr/share/sgml \
+    --datadir=/usr/share/sgml/${1} &&
+make &&
+make install &&
+ln -sf openjade /usr/bin/jade &&
+ln -sf libogrove.so /usr/lib/libgrove.so &&
+ln -sf libospgrove.so /usr/lib/libspgrove.so &&
+ln -sf libostyle.so /usr/lib/libstyle.so &&
+install -m644 dsssl/catalog /usr/share/sgml/${1}/ &&
+install -m644 dsssl/*.{dtd,dsl,sgm} /usr/share/sgml/${1} &&
+install-catalog --add /etc/sgml/${1}.cat \
+    /usr/share/sgml/${1}/catalog &&
+install-catalog --add /etc/sgml/sgml-docbook.cat \
+    /etc/sgml/${1}.cat &&
+
+var_add_path "SGML_BASE_DIR" /etc/profile "/usr/share/sgml" &&
+var_export   "SGML_BASE_DIR" /etc/profile &&
+
+var_add_path "SGML_CATALOGS_DIR" /etc/profile "/etc/sgml" &&
+var_export   "SGML_CATALOGS_DIR" /etc/profile
+
+# Return last error
+exit $?
diff --git a/stage3/cis-openldap b/stage3/cis-openldap
new file mode 100755 (executable)
index 0000000..cea38da
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --sysconfdir=/etc \
+    --localstatedir=/srv/ldap \
+    --disable-debug \
+    --enable-dynamic \
+    --enable-crypt \
+    --enable-modules \
+    --enable-rlookups \
+    --enable-backends \
+    --enable-overlays &&
+make depend &&
+make &&
+make install &&
+
+for LINK in lber ldap ldap_r; do
+    chmod -v 0755 /usr/lib/$(readlink /usr/lib/lib${LINK}.so)
+done &&
+
+cd ${LFS_TMP}/${1} &&
+install -v -m755 -d /usr/share/doc/${1}/{drafts,guide,rfc} &&
+install -v -m644 doc/drafts/* /usr/share/doc/${1}/drafts &&
+install -v -m644 doc/rfc/*    /usr/share/doc/${1}/rfc &&
+cp -v -R doc/guide/*          /usr/share/doc/${1}/guide
+
+# Only the slapd daemon is needed.
+# The slurpd daemon is used for coordinating multiple LDAP servers so they
+# cooperate in a hierarchy, much like DNS servers.
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/openldap /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 openldap 60 30
+
+# Return last error
+exit $?
diff --git a/stage3/cis-opensp b/stage3/cis-opensp
new file mode 100755 (executable)
index 0000000..9860a5e
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Remove the old catalog items prior to upgrading...
+# First test for presence of 'install-catalog' program
+install-catalog -v 1> /dev/null 2>&1
+if [ $? -eq 0 ]; then
+    # The following commands may fail if this is the first time
+    # that this package is installed. So we do not check the return value.
+    install-catalog --remove /etc/sgml/${1}.cat \
+       /usr/share/sgml/${1}/catalog
+    install-catalog --remove /etc/sgml/sgml-docbook.cat \
+       /etc/sgml/${1}.cat
+fi
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+
+cd ${LFS_TMP}/${1} &&
+
+# These seds prevent some annoying messages that may otherwise appear while running openjade.
+sed -i 's:32,:253,:' lib/Syntax.cxx &&
+sed -i 's:LITLEN          240 :LITLEN          8092:' \
+    unicode/{gensyntax.pl,unicode.syn} &&
+./configure \
+    --prefix=/usr \
+    --disable-static \
+    --disable-doc-build \
+    --enable-http \
+    --enable-default-catalog=/etc/sgml/catalog \
+    --enable-default-search-path=/usr/share/sgml &&
+make pkgdatadir=/usr/share/sgml/${1} &&
+make pkgdatadir=/usr/share/sgml/${1} install &&
+ln -sf onsgmls /usr/bin/nsgmls &&
+ln -sf osgmlnorm /usr/bin/sgmlnorm &&
+ln -sf ospam /usr/bin/spam &&
+ln -sf ospcat /usr/bin/spcat &&
+ln -sf ospent /usr/bin/spent &&
+ln -sf osx /usr/bin/sx &&
+ln -sf osx /usr/bin/sgml2xml &&
+ln -sf libosp.so /usr/lib/libsp.so
+
+#install-catalog --add /etc/sgml/${1}.cat \
+#    /usr/share/sgml/${1}/catalog &&
+#install-catalog --add /etc/sgml/sgml-docbook.cat \
+#    /etc/sgml/${1}.cat
+
+# Return last error
+exit $?
diff --git a/stage3/cis-opera b/stage3/cis-opera
new file mode 100755 (executable)
index 0000000..d18e4dc
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+echo "y" | ./install.sh &&
+
+# Installing French language file
+decompress_package ${OPERA_LANG_FR} /usr/share/opera/locale
+
+# Return last error
+exit $?
diff --git a/stage3/cis-php b/stage3/cis-php
new file mode 100755 (executable)
index 0000000..dbab987
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i 's/const char \*errpfx,/const DB_ENV *dbenv, & const/' ext/dba/dba_db4.c &&
+
+
+# Since PHP 5, you need to explicitly bundle PHP with MySQL by --with-mysql directive
+# (make sure you specified path to where MySQL is installed on your system).
+
+# Build directory doesn't work:
+# gcc: Zend/zend_language_scanner.c: No such file or directory
+
+#     --enable-memory-limit : only for php lower than php-5.2...
+
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-apxs2=/usr/sbin/apxs \
+    --enable-force-cgi-redirect \
+    --enable-discard-path \
+    --with-config-file-path=/etc \
+    --with-zlib \
+    --enable-bcmath \
+    --with-bz2 \
+    --with-gd \
+    --with-freetype-dir=/usr \
+    --with-t1lib \
+    --enable-memory-limit \
+    --enable-gd-native-ttf \
+    --enable-calendar \
+    --enable-dba \
+    --enable-exif \
+    --enable-ftp \
+    --with-gettext \
+    --enable-mbstring \
+    --with-ncurses \
+    --with-readline \
+    --with-openssl=/usr \
+    --with-ldap \
+    --with-mysql=/usr \
+    --with-imap=/usr/lib/uw-imap \
+    --with-imap-ssl=/usr/include/openssl &&
+make &&
+make install || exit 1
+
+if [ -f /etc/php.ini ]; then
+    cp /etc/php.ini /etc/php.ini.old || exit 1
+fi
+cp ../${1}/php.ini-dist /etc/php.ini || exit 1
+
+# To enable PHP support in the Apache web server, a new AddType directive
+# must be added to the httpd.conf file.
+if ! grep "application/x-httpd-php" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
+    echo "AddType application/x-httpd-php .php" >> /etc/apache/httpd.conf || exit 1
+fi
+
+if ! grep "DirectoryIndex" /etc/apache/httpd.conf | grep "index.php" 1> /dev/null 2>&1; then
+    sed -i -e "s!\(^DirectoryIndex index.html.*\)!\1 index.php!g" /etc/apache/httpd.conf || exit 1
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-pm b/stage3/cis-pm
new file mode 100755 (executable)
index 0000000..d01cafb
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+# The option "-n" is used to avoid having to answer a question and accept the
+# default configuration.
+perl Makefile.PL -n &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-pm-net-dns b/stage3/cis-pm-net-dns
new file mode 100755 (executable)
index 0000000..7a76741
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+# The option "-n" is used to avoid having to answer a question and accept the
+# default configuration.
+perl Makefile.PL -n --no-online-tests &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-postinstall b/stage3/cis-postinstall
new file mode 100755 (executable)
index 0000000..70efd79
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    
+    #########################################
+    # MySQL
+    #########################################
+    READ_VALID="no"
+    
+    while [ "${READ_VALID}" = "no" ]; do
+       echo "Do you want to set MySQL root password? (y/n): "
+       read SET_MYSQL_ROOT_PASS
+       
+       if [ "${SET_MYSQL_ROOT_PASS}" = "y" -o "${SET_MYSQL_ROOT_PASS}" = "n" ]; then
+           READ_VALID="yes"
+       else
+           echo "Error, answer y or n"
+       fi
+    done
+    
+    if [ "${SET_MYSQL_ROOT_PASS}" = "y" ]; then
+       # Further configuration requires that the MySQL server be running: 
+       mysqld_safe --user=mysql 2>&1 >/dev/null &
+       evaluate_retval
+       
+       PASS_MATCH="no"
+       
+       while [ "${PASS_MATCH}" = "no" ]; do
+           echo -n "Enter new MySQL root password: " >&2
+           read PASS1
+           echo -n "Re-enter password to confirm : " >&2
+           read PASS2
+           
+           if [ "${PASS1}" != "${PASS2}" ]; then
+               echo "Error, passwords don't match"
+           else
+               PASS_MATCH="yes"
+           fi
+       done
+       
+       mysqladmin -u root password ${PASS1} || exit 1
+       echo "MySQL root password set."
+       
+       echo "Shutting down MySQL server:"
+       # Configuration of the server is now finished. Shuting down the server.
+       mysqladmin -p shutdown || exit 1
+    fi
+
+    #########################################
+    # Apache
+    #########################################
+    READ_VALID="no"
+    
+    while [ "${READ_VALID}" = "no" ]; do
+       echo "Do you want to generate SSL self-signed"
+       echo -n "certificate for Apache? (y/n): "
+       read USE_SSL
+       
+       if [ "${USE_SSL}" = "y" -o "${USE_SSL}" = "n" ]; then
+           READ_VALID="yes"
+       else
+           echo "Error, answer y or n"
+       fi
+    done
+    
+    if [ "${USE_SSL}" = "y" ]; then
+       /etc/apache/generate-ssl-certs || exit 1
+    fi
+    
+    #########################################
+    # imap
+    #########################################
+    READ_VALID="no"
+    
+    while [ "${READ_VALID}" = "no" ]; do
+       echo "Do you want to generate SSL self-signed"
+       echo -n "certificate for IMAP server? (y/n): "
+       read USE_SSL
+       
+       if [ "${USE_SSL}" = "y" -o "${USE_SSL}" = "n" ]; then
+           READ_VALID="yes"
+       else
+           echo "Error, answer y or n"
+       fi
+    done
+    
+    if [ "${USE_SSL}" = "y" ]; then
+       /etc/mail/imap-ssl-certs || exit 1
+    fi
+    
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-procmail b/stage3/cis-procmail
new file mode 100755 (executable)
index 0000000..0ec58b8
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make \
+    BASENAME=/usr \
+    LOCKINGTEST=/tmp \
+    install &&
+make install-suid &&
+
+cat > /etc/procmailrc << "EOF" &&
+# /etc/procmailrc
+#
+SHELL=/bin/sh
+PATH=/bin:/usr/bin:/usr/sbin
+MAILDIR=/var/mail
+LOGFILE=/var/log/procmail.log
+LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
+#DEFAULT=$MAILDIR/${LOGNAME}
+VERBOSE=yes
+
+# The default internal egrep of procmailrc igore case.
+
+##################################
+# Clam AV
+##################################
+# A recipe to match a From line:
+:0
+* ^Subject: Virus intercepted
+clamav
+
+# All mail destined to spam@yourdomain and to ham@yourdomain should go
+# directly to the spam-sure and ham mail folders respectively.
+# This rule is usefull because we don't need to setup a spam or
+# ham account on the mail server.
+:0
+* ^To:.*spam@_DOMAIN_
+spam-sure
+:0
+* ^To:.*ham@_DOMAIN_
+ham
+
+
+##################################
+# SpamAssassin
+##################################
+# The condition line ensures that only messages smaller than 250 kB
+# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
+# isn't bigger than a few k and working with big messages can bring
+# SpamAssassin to its knees.
+#
+# The lock file ensures that only 1 spamassassin invocation happens
+# at 1 time, to keep the load down.
+#
+:0fw: spamassassin.lock
+* < 256000
+| /usr/bin/spamassassin
+
+# All mail tagged as spam (eg. with a score higher than the set threshold)
+# is moved to "spam".
+:0:
+* ^X-Spam-Status: Yes
+spam
+
+##################################
+# Last resort rule
+##################################
+# Accept all the rest to your default mailbox
+:0:
+${DEFAULT}
+EOF
+
+DOMAIN1=$(echo ${DOMAIN} | sed "s!\(.*\)\.\(.*\)!\1!") &&
+DOMAIN2=$(echo ${DOMAIN} | sed "s!\(.*\)\.\(.*\)!\2!") &&
+sed -i -e "s!_DOMAIN_!${DOMAIN1}\\\.${DOMAIN2}!g" /etc/procmailrc
+
+# Return last error
+exit $?
diff --git a/stage3/cis-pulseaudio b/stage3/cis-pulseaudio
new file mode 100755 (executable)
index 0000000..ddf5539
--- /dev/null
@@ -0,0 +1,118 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd pulse &&
+hv_groupadd pulse-access &&
+hv_useradd -g pulse -d /var/run/pulse pulse &&
+
+gpasswd -a hugo pulse-access
+
+# Il faut ajouter l'usager pulse au groupe audio.
+gpasswd -a pulse audio
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var &&
+# Workaround pour Ã©liminer les messages de warning
+# reliés Ã  SHM...
+sed -i -e "s!\(#define HAVE_SHM_OPEN 1\)!/* \1 */!g" config.h &&
+
+make &&
+make install &&
+ldconfig &&
+
+cat > /etc/pulse/daemon.conf << "EOF" &&
+## Extra verbositiy
+verbose = debug
+
+## Daemonize after startup
+daemonize = 1
+
+## Quit if startup fails
+fail = 1
+
+## Renice the daemon to level -15 and try to get SCHED_FIFO
+## scheduling. This a good idea if you hear annyoing noise in the
+## playback. However, this is a certain security issue, since it works 
+## when called SUID root only. root is dropped immediately after gaining
+## the nice level and SCHED_FIFO scheduling on startup.
+high-priority = 1
+
+## The resampling algorithm to use. Use one of src-sinc-best-quality,
+## src-sinc-medium-quality, src-sinc-fastest, src-zero-order-hold,
+## src-linear, trivial. See the documentation of libsamplerate for an
+## explanation for the different methods. The method 'trivial' is the
+## only algorithm implemented without usage of floating point
+## numbers. If you're tight on CPU consider using this. On the other
+## hand it has the worst quality of all.
+resample-method = src-sinc-best-quality
+
+## Create a PID file in /tmp/pulseaudio-$USER/pid. Of this is enabled
+## you may use commands like "pulseaudio --kill" or "pulseaudio
+## --check". If you are planning to start more than one pulseaudio
+## process per user, you better disable this option since it
+## effectively disables multiple instances.
+use-pid-file = 1
+
+## Do not install the CPU load limit, even on platforms where it is
+## supported. This option is useful when debugging/profiling 
+## PulseAudio to disable disturbing SIGXCPU signals.
+no-cpu-limit = 1
+
+## Run the daemon as system-wide instance, requires root priviliges
+system-instance = 1
+
+## Disable shared memory data transfer 
+disable-shm = 1
+EOF
+
+cat > /etc/pulse/default.pa << "EOF" &&
+#!/usr/bin/pulseaudio -nF 
+
+#            ----------------
+#   SOURCE   |  PulseAudio  |  SINK
+#  --------->|              |--------->
+#    ALSA    |    Daemon    |  EsounD
+#            ----------------
+#
+
+# SOURCE: Application -> Alsa -> PulseAudio
+load-module module-alsa-source device=default
+
+# SINK: PulseAudio -> Network
+load-module module-esound-sink server=via:16001
+
+# Network protocols
+load-module module-esound-protocol-unix auth-anonymous=1 
+
+# The native protocol is used for communications between
+# ALSA and PulseAudio.
+load-module module-native-protocol-unix auth-anonymous=1
+
+# Automatically restore the volume of playback streams
+load-module module-volume-restore
+
+# Automatically move streams to the default sink if the sink they are
+# connected to dies, similar for sources
+load-module module-rescue-streams
+EOF
+
+install -v -m740 ${CUR_DIR}/bootscripts/pulseaudio /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 pulseaudio 95 16
+
+# Return last error
+exit $?
diff --git a/stage3/cis-qt b/stage3/cis-qt
new file mode 100755 (executable)
index 0000000..7257a5b
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+QTVER=$(get_pkg_ver ${1})
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# You can edit the $QTDIR/mkspecs/linux-g++/qmake.conf file and then
+# configure/build qt and it will use those settings
+cd ${LFS_TMP}/${1} &&
+export QTDIR=${PWD} &&
+export LD_LIBRARY_PATH=${PWD}/lib:${LD_LIBRARY_PATH} &&
+export PATH=${PWD}/bin:${PATH} &&
+# The "yes" input is needed to accept the license. */
+echo "yes" | ./configure \
+    -prefix /opt/qt-${QTVER} \
+    -sysconfdir /etc/qt \
+    -qt-gif \
+    -system-zlib \
+    -system-libpng \
+    -system-libjpeg \
+    -system-libmng \
+    -plugin-imgfmt-png \
+    -plugin-imgfmt-jpeg \
+    -plugin-imgfmt-mng \
+    -no-exceptions \
+    -thread \
+    -tablet &&
+make sub-tools &&
+make install &&
+ln -v -sfn qt-${QTVER} /opt/qt &&
+ln -v -s libqt-mt.so /opt/qt/lib/libqt.so &&
+cp -v -r doc/man /opt/qt/doc &&
+cp -v -r examples /opt/qt/doc &&
+
+string_add "/opt/qt/lib" /etc/ld.so.conf &&
+ldconfig &&
+
+var_add_path QTDIR /etc/profile "/opt/qt" &&
+var_export   QTDIR /etc/profile &&
+
+var_add_path MANPATH /etc/profile "/opt/qt/doc/man" &&
+var_export   MANPATH /etc/profile &&
+
+var_add_path PKG_CONFIG_PATH /etc/profile "/opt/qt/lib/pkgconfig" &&
+var_export   PKG_CONFIG_PATH /etc/profile &&
+
+# Enlèvement de la documentation pour sauver 40M.
+cd /opt/qt/doc &&
+rm -rf exemples html
+
+# Return last error
+exit $?
diff --git a/stage3/cis-samba b/stage3/cis-samba
new file mode 100755 (executable)
index 0000000..8c2a423
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+install -d /var/cache/samba &&
+
+cd ${LFS_TMP}/${1}/source &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --with-piddir=/var/run \
+    --with-fhs \
+    --with-smbmount &&
+make &&
+make install &&
+mv /usr/lib/samba/libsmbclient.so /usr/lib &&
+ln -sf ../libsmbclient.so /usr/lib/samba &&
+
+mkdir -p /var/log/samba &&
+
+# libsmbclient.a doesn't seem to be installed...
+#chmod 644 /usr/include/libsmbclient.h /usr/lib/samba/libsmbclient.a &&
+chmod 644 /usr/include/libsmbclient.h &&
+
+install -m755 nsswitch/libnss_win{s,bind}.so /lib &&
+ln -sf libnss_winbind.so /lib/libnss_winbind.so.2 &&
+ln -sf libnss_wins.so /lib/libnss_wins.so.2 &&
+cp ../examples/smb.conf.default /etc/samba &&
+install -m644 ../docs/*.pdf /usr/share/samba
+evaluate_retval
+
+if [ -f nsswitch/pam_winbind.so ]; then 
+    install -m755 nsswitch/pam_winbind.so /lib/security || exit 1
+fi
+
+ldconfig &&
+
+# Configuring SWAT
+string_add "swat            901/tcp" /etc/services &&
+string_add "swat_tunnel     902/tcp" /etc/services &&
+string_add "swat stream tcp nowait.400 root /usr/sbin/swat swat" /etc/inetd.conf &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/samba /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 samba 85 10
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sane-backends b/stage3/cis-sane-backends
new file mode 100755 (executable)
index 0000000..9f1b355
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+if [ x${INST_TYPE} = "xworkstation" ]; then
+    USE_X_OPTION="yes"
+else
+    USE_X_OPTION="no"
+fi
+
+hv_groupadd saned &&
+hv_useradd -c saned -d /dev/null -g saned -s /bin/false saned &&
+
+# Problem with build directory
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-x=${USE_X_OPTION} &&
+
+# If the 'SANE_DRIVER' variable is defined in the 'sysinfos' file, then
+# we build that driver and the 'net' driver only. Otherwise, only the 'net'
+# driver is built. We do so by modifying the 'PRELOADABLE_BACKENDS' variable
+# in 'backend/Makefile'.
+cp backend/Makefile backend/Makefile.bak &&
+cat backend/Makefile.bak \
+    | sed "s/\(PRELOADABLE_BACKENDS =\).*/\1 ${SANE_DRIVER} net/" \
+    > backend/Makefile &&
+# Removing the program umax_pp, since it depends on some umax driver.
+cp tools/Makefile tools/Makefile.bak &&
+cat tools/Makefile.bak \
+    | sed "s/\(DESTINATIONS =.*\)umax_pp\(.*\)/\1\2/" > tools/Makefile &&
+
+make &&
+make install &&
+ldconfig &&
+
+# Addition to /etc/services (for both the client and server)
+string_add "sane      6566/tcp   saned # SANE Network Scanner Daemon" \
+    /etc/services &&
+
+# Creating '/etc/sane.d/dll.conf' and adding entry 'net'
+echo "net" > /etc/sane.d/dll.conf
+evaluate_retval
+
+if [ -z "${SANE_SERVER}" ]; then
+    # If 'SANE_SERVER' is not defined, then we automatically configure for
+    # the SANE Network Daemon.
+    
+    # Adding entry to '/etc/sane.d/dll.conf'
+    echo "${SANE_DRIVER}" >> /etc/sane.d/dll.conf || exit 1
+
+    # Creating '/etc/sane.d/saned.conf'
+    echo "${LAN_NETWORK_MASK}" > /etc/sane.d/saned.conf || exit 1
+    
+    # Addition to /etc/inetd.conf
+    string_add "sane  stream tcp nowait saned /usr/sbin/tcpd saned" \
+       /etc/inetd.conf || exit 1
+else
+    # If 'SANE_SERVER' is defined, then we must specify the address of the
+    # remote SANE server to use.
+    echo "${SANE_SERVER}" > /etc/sane.d/net.conf || exit 1
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sasl2 b/stage3/cis-sasl2
new file mode 100755 (executable)
index 0000000..9b743d6
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# Fixes an issue when compiling Cyrus SASL with GCC-4:
+sed -i '/sasl_global/s/^static //' lib/client.c &&
+
+# Puts the saslauthd man page in a more standard location:
+sed -i 's/cat8/man8/' saslauthd/Makefile.in &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-dbpath=/var/lib/sasl/sasldb2 \
+    --with-saslauthd=/var/run &&
+make &&
+make install &&
+
+cd ${LFS_TMP}/${1} &&
+install -v -m755 -d /usr/share/doc/${1} &&
+install -v -m644 doc/{*.{html,txt,fig},ONEWS,TODO} \
+    saslauthd/LDAP_SASLAUTHD /usr/share/doc/${1} &&
+install -v -m700 -d /var/lib/sasl &&
+
+# Creating SASL configuration file for Sendmail:
+cat > /usr/lib/sasl2/Sendmail.conf << "EOF" &&
+pwcheck_method:saslauthd
+EOF
+
+ldconfig &&
+
+# Bootscript
+install -v -m740 ${CUR_DIR}/bootscripts/saslauthd /etc/rc.d/init.d &&
+
+# script-name start stop
+bootscript_add_rc3 saslauthd 50 40
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sendmail b/stage3/cis-sendmail
new file mode 100755 (executable)
index 0000000..ed770c2
--- /dev/null
@@ -0,0 +1,261 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+CUR_DIR=$(pwd)
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd smmsp &&
+hv_groupadd mail &&
+hv_useradd -g smmsp -G mail smmsp &&
+chmod 1777 /var/mail &&
+mkdir -p /var/spool/mqueue &&
+mkdir -p /etc/mail &&
+
+cd ${LFS_TMP}/${1} &&
+cat > devtools/Site/site.config.m4 << "EOF"
+define(`confMANGRP',`root')
+define(`confMANOWN',`root')
+define(`confSBINGRP',`root')
+define(`confUBINGRP',`root')
+define(`confUBINOWN',`root')
+EOF
+evaluate_retval
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    # Adding support for SASL2 and MILTER
+    cat >> devtools/Site/site.config.m4 << "EOF" &&
+APPENDDEF(`conf_sendmail_ENVDEF', `-DSASL=2')
+APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')
+APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
+EOF
+    
+    # Configuration file for SASL2
+    echo "pwcheck_method: saslauthd" /usr/lib/sasl2/Sendmail.conf || exit 1
+fi
+
+cd sendmail &&
+sh Build &&
+cd ../
+evaluate_retval
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    cd libmilter &&
+    sh Build install &&
+    cd ../
+    evaluate_retval
+fi
+
+cd cf/cf &&
+cp generic-linux.mc sendmail.mc &&
+sh Build sendmail.mc &&
+sh Build install-cf &&
+cd ../../ &&
+sh Build install
+evaluate_retval
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    # Configuration Information
+    cat > /etc/mail/sendmail.mc << "EOF"
+dnl
+include(`./m4/cf.m4')
+VERSIONID(`sendmail.mc    Hugo Villeneuve   2003/10/06')
+OSTYPE(linux)
+DOMAIN(generic)
+dnl
+dnl ---------- Procmail settings ----------
+define(`PROCMAIL_MAILER_ARGS', procmail -a $h -d $u)dnl
+define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
+dnl
+dnl ---------- Log messages level ----------
+define(`confLOG_LEVEL', `14')
+dnl
+dnl ---------- confPRIVACY_FLAGS ----------
+dnl   "vrfy": (verify) pour verifier l'existence d'une adresse sur le serveur.
+dnl   "expn": (expand) qui est identique a "vrfy" mais qui permet aussi de lister
+dnl           les personnes d'une liste et autres alias.
+dnl   "noreceipts": To disable sending DSN receipts.
+dnl   "goaway": Disable all SMTP status queries.
+dnl   "authwarnings": Adds x-authentication-warning.
+dnl   "restrictmailq": mqueue group can see queue.
+dnl   "restrictqrun": mqueue owner to run queue.
+dnl   "nobodyreturn": Does not return mail body
+define(`confPRIVACY_FLAGS', `goaway authwarnings restrictmailq restrictqrun nobodyreturn novrfy noexpn noreceipts')
+dnl
+dnl ---------- Maximum message size (in bytes) ----------
+define(`confMAX_MESSAGE_SIZE',10000000)
+dnl
+define(`confMAX_DAEMON_CHILDREN',`30')
+define(`confCONNECTION_RATE_THROTTLE',`10')
+define(`confMAX_RCPTS_PER_MESSAGE',`50')
+dnl
+dnl ---------- MILTER support ----------
+define(`confINPUT_MAIL_FILTERS',`clmilter')
+dnl
+dnl ---------- SMTP Authorization options ----------
+define(`confAUTH_OPTIONS', `A')
+define(`confAUTH_MECHANISMS', `LOGIN PLAIN')
+TRUST_AUTH_MECH(`LOGIN PLAIN')
+dnl
+dnl ---------- Don't send the version number of sendmail ----------
+define(`confSMTP_LOGIN_MSG',`_HOSTNAME_')
+MASQUERADE_AS(_DOMAIN_)
+dnl Uncomment the following line to use a non-standard port
+dnl DAEMON_OPTIONS(`Port=_ALTERNATE_PORT_NUMBER_,Name=MTA')
+dnl
+dnl This is necessary for the local Sendmail to work, when using
+dnl an alternate port number:
+DAEMON_OPTIONS('Port=25','Name=MTA')
+dnl
+FEATURE(nouucp, nospecial)
+FEATURE(use_cw_file)
+FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')
+FEATURE(virtusertable, `hash -o /etc/mail/virtusertable')
+FEATURE(`local_procmail')
+FEATURE(`mailertable')
+MAILER(procmail)
+INPUT_MAIL_FILTER(`clmilter',`S=local:/var/clamav/clmilter.sock, F=, T=S:4m;R:4m')dnl
+dnl INPUT_MAIL_FILTER(`smf-spf', `S=local:/var/run/smfs/smf-spf.sock, T=S:30s;R:1m')
+dnl INPUT_MAIL_FILTER(`greylist',`S=local:/var/run/milter-greylist/milter-greylist.sock')
+MAILER(smtp)
+EOF
+
+    sed -i -e "s!_HOSTNAME_!${MACHINE_NAME}\.${DOMAIN}!g" /etc/mail/sendmail.mc &&
+    sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /etc/mail/sendmail.mc
+    evaluate_retval
+    
+    if [ -n "${SENDMAIL_INCOMING_PORT}" ]; then
+       # Uncommenting the alternate port line
+       sed -i -e "s!\(dnl \)\(.*_ALTERNATE_PORT_NUMBER_.*\)!\2!g" /etc/mail/sendmail.mc || exit 1
+       # Replacing the port number
+       sed -i -e "s!_ALTERNATE_PORT_NUMBER_!${SENDMAIL_INCOMING_PORT}!g" /etc/mail/sendmail.mc || exit 1
+    fi
+    
+    # We must put the domain name, and not the hostname in local-host-names
+    echo "${DOMAIN}" > /etc/mail/local-host-names
+    
+    if [ -n "${MAIL_ADMIN}" ]; then
+       echo "postmaster: ${MAIL_ADMIN}" > /etc/mail/aliases
+    else
+       exit 1
+    fi
+    cat >> /etc/mail/aliases << "EOF"
+mailer-daemon: postmaster
+abuse: postmaster
+root: postmaster
+EOF
+    
+    cat > /etc/mail/access << "EOF"
+# This is absolutely needed for each 192.168.0.x computer to send mail...
+Connect:192.168.0 RELAY
+EOF
+    
+    cd /etc/mail &&
+    cp -R ${LFS_TMP}/${1}/cf/* . &&
+
+    cat > /etc/mail/submit.mc << "EOF"
+dnl
+include(`./m4/cf.m4')dnl
+dnl
+EOF
+    cat ${LFS_TMP}/${1}/cf/cf/submit.mc >> /etc/mail/submit.mc &&
+    sed -i "s!\(^FEATURE.*\)127.0.0.1\(.*\)!\1${MACHINE_NAME}\.${DOMAIN}\2!" /etc/mail/submit.mc &&
+    newaliases -v &&
+   
+    cat > /etc/mail/virtusertable << "EOF" &&
+# MAKE SURE ALL ENTRIES ARE SEPARATED WITH <TAB>
+#
+EOF
+
+    if [ -n "${SENDMAIL_ALT_MAILER}" ]; then
+       echo ".     ${SENDMAIL_ALT_MAILER}" > /etc/mail/mailertable || exit 1
+    else
+       echo "# Define alternate mailer in this file" > /etc/mail/mailertable || exit 1
+    fi
+
+    cat > /etc/mail/configure << "EOF" &&
+#!/bin/sh
+
+PID_FILE="/var/run/sendmail.pid"
+
+cd /etc/mail &&
+
+m4 sendmail.mc > sendmail.cf &&
+m4 submit.mc   > submit.cf &&
+newaliases &&
+makemap hash access.db < access &&
+makemap hash virtusertable < virtusertable &&
+makemap hash mailertable.db < mailertable || exit 1
+
+# Restarting sendmail
+if [ -f ${PID_FILE} ]; then
+    kill -HUP `head -1 /var/run/sendmail.pid` || exit 1
+else
+    /etc/rc.d/init.d/sendmail start || exit 1
+fi
+
+exit $?
+EOF
+    chmod 740 /etc/mail/configure &&
+
+    # Bootscript
+    install -v -m740 ${CUR_DIR}/bootscripts/sendmail /etc/rc.d/init.d &&
+
+    # script-name start stop
+    bootscript_add_rc3 sendmail 65 25 &&
+
+    cat > /usr/local/bin/mail-if-fail << "EOF" &&
+#!/bin/sh
+
+# This script is used to run a command. If the command failed,
+# an email is sent to the address specified by MAILTO.
+
+# Begin of user modifiable variables
+MAILFROM="${USER}@_DOMAIN_"
+MAILTO="root@_DOMAIN_"
+# End of User modifiable variables
+
+SENDMAIL="/usr/sbin/sendmail -t -r ${MAILFROM}"
+MAILFILE="/tmp/mail-if-fail-output$$"
+LOGFILE="/tmp/mail-if-fail-log$$"
+
+# Running the specified command
+${*} 1> ${LOGFILE} 2>&1
+
+ERROR_CODE=${?}
+
+if [ ${ERROR_CODE} -ne "0" ]; then
+    echo "From: ${MAILFROM}" > ${MAILFILE}
+    echo "To: ${MAILTO}" >> ${MAILFILE}
+    echo "Subject: \"${1}\" FAILED (${ERROR_CODE})" >> ${MAILFILE}
+    echo "Content-type: text/plain" >> ${MAILFILE}
+    echo "Output of command ${*}:" >> ${MAILFILE}
+    echo >> ${MAILFILE}
+    cat ${LOGFILE} >> ${MAILFILE}
+    cat ${MAILFILE} | ${SENDMAIL} || exit 1
+    rm -f ${MAILFILE}
+fi
+
+rm -f ${LOGFILE}
+
+exit ${ERROR_CODE}
+EOF
+
+    sed -i -e "s!_DOMAIN_!${DOMAIN}!g" /usr/local/bin/mail-if-fail &&
+    chmod 755 /usr/local/bin/mail-if-fail &&
+
+    cp ${CUR_DIR}/resources/mail-files.sh /usr/local/bin &&
+    chmod 755 /usr/local/bin/mail-files.sh &&
+
+    # Executing configure script.
+    /etc/mail/configure
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sgml-common b/stage3/cis-sgml-common
new file mode 100755 (executable)
index 0000000..e0c5695
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Remove the old catalog items prior to upgrading...
+# First test for presence of 'install-catalog' program
+install-catalog -v 1> /dev/null 2>&1
+if [ $? -eq 0 ]; then
+    # The following commands may fail if this is the first time
+    # that this package is installed. So we do not check the return value.
+    install-catalog --remove /etc/sgml/sgml-ent.cat \
+       /usr/share/sgml/sgml-iso-entities-8879.1986/catalog 
+    install-catalog --remove /etc/sgml/sgml-docbook.cat \
+       /etc/sgml/sgml-ent.cat
+fi
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+# Autotools used with this package are very old, so we regenerate the autotools files.
+aclocal &&
+automake -acf &&
+autoconf &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --mandir=/usr/share/man &&
+make &&
+make install &&
+install-catalog --add /etc/sgml/sgml-ent.cat \
+    /usr/share/sgml/sgml-iso-entities-8879.1986/catalog &&
+install-catalog --add /etc/sgml/sgml-docbook.cat \
+    /etc/sgml/sgml-ent.cat
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sgml-dtd3 b/stage3/cis-sgml-dtd3
new file mode 100755 (executable)
index 0000000..ebbcce2
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i -e '/ISO 8879/d' \
+    -e 's|DTDDECL "-//OASIS//DTD DocBook V3.1//EN"|SGMLDECL|g' \
+    docbook.cat &&
+install -d /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD3_VER} &&
+chown -R root:root . &&
+install docbook.cat /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD3_VER}/catalog &&
+cp -af *.dtd *.mod *.dcl /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD3_VER} &&
+install-catalog --add /etc/sgml/sgml-docbook-dtd-${SGML_DTD3_VER}.cat \
+    /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD3_VER}/catalog &&
+install-catalog --add /etc/sgml/sgml-docbook-dtd-${SGML_DTD3_VER}.cat \
+    /etc/sgml/sgml-docbook.cat &&
+
+# Using only the most current 3.x version of sgml-dtd requires the following:
+cat >> /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD3_VER}/catalog << "EOF"
+  -- Begin Single Major Version catalog changes --
+
+PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "docbook.dtd"
+
+  -- End Single Major Version catalog changes --
+EOF
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sgml-dtd4 b/stage3/cis-sgml-dtd4
new file mode 100755 (executable)
index 0000000..3387993
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i -e '/ISO 8879/d' \
+    -e '/gml/d' docbook.cat &&
+install -d /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD4_VER} &&
+chown -R root:root . &&
+install docbook.cat /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD4_VER}/catalog &&
+cp -af *.dtd *.mod *.dcl /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD4_VER} &&
+install-catalog --add /etc/sgml/sgml-docbook-dtd-${SGML_DTD4_VER}.cat \
+    /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD4_VER}/catalog &&
+install-catalog --add /etc/sgml/sgml-docbook-dtd-${SGML_DTD4_VER}.cat \
+    /etc/sgml/sgml-docbook.cat &&
+
+# Using only the most current 4.x version of sgml-dtd requires the following:
+cat >> /usr/share/sgml/docbook/sgml-dtd-${SGML_DTD4_VER}/catalog << "EOF"
+  -- Begin Single Major Version catalog changes --
+
+PUBLIC "-//OASIS//DTD DocBook V4.3//EN" "docbook.dtd"
+PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "docbook.dtd"
+PUBLIC "-//OASIS//DTD DocBook V4.1//EN" "docbook.dtd"
+PUBLIC "-//OASIS//DTD DocBook V4.0//EN" "docbook.dtd"
+
+  -- End Single Major Version catalog changes --
+EOF
+
+# Return last error
+exit $?
diff --git a/stage3/cis-sgml-spm b/stage3/cis-sgml-spm
new file mode 100755 (executable)
index 0000000..ab0a8c1
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i -e "s@/usr/local/bin@/usr/bin@" \
+    -e "s@/usr/local/lib/perl5@/usr/lib/perl5/site_perl/$(get_pkg_ver ${PERL])@" \
+    -e "s@/usr/local/lib/www/docs@/usr/share/doc/perl5@" \
+    Makefile &&
+make install &&
+install -m755 -d /usr/share/doc/perl5 &&
+make install_html &&
+rm -f /usr/share/doc/perl5/SGMLSpm/sample.pl &&
+install -m644 DOC/sample.pl /usr/share/doc/perl5/SGMLSpm &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-spamassassin b/stage3/cis-spamassassin
new file mode 100755 (executable)
index 0000000..b0b5b6d
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+perl Makefile.PL -n \
+    CONTACT_ADDRESS="postmaster" \
+    ENABLE_SSL="no" \
+    RUN_NET_TESTS="no" &&
+make &&
+make install &&
+
+cat > /usr/local/bin/hv-sa-learn << "EOF" &&
+#!/bin/sh
+
+SA_LEARN="/usr/bin/sa-learn"
+SA_LEARN_FLAGS="--showdots --mbox"
+
+SA_USERS="hugo"
+USER_MAIL_FOLDER=".imap"
+
+for user in ${SA_USERS}; do
+    if [ -f /home/${user}/${USER_MAIL_FOLDER}/SPAM ]; then
+        echo "Scanning SPAM folder for user <${user}>:"
+        ${SA_LEARN} ${SA_LEARN_FLAGS} -C /etc/mail/spamassassin --spam /home/${user}/${USER_MAIL_FOLDER}/SPAM || exit 1
+    fi
+    if [ -f /home/${user}/${USER_MAIL_FOLDER}/HAM ]; then
+        echo "Scanning HAM folder for user <${user}:>"
+        ${SA_LEARN} ${SA_LEARN_FLAGS} -C /etc/mail/spamassassin --ham /home/${user}/${USER_MAIL_FOLDER}/HAM || exit 1
+    fi
+done
+
+echo "Scanning /var/mail/spam-sure..."
+${SA_LEARN} ${SA_LEARN_FLAGS} -C /etc/mail/spamassassin --spam /var/mail/spam-sure || exit 1
+
+echo "Scanning /var/mail/spam..."
+${SA_LEARN} ${SA_LEARN_FLAGS} -C /etc/mail/spamassassin --spam /var/mail/spam || exit 1
+
+echo "Scanning /var/mail/ham..."
+${SA_LEARN} ${SA_LEARN_FLAGS} -C /etc/mail/spamassassin --ham  /var/mail/ham || exit 1
+
+exit $?
+EOF
+chmod 755 /usr/local/bin/hv-sa-learn &&
+
+# Addition to /etc/fcron/fcrontab
+string_add "# Run SpamAssassin sa-learn every hour + 25 minutes" /etc/fcron/fcrontab &&
+string_add "&mail(false) 25 * * * * /usr/local/bin/mail-if-fail /usr/local/bin/hv-sa-learn" \
+    /etc/fcron/fcrontab &&
+
+# Add rule to procmailrc...
+
+# Put spamassassin databases in /srv
+mkdir -v -p /srv/spamassassin &&
+sed -i -e "s!^bayes_path.*!bayes_path /srv/spamassassin/bayes!g" /etc/mail/spamassassin/local.cf
+
+# Return last error
+exit $?
diff --git a/stage3/cis-squirrelmail b/stage3/cis-squirrelmail
new file mode 100755 (executable)
index 0000000..31c5363
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+mv ${LFS_TMP}/${1} /srv/www/htdocs/squirrelmail &&
+chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/www/htdocs/squirrelmail &&
+
+mkdir -v -p /srv/squirrelmail/{data,attach} &&
+chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/squirrelmail &&
+chmod -v 0730 /srv/squirrelmail/attach &&
+
+cp /srv/www/htdocs/squirrelmail/config/config_default.php /srv/www/htdocs/squirrelmail/config/config.php &&
+
+sed -i -e "s!\(\$data_dir .* =\).*!\1 \'/srv/squirrelmail/data/\';!g" \
+    /srv/www/htdocs/squirrelmail/config/config.php &&
+sed -i -e "s!\(\$attachment_dir .* =\).*!\1 \'/srv/squirrelmail/attach/\';!g" \
+    /srv/www/htdocs/squirrelmail/config/config.php
+# Return last error
+exit $?
diff --git a/stage3/cis-subversion b/stage3/cis-subversion
new file mode 100755 (executable)
index 0000000..75d0f19
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --with-apxs=/usr/sbin/apxs \
+    --without-berkeley-db &&
+make &&
+make install &&
+
+cd ${LFS_TMP}/${1} &&
+rm doc/doxygen.conf &&
+find doc -type d -exec chmod 755 {} \; &&
+find doc -type f -exec chmod 644 {} \; &&
+install -v -m755 -d /usr/share/doc/${1} &&
+cp -v -R doc/* /usr/share/doc/${1} &&
+
+# Creating repositories directory
+mkdir -p /srv/svn &&
+chown ${APACHE_USER}:${APACHE_USER} /srv/svn &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-t1lib b/stage3/cis-t1lib
new file mode 100755 (executable)
index 0000000..565e4c6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr &&
+make without_doc &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-tcl b/stage3/cis-tcl
new file mode 100755 (executable)
index 0000000..6c8d8ef
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+export VERSION=$(echo ${1} | sed "s!tcl\(.*\)!\1!g")
+export V=`echo $VERSION | cut -d "." -f 1,2` &&
+export DIR=$PWD &&
+cd unix &&
+sed -i "s/relid'/relid/" configure &&
+./configure \
+    --prefix=/usr \
+    --enable-threads &&
+make &&
+sed -i -e "s:${DIR}/unix:/usr/lib:" \
+    -e "s:${DIR}:/usr/include/tcl${V}:" \
+    -e "s:^TCL_LIB_FILE='libtcl${V}..TCL_DBGX..so':\
+TCL_LIB_FILE=\"libtcl${V}\$\{TCL_DBGX\}.so\":" tclConfig.sh &&
+
+make install &&
+install -d /usr/include/tcl${V}/unix &&
+install -m644 *.h /usr/include/tcl${V}/unix/ &&
+install -d /usr/include/tcl${V}/generic &&
+install -c -m644 ../generic/*.h /usr/include/tcl${V}/generic/ &&
+rm -f /usr/include/tcl${V}/generic/{tcl,tclDecls,tclPlatDecls}.h &&
+ln -nsf ../../include/tcl${V} /usr/lib/tcl${V}/include &&
+ln -sf libtcl${V}.so /usr/lib/libtcl.so &&
+ln -sf tclsh${V} /usr/bin/tclsh &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-tetex b/stage3/cis-tetex
new file mode 100755 (executable)
index 0000000..79362ea
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Removing any older directory from earlier attempt...
+rm -rf ${LFS_TMP}/cm-super &&
+
+install -v -m755 -d /usr/share/texmf &&
+decompress_package ${TETEX_TEXMF}    /usr/share/texmf &&
+decompress_package ${TETEX_TEXMFSRC} /usr/share/texmf &&
+decompress_package ${TETEX_CM_SUPER} &&
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --exec-prefix=/usr \
+    --bindir=/usr/bin \
+    --with-x=yes \
+    --without-texinfo \
+    --with-system-ncurses \
+    --with-system-zlib \
+    --disable-a4 &&
+make all &&
+make install &&
+
+texconfig-sys dvips paper letter &&
+texconfig-sys font rw &&
+
+install -v -d -m755 /usr/local/share/texmf/tex/latex &&
+var_add_path "TEXMFLOCAL" /etc/profile "/usr/local/share/texmf" &&
+var_export   "TEXMFLOCAL" /etc/profile &&
+
+# To install the optional cm-super fonts:
+FONTDIR=$(kpsewhich --expand-var '$TEXMFMAIN') &&
+mkdir -v -p ${FONTDIR}/fonts/afm/public/cm-super   \
+    ${FONTDIR}/fonts/type1/public/cm-super \
+    ${FONTDIR}/fonts/enc/dvips/cm-super    \
+    ${FONTDIR}/fonts/map/dvips/cm-super   &&
+
+cp -v ${LFS_TMP}/cm-super/pfb/*.pfb ${FONTDIR}/fonts/type1/public/cm-super/ &&
+
+gunzip ${LFS_TMP}/cm-super/afm/* &&
+cp -v ${LFS_TMP}/cm-super/afm/*.afm ${FONTDIR}/fonts/afm/public/cm-super/ &&
+
+cp -v ${LFS_TMP}/cm-super/dvips/*.enc ${FONTDIR}/fonts/enc/dvips/cm-super/ &&
+cp -v ${LFS_TMP}/cm-super/dvips/*.map ${FONTDIR}/fonts/map/dvips/cm-super/ &&
+
+cat >> ${FONTDIR}/web2c/updmap.cfg << "EOF" &&
+MixedMap cm-super-t1.map
+MixedMap cm-super-t2a.map
+MixedMap cm-super-t2b.map
+MixedMap cm-super-t2c.map
+MixedMap cm-super-ts1.map
+MixedMap cm-super-x2.map
+EOF
+
+mktexlsr &&
+updmap-sys
+
+if [ ${?} -eq 0 ]; then
+    rm -rf ${LFS_TMP}/cm-super || exit 1
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-tftp-hpa b/stage3/cis-tftp-hpa
new file mode 100755 (executable)
index 0000000..1f80e38
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# For packages that don't compile well from a separate build directory.
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+ldconfig &&
+
+mkdir -v -p /srv/tftpboot &&
+
+# Addition to /etc/inetd.conf
+string_add "tftp  dgram  udp wait       root  /usr/sbin/in.tftpd in.tftpd -s /srv/tftpboot" /etc/inetd.conf
+
+# Return last error
+exit $?
diff --git a/stage3/cis-tk b/stage3/cis-tk
new file mode 100755 (executable)
index 0000000..ae58dfe
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+export VERSION=$(echo ${1} | sed "s!tk\(.*\)!\1!g")
+export V=`echo $VERSION | cut -d "." -f 1,2` &&
+export DIR=$PWD &&
+cd unix &&
+sed -i "s/relid'/relid/" configure &&
+./configure \
+    --prefix=/usr \
+    --enable-threads &&
+make &&
+sed -i -e "s:${DIR}/unix:/usr/lib:" \
+    -e "s:${DIR}:/usr/include/tk${V}:" tkConfig.sh &&
+
+make install &&
+install -d /usr/include/tk${V}/unix &&
+install -m644 *.h /usr/include/tk${V}/unix/ &&
+install -d /usr/include/tk${V}/generic &&
+install -m644 ../generic/*.h /usr/include/tk${V}/generic/ &&
+rm -f /usr/include/tk${V}/generic/{tk,tkDecls,tkPlatDecls}.h &&
+ln -nsf ../../include/tk${V} /usr/lib/tk${V}/include &&
+ln -sf libtk${V}.so /usr/lib/libtk.so &&
+ln -sf wish${V} /usr/bin/wish &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-uml-utilities b/stage3/cis-uml-utilities
new file mode 100755 (executable)
index 0000000..54f3a1d
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+make -C tunctl install
+
+# Return last error
+exit $?
diff --git a/stage3/cis-unzip b/stage3/cis-unzip
new file mode 100755 (executable)
index 0000000..d3562cf
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux &&
+make prefix=/usr install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-uw-imap b/stage3/cis-uw-imap
new file mode 100755 (executable)
index 0000000..a922c32
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# This server is configured to use SSL only, no plain-text passwords.
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# Setting default mailbox format for imapd
+sed -i -e "s!^\(CREATEPROTO=\)unixproto!\1${MAILBOX_FORMAT}proto!" src/osdep/unix/Makefile &&
+
+make lnp &&
+
+# Installing imapd
+install -m 755 imapd/imapd /usr/bin &&
+install -m 644 src/imapd/imapd.8 /usr/man/man8/imapd.8 &&
+
+# Installing mailutil
+install -m 755 mailutil/mailutil /usr/bin &&
+install -m 644 src/mailutil/mailutil.1 /usr/man/man1/mailutil.1 &&
+
+# Installing dmail
+install -m 755 dmail/dmail /usr/bin &&
+install -m 644 src/dmail/dmail.1 /usr/man/man1/dmail.1 &&
+
+# Installing C-library
+mkdir -p /usr/lib/uw-imap/{include,lib} &&
+install -m 644 c-client/c-client.a /usr/lib/uw-imap/lib &&
+ln -sf /usr/lib/uw-imap/lib/c-client.a /usr/lib/uw-imap/lib/libc-client.a &&
+install -m 644 c-client/*.h /usr/lib/uw-imap/include &&
+install -m 644 src/osdep/tops-20/shortsym.h /usr/lib/uw-imap/include &&
+
+# Addition to /etc/inetd.conf
+string_add "imaps stream tcp nowait.400 root /usr/bin/imapd imapd" /etc/inetd.conf &&
+
+# Addition to /etc/services
+string_add "imaps     993/tcp " /etc/services &&
+
+# Addition to /etc/pam.conf
+string_add "# IMAP server"                                             /etc/pam.conf &&
+string_add "imap   auth       required   pam_unix.so   nullok"         /etc/pam.conf &&
+string_add "imap   account    required   pam_unix.so   try_first_pass" /etc/pam.conf &&
+string_add "imap   session    required   pam_deny.so"                  /etc/pam.conf &&
+
+# SSL Certificates generation script
+cat > /etc/mail/imap-ssl-certs << "EOF" &&
+#!/bin/sh
+
+echo "-------------------------------------------------" &&
+echo "Generation of a Certificate Signing Request (CSR)" &&
+echo "" &&
+echo "Example fields:" &&
+echo "Country name:             CA" &&
+echo "State or Province Name:   Quebec" &&
+echo "Locality Name:            Montreal" &&
+echo "Organization Name:        Hugo Villeneuve" &&
+echo "Organizational Unit Name: ." &&
+echo "Common Name:              mail.hugovil.com" &&
+echo "Email Address:            postmaster@hugovil.com" &&
+echo "" &&
+echo "Please enter the following 'extra' attributes" &&
+echo "to be sent with your certificate request" &&
+echo "A challenge password []:     (press enter)   " &&
+echo "An optional company name []: (press enter)   " &&
+echo "-------------------------------------------------" &&
+echo "" &&
+echo "-------------------------------------------------" &&
+echo "Generation of a self-signed certificate" &&
+echo "-------------------------------------------------" &&
+cd /etc/ssl/certs &&
+openssl req -new -x509 -nodes -out imapd.pem -keyout imapd.pem -days 10000
+
+exit $?
+EOF
+
+chmod 740 /etc/mail/imap-ssl-certs &&
+
+# Making sure cram-md5.pwd is created.
+if [ ! -f /etc/cram-md5.pwd ]; then
+    echo "# CRAM-MD5 authentication database" > /etc/cram-md5.pwd
+    echo "# Entries are in the form:" >> /etc/cram-md5.pwd
+    echo "#   USERNAME <SINGLE-TAB> PASSWORD" >> /etc/cram-md5.pwd
+    echo "# Its mandatory that there is a single tab" >> /etc/cram-md5.pwd
+    echo "# between the usernasme and password." >> /etc/cram-md5.pwd
+    echo "# Lines starting with \"#\" are comments." >> /etc/cram-md5.pwd
+    echo "" >> /etc/cram-md5.pwd
+
+    chmod 600 /etc/cram-md5.pwd
+fi
+
+# Return last error
+exit $?
diff --git a/stage3/cis-windowmaker b/stage3/cis-windowmaker
new file mode 100755 (executable)
index 0000000..2d3c8f1
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+autoreconf &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --with-gnustepdir=/usr/share/GNUstep &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-xfe b/stage3/cis-xfe
new file mode 100755 (executable)
index 0000000..29eae63
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Temporary: custom script needed to regenerate configure with
+# patch that modifies configure.in...
+cd ${LFS_TMP}/${1} &&
+./autogen.sh &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-xfree86 b/stage3/cis-xfree86
new file mode 100755 (executable)
index 0000000..b3b54f9
--- /dev/null
@@ -0,0 +1,400 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+
+# Xfree86 may have a problem with sys/kd.h installed with some recent versions of
+# Glibc. This has recently been fixed in LFS SVN. Execute the following commands
+# to work around a broken kd.h file. The grep command is to ensure the modification
+# is only made if it is needed:
+grep "__undef_LINUX" \
+    /usr/include/sys/kd.h 2>&1 > /dev/null || \
+    sed -i.bak '/X.h/i #include <linux/types.h>' \
+    programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c &&
+
+# When building XFree86, you should create a shadow directory of symbolic links for the compiled code:
+make -C config/util -f Makefile.ini lndir &&
+
+# Now create the shadow tree:
+cd ../${1}-build &&
+../${1}/config/util/lndir ../${1} &&
+
+# Creating host.def
+# Although XFree86 will compile without a host.def file, the following file is
+# recommended for customizing the installation.
+cat > config/cf/host.def << "EOF" &&
+/* host.def */
+/* System Related Information. */
+#define DefaultGcc2i386Opt -O2 -fomit-frame-pointer -march=_MACHINE_ARCHITECTURE_
+
+/* The following definitions are normally set properly by XFree86's scripts.
+ * You can uncomment them if you want to make sure. */
+#define HasMTRRSupport   YES /* Enabled in kernel see kernel docs */
+#define HasMMXSupport    YES /* Any i586 or above */
+#define HasKatmaiSupport YES /* PIII SSE instuctions */
+#define Has3DNowSupport  NO  /* AMD instructions */
+
+/* This setting reduces compile time a little by omitting rarely used input
+ * devices. You can find the complete list in config/cf/xfree86.cf */
+#define XInputDrivers mouse void
+
+/* VIDEO DRIVERS */
+#define XF86CardDrivers vesa vga _XF86_CARD_DRIVER_
+
+/* FONT SERVER AND LIBRARY SETTINGS */
+/* These setting should be set by default, but we are making sure. */
+#define BuildFontServer     YES  /* Need for GhostScript Print Server */
+#define SharedLibFont       YES 
+#define CompressAllFonts    YES
+#define GzipFontCompression YES
+
+/* These setting ensure we use our libraries */
+#define HasFreetype2          YES
+#define HasFontconfig         YES
+#define HasExpat              YES
+#define HasLibpng             YES
+#define HasZlib               YES
+#define HasNCurses            YES
+
+/* The font path can be redefined in the XF86Config file */
+#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/75dpi/,\
+$(FONTDIR)/100dpi/,$(FONTDIR)/Type1,$(FONTDIR)/local,\
+$(FONTDIR)/TrueType,$(FONTDIR)/CID,$(FONTDIR)/Speedo
+
+/* INTERNATIONAL FONTS. Change to YES if you need any of them. These are
+ * the defaults. */
+#define BuildCyrillicFonts  NO
+#define BuildArabicFonts    NO
+#define BuildISO8859_6Fonts NO
+#define BuildGreekFonts     NO
+#define BuildISO8859_7Fonts NO
+#define BuildHebrewFonts    NO
+#define BuildISO8859_8Fonts NO
+#define BuildKOI8_RFonts    NO
+#define BuildJapaneseFonts  NO
+#define BuildJISX0201Fonts  NO
+#define BuildKoreanFonts    NO
+#define BuildChineseFonts   NO
+
+/* DOCUMENTATION SETTINGS */
+/* These setting are the defaults. */
+#define BuildLinuxDocHtml NO    /* X Docs in Html format */
+#define BuildLinuxDocPS   NO    /* X Docs in PostScript format */
+#define BuildAllSpecsDocs NO    /* Various docs */
+#define BuildHtmlManPages NO
+/* Linux Distribution Information - Not essential that it is totally right.*/
+#define LinuxDistribution hvlinux
+
+/* Disabling IPv6 support, as it causes a problem with xdm. */
+#define BuildIPv6 NO
+
+/* GENERAL SETTINGS: You generally want to leave these alone when
+ * building X on an LFS system */
+#define GccWarningOptions  -pipe
+#define TermcapLibrary     -lncurses
+#define XprtServer         YES /* Needed by realplayer */
+#define XnestServer        YES
+#define XAppLoadDir        EtcX11Directory/app-defaults
+#define VarLibDir          /var/lib
+#define XFree86Devel       NO
+#define FSUseSyslog        YES
+#define ThreadedX          YES
+#define HasPam             NO
+#define SystemManDirectory /usr/share/man
+#define HasLibCrypt        YES
+#define InstallXinitConfig YES
+#define InstallXdmConfig   YES
+#define ForceNormalLib     YES
+#define BuildSpecsDocs     NO
+EOF
+
+sed -i -e "s!_MACHINE_ARCHITECTURE_!${MACHINE_ARCHITECTURE}!g" config/cf/host.def &&
+sed -i -e "s!_XF86_CARD_DRIVER_!${XF86_CARD_DRIVER}!g" config/cf/host.def &&
+
+sed -i 's:^.*asm.*$:# define PAGE_MASK   (~(getpagesize() - 1)):' \
+    ../${1}/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c &&
+
+sed -i -e "s@^#include <linux/config.h>@/* & */@" \
+    `grep -lr linux/config.h ../${1}` &&
+echo "make World" &&
+make World &&
+echo "make install" &&
+make install &&
+echo "make install.man" &&
+make install.man &&
+ldconfig &&
+
+ln -svf /usr/X11R6/bin /usr/bin/X11 &&
+ln -svf /usr/X11R6/lib/X11 /usr/lib/X11 &&
+ln -svf /usr/X11R6/include/X11 /usr/include/X11 &&
+
+cat > /usr/X11R6/lib/pkgconfig/xrender.pc << "EOF" &&
+prefix=/usr/X11R6
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Xrender
+Description: X Render Library
+Version: 0.8.3
+Cflags: -I${includedir} -I/usr/X11R6/include
+Libs: -L${libdir} -lXrender  -L/usr/X11R6/lib -lX11
+EOF
+
+cat > /usr/X11R6/lib/pkgconfig/xextensions.pc << "EOF" &&
+prefix=/usr/X11R6
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: XExtensions
+Description: Sundry X extension headers
+Version: 1.0.1
+Cflags: -I${includedir}
+EOF
+
+
+# Creation of ~/.xinitrc
+cat > ~/.xinitrc << "EOF" &&
+exec wmaker
+EOF
+
+cat > /etc/X11/XF86Config << "EOF" &&
+# XF86Config
+#
+# **********************************************************************
+#  Files section.
+# **********************************************************************
+Section "Files"
+       RgbPath      "/usr/X11R6/lib/X11/rgb"
+
+       ModulePath   "/usr/X11R6/lib/modules"      # Module search path
+
+       FontPath     "_HV_FONTS_PATH_/TrueType"
+
+        # Standard XFree86 Fonts
+       FontPath     "/usr/X11R6/lib/X11/fonts/TTF"
+       FontPath     "/usr/X11R6/lib/X11/fonts/Type1"
+       FontPath     "/usr/X11R6/lib/X11/fonts/misc/:unscaled"
+       FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
+       FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
+       FontPath     "/usr/X11R6/lib/X11/fonts/local"
+       FontPath     "/usr/X11R6/lib/X11/fonts/Speedo"
+       FontPath     "/usr/X11R6/lib/X11/fonts/misc/"
+       FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/"
+       FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/"
+EndSection
+
+# **********************************************************************
+#  Dynamically loadable modules section.
+# **********************************************************************
+Section "Module"
+   Load "dbe" # Double buffer extension
+
+   # This loads the miscellaneous extensions module, and disables
+   # initialisation of the XFree86-DGA extension within that module.
+   SubSection  "extmod"
+      Option    "omit xfree86-dga"   # don't initialise the DGA extension
+   EndSubSection
+
+   # This loads the Type1 and FreeType font modules
+   Load "type1"
+   Load "speedo"
+   Load "freetype"
+
+   Load  "glx"
+   Load  "dri"
+EndSection
+
+# **********************************************************************
+#  Input devices.
+# **********************************************************************
+Section "InputDevice"
+       Identifier  "Keyboard1"
+       Driver      "keyboard"
+       Option      "XkbRules"   "xfree86"
+       Option      "XkbModel"   "pc105"
+       Option      "XkbLayout"  "_XF86_KEYBOARD_LAYOUT_"
+       Option      "AutoRepeat" "500 30"
+EndSection
+
+# With kernel 2.6, all mouse are supported through "/dev/input/mice" 
+Section "InputDevice"
+       Identifier  "Mouse1"
+       Driver      "mouse"
+       Option      "Emulate3Buttons"
+       Option      "Protocol" "auto"
+       Option      "Device" "/dev/input/mice"
+       Option      "ZAxisMapping" "4 5"
+       Option      "Buttons"      "5"
+EndSection
+
+# **********************************************************************
+#  Monitor section
+#  No need to specify VertRefresh and HorizSync, as DDC2 data will
+#  be used (if monitor is recent and supports it).
+# **********************************************************************
+Section "Monitor"
+    Identifier "Monitor1"
+    VendorName "Unknown"
+    ModelName  "Unknown"
+EndSection
+
+# **********************************************************************
+#  Device (video card) section
+# **********************************************************************
+Section "Device"
+    Identifier         "VideoCard1"
+    Driver             "_VIDEO_CARD_DRIVER_"
+EndSection
+
+# **********************************************************************
+#  Screen section
+# **********************************************************************
+Section "Screen"
+    Identifier  "Screen1"
+    Device      "VideoCard1"
+    Monitor     "Monitor1"
+    DefaultColorDepth 24
+    Subsection "Display"
+        Depth       24
+        Modes       "1024x768" "800x600" 
+        ViewPort    0 0
+    EndSubsection
+EndSection
+
+# **********************************************************************
+#  Layout(s) section
+# **********************************************************************
+Section "ServerLayout"
+    Identifier  "Default"
+    Screen      "Screen1"
+    InputDevice "Mouse1"    "CorePointer"
+    InputDevice "Keyboard1" "CoreKeyboard"
+EndSection
+
+EOF
+
+# The ! character is the SED delimiter
+sed -i -e "s!_HV_FONTS_PATH_!${HV_FONTS_PATH}!g" /etc/X11/XF86Config &&
+sed -i -e "s!_VIDEO_CARD_DRIVER_!${XF86_CARD_DRIVER}!g" /etc/X11/XF86Config &&
+sed -i -e "s!_XF86_KEYBOARD_LAYOUT_!${HV_XF86_KEYBOARD_LAYOUT}!g" /etc/X11/XF86Config &&
+
+cat > /etc/skel/.xinitrc << "EOF" &&
+# ~/.xinitrc
+
+exec wmaker
+EOF
+
+cat > /etc/skel/.Xdefaults << "EOF" &&
+xterm*background: rgb:BB/AA/99
+xterm*scrollBar: false
+xterm*rightScrollBar: false
+xterm*saveLines: 1000
+xterm*geometry: 120x45+70+50
+emacs*geometry:85x45+10+10
+EOF
+
+cat > /etc/skel/.xsession << "EOF" &&
+#!/bin/sh
+# ~/.xsession
+
+userresources=$HOME/.Xresources
+usermodmap=$HOME/.Xmodmap
+sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
+sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
+
+# merge in defaults and keymaps
+
+if [ -f $sysresources ]; then
+    xrdb -merge $sysresources
+fi
+
+if [ -f $sysmodmap ]; then
+    xmodmap $sysmodmap
+fi
+
+if [ -f $userresources ]; then
+    xrdb -merge $userresources
+fi
+
+if [ -f $usermodmap ]; then
+    xmodmap $usermodmap
+fi
+
+# now, we see if xdm/gdm/kdm has asked for a specific environment
+
+case $# in
+    1)
+       case $1 in
+           kde)
+               exec startkde
+               ;;
+           twm)
+               xsetroot -solid rgb:33/33/55 &
+               xclock -digital -update 1 -geometry 180x23-5+5 &
+               opera -geometry 1100x950+150+10 -iconic -title "Opera 6.0 TP3" &
+               emacs -geometry 140x60-5+100 -iconic -title "Emacs" &
+               xterm -ls -geometry 160x60+25-25 -title "xterm" &
+               exec twm
+               ;;
+           wmaker)
+               exec wmaker
+               ;;
+           failsafe)
+               exec xterm -geometry 80x24-0-0
+               ;;
+           default)
+               exec wmaker
+               ;;
+           *)
+               exec wmaker
+               ;;
+       esac
+       ;;
+    *)
+        exec wmaker
+       ;;
+esac
+
+exit 0
+EOF
+
+chmod 755 /etc/skel/.xsession &&
+
+cp /etc/skel/.{xinitrc,Xdefaults,xsession} /root &&
+
+var_add_path "PATH" /etc/profile "/usr/X11R6/bin" &&
+
+var_add_path "PKG_CONFIG_PATH" /etc/profile "/usr/X11R6/lib/pkgconfig" &&
+var_export   "PKG_CONFIG_PATH" /etc/profile &&
+
+var_add_path "MANPATH" /etc/profile "/usr/X11R6/man" &&
+var_export   "MANPATH" /etc/profile &&
+
+var_add_shadow "ENV_SUPATH" /etc/login.defs "/usr/X11R6/bin" &&
+
+string_add "/usr/X11R6/lib" /etc/ld.so.conf &&
+ldconfig
+
+# When needed, XFree86 creates the directory /tmp/.ICE-unix if it does not
+# exist. If this directory is not owned by root, XFree86 delays startup by a
+# few seconds and also appends a warning to the logfile. This also affects
+# startup of other applications. To improve performance, it is advisable to
+# manually create the directory before XFree86 uses it.
+# startup script. 
+#cat >> /etc/sysconfig/createfiles <<EOF
+# "EOF"
+#/tmp/.ICE-unix dir 1777 root root
+#EOF
+
+# Return last error
+exit $?
diff --git a/stage3/cis-xmltoman b/stage3/cis-xmltoman
new file mode 100755 (executable)
index 0000000..dc89a63
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name.
+# Remaining arguments are additional configure options.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+PACKAGE=${1}
+shift
+CONFIGURE_OPTS=${*}
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${PACKAGE} &&
+
+cd ${LFS_TMP}/${PACKAGE} &&
+make PREFIX=/usr &&
+make install PREFIX=/usr
+
+# Return last error
+exit $?
diff --git a/stage3/cis-xsane b/stage3/cis-xsane
new file mode 100755 (executable)
index 0000000..1abeda3
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr &&
+make &&
+make install &&
+ldconfig &&
+
+# Adding link for GIMP plugin (Base GIMP version hardcoded for now)
+ln -v -sf /usr/bin/xsane /usr/lib/gimp/2.0/plug-ins/
+
+# Return last error
+exit $?
diff --git a/stage3/cis-xvidcore b/stage3/cis-xvidcore
new file mode 100755 (executable)
index 0000000..b5205de
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}/build/generic &&
+./configure \
+    --prefix=/usr &&
+make  &&
+make install &&
+ln -sf libxvidcore.so.4.0 /usr/lib/libxvidcore.so.4 &&
+ln -sf libxvidcore.so.4 /usr/lib/libxvidcore.so &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/cis-zip b/stage3/cis-zip
new file mode 100755 (executable)
index 0000000..dc39198
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i -e 's@$(INSTALL) man/zip.1@$(INSTALL_PROGRAM) man/zip.1@' \
+    unix/Makefile &&
+make prefix=/usr -f unix/Makefile generic_gcc &&
+make prefix=/usr -f unix/Makefile install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage3/packages-update b/stage3/packages-update
new file mode 100755 (executable)
index 0000000..4bb2b53
--- /dev/null
@@ -0,0 +1,285 @@
+#!/bin/sh
+
+LFS_STAGE="stage3"
+
+# Reading system configuration informations, functions and package versions.
+source ../functions
+source ../functions-update
+source ../packages-list
+
+update_packages_init
+
+# Begin
+
+fpkg_sf    ${DDCLIENT}
+lpkg     2 ${INETUTILS}
+fpkg       ${LIBPCAP} "http://www.tcpdump.org/release"
+fpkg       ${TCPDUMP} "http://www.tcpdump.org/release"
+fpkg       ${NMAP} "http://download.insecure.org/nmap/dist"
+fpkg_hv    ${BIND}
+fpkg       ${IPTABLES} "http://www.netfilter.org/projects/iptables/files"
+fpkg       ${MYSQL} "ftp://mirror.mcs.anl.gov/pub/mysql/Downloads/MySQL-5.0"
+
+
+fpkg_mis   ${UNZIP} "unzip552" "ftp://ftp.info-zip.org/pub/infozip/src"
+fpkg_mis   ${ZIP}   "zip232"   "ftp://ftp.info-zip.org/pub/infozip/src"
+fpkg       ${CVS_PACKAGE} "ftp://ftp.gnu.org/non-gnu/cvs/source/stable/$(get_pkg_ver ${CVS_PACKAGE})"
+fpkg_gnu   ${PARTED}
+fpkg_hv    ${LIBJPEG}
+fpkg_sf    ${LIBPNG}
+fpkg_mis   ${LIBTIFF} "tiff-$(get_pkg_ver ${LIBTIFF})" "ftp://ftp.remotesensing.org/pub/libtiff/old"
+fpkg_sf    ${GIFLIB}  "libungif"
+fpkg       ${LCMS}    "http://www.littlecms.com"
+fpkg_sf    ${LIBMNG}
+fpkg_sf    ${LIBEXIF}
+fpkg_gnome ${LIBART}
+fpkg       ${FRIBIDI} "http://fribidi.org/download"
+
+fpkg_sf    ${FREETYPE}
+fpkg       ${FONTCONFIG} "http://fontconfig.org/release"
+fpkg       ${T1LIB} "http://www.ibiblio.org/pub/Linux/libs/graphics"
+fpkg_hv    ${XFREE86}
+fpkg       ${LIBXFT} "http://xorg.freedesktop.org/releases/individual/lib"
+
+fpkg       ${WINDOWMAKER}       "ftp://windowmaker.org/pub/source/release"
+fpkg       ${WINDOWMAKER_EXTRA} "ftp://windowmaker.org/pub/source/release"
+fpkg_sf    ${LESSTIF}
+lpkg     2 ${EMACS}
+
+fpkg_mis   ${TCL} "${TCL}-src" ${SOURCEFORGE_URL}/tcl
+fpkg_mis   ${TK}  "${TK}-src"  ${SOURCEFORGE_URL}/tcl
+
+fpkg       ${PYTHON} "http://www.python.org/ftp/python/$(get_pkg_ver ${PYTHON})"
+fpkg       ${SGML_COMMON} "http://gd.tuwien.ac.at/hci/kde/devel/docbook/SOURCES"
+fpkg_hv    ${SGML_DTD3}
+fpkg_hv    ${SGML_DTD4}
+fpkg_sf    ${OPENSP} "openjade"
+fpkg_sf    ${OPENJADE}
+fpkg_sf    ${DOCBOOK_DSSSL} "docbook"
+fpkg       ${DOCBOOK_UTILS} "http://sources-redhat.mirrors.redwire.net/docbook-tools/new-trials/SOURCES"
+fpkg_gnome ${LIBXML2}
+fpkg       ${LIBXSLT} "http://xmlsoft.org/sources"
+fpkg_hv    ${DOCBOOK_XML}
+fpkg_sf    ${DOCBOOK_XSL} "docbook"
+# For re-generating fontconfig documentation.
+fpkg_hv    ${SGML_SPM}
+
+fpkg_sf    ${XMLTOMAN}
+
+# Perl modules
+fpkg_sf    ${PERL_MOD_PDL} pdl
+fpkg       ${PERL_MOD_XML_WRITER} "http://www.cpan.org/modules/by-module/XML"
+fpkg       ${PERL_MOD_XML_PARSER} "http://www.cpan.org/modules/by-module/XML"
+fpkg       ${PERL_MOD_XML_SIMPLE} "http://www.cpan.org/modules/by-module/XML"
+fpkg       ${PERL_MOD_PARSE_REDESCENT} "http://www.cpan.org/modules/by-module/Parse"
+
+# Gtk
+fpkg_gnome ${GTK_DOC}
+fpkg_gnome ${GLIB2}
+fpkg       ${PIXMAN} "http://cairographics.org/releases"
+fpkg       ${GLITZ} "http://cairographics.org/snapshots"
+fpkg       ${CAIRO} "http://cairographics.org/releases"
+fpkg       ${CAIROMM} "http://cairographics.org/releases"
+fpkg_gnome ${PANGO}
+fpkg_gnome ${ATK}
+fpkg_gnome ${GTK2}
+fpkg_gnome ${GTK_ENGINES}
+
+fpkg_gnome ${PYGTK}
+
+fpkg_gnome ${LIBSIGCPP}
+fpkg       ${GC} " http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source"
+fpkg_gnome ${GLIBMM}
+fpkg_gnome ${GTKMM}
+fpkg       ${HICOLOR_ICON_THEME} "http://icon-theme.freedesktop.org/releases"
+
+fpkg_hv    ${HVCLOCK}
+fpkg_hv    ${WMNOTIFY}
+
+fpkg       ${DESKTOP_FILE_UTILS} "http://freedesktop.org/software/desktop-file-utils/releases"
+fpkg       ${SHARED_MIME_INFO} "http://people.freedesktop.org/~hadess"
+fpkg_gnome ${STARTUP_NOTIFICATION}
+fpkg_gnome ${LIBWNCK}
+fpkg_sf    ${LIBXKLAVIER} gswitchit
+fpkg_gnome ${LIBGLADE}
+fpkg_gnome ${LIBSOUP}
+fpkg_gnome ${LIBIDL}
+fpkg_gnome ${LIBRSVG}
+
+fpkg_gnome ${INTLTOOL}
+fpkg_gnu   ${GSL}
+
+fpkg_sf    ${LIBUSB}
+fpkg_sf    ${LIBGPHOTO2} "gphoto"
+
+fpkg       ${GIMP} "ftp://ftp.gimp.org/pub/gimp/v$(get_pkg_ver_base ${GIMP})"
+fpkg_hv    ${INKSCAPE}
+
+fpkg       ${FOX} "http://www.fox-toolkit.org/ftp"
+fpkg_sf    ${XFE} 
+
+fpkg_gnu   ${BC}
+fpkg       ${CDRTOOLS} "ftp://ftp.berlios.de/pub/cdrecord"
+fpkg       ${DVDRWTOOLS} "http://fy.chalmers.se/~appro/linux/DVD+RW/tools"
+
+fpkg_mis   ${CUPS} "${CUPS}-source" "http://ftp.easysw.com/pub/cups/$(get_pkg_ver ${CUPS})"
+
+fpkg_mis   ${ESPGS} "${ESPGS}-source" "http://ftp.easysw.com/pub/ghostscript/$(get_pkg_ver ${ESPGS})"
+fpkg_sf    ${GHOSTSCRIPT_FONTS_STD} "ghostscript"
+fpkg_sf    ${GHOSTSCRIPT_FONTS_OTHER} "ghostscript"
+
+fpkg_hv    ${IMAGE_MAGICK}
+fpkg       ${ICON_NAMING_UTILS}       "http://tango.freedesktop.org/releases"
+fpkg       ${TANGO_ICON_THEME}        "http://tango-project.org/releases"
+fpkg       ${TANGO_ICON_THEME_EXTRAS} "http://tango-project.org/releases"
+
+fpkg_gnu   ${ED}
+fpkg       ${TETEX_SRC}      "${TETEX_URL}/$(get_pkg_ver ${TETEX_SRC})/distrib"
+fpkg       ${TETEX_TEXMF}    "${TETEX_URL}/$(get_pkg_ver ${TETEX_TEXMF})/distrib"
+fpkg       ${TETEX_TEXMFSRC} "${TETEX_URL}/$(get_pkg_ver ${TETEX_TEXMFSRC})/distrib"
+fpkg       ${TETEX_CM_SUPER} "http://anduin.linuxfromscratch.org/sources/BLFS/svn/t"
+# For re-generating fontconfig documentation.
+fpkg_sf    ${JADETEX}
+
+fpkg_sf    ${PSTOEDIT}
+fpkg       ${POPPLER} "http://poppler.freedesktop.org"
+
+fpkg       ${SANE_BACKENDS} "ftp://ftp.sane-project.org/pub/sane/${SANE_BACKENDS}"
+fpkg       ${XSANE}         "ftp://ftp.sane-project.org/pub/sane/xsane"
+
+fpkg_sf    ${JACK} "jackit"
+fpkg       ${ALSA_LIB}     "ftp://ftp.alsa-project.org/pub/lib"
+fpkg       ${ALSA_PLUGINS} "ftp://ftp.alsa-project.org/pub/plugins"
+fpkg       ${ALSA_UTILS}   "ftp://ftp.alsa-project.org/pub/utils"
+fpkg       ${ALSA_OSS}     "ftp://ftp.alsa-project.org/pub/oss-lib"
+
+# Multimedia libraries and drivers.
+fpkg       ${AUDIOFILE} "http://www.68k.org/~michael/audiofile"
+fpkg_gnome ${ESOUND}
+
+fpkg       ${LIBSAMPLERATE} "http://www.mega-nerd.com/SRC"
+fpkg       ${LIBOIL} "http://liboil.freedesktop.org/download"
+fpkg       ${PULSEAUDIO} "http://0pointer.de/lennart/projects/pulseaudio"
+
+# Temporaire, version beta
+fpkg       ${LIBSNDFILE} "http://www.mega-nerd.com/tmp"
+#fpkg       ${LIBSNDFILE} "http://www.mega-nerd.com/libsndfile"
+
+fpkg       ${LIBOGG}    "http://downloads.xiph.org/releases/ogg"
+fpkg       ${LIBVORBIS} "http://downloads.xiph.org/releases/vorbis"
+fpkg_hv    ${FLAC}
+fpkg_hv    ${FFMPEG}
+
+# Audio utilities
+fpkg_sf    ${LAME}
+fpkg       ${VORBIS_TOOLS} "http://downloads.xiph.org/releases/vorbis"
+fpkg_hv    ${LIBA52}
+fpkg_hv    ${LIBID3TAG}
+fpkg       ${LIBMAD} "ftp://ftp.mars.org/pub/mpeg"
+fpkg_hv    ${LIBFAAC}
+fpkg_hv    ${LIBFAAD2}
+
+# taglib, libmowgli and mcs are required by audacious
+fpkg       ${TAGLIB} "http://developer.kde.org/~wheeler/files/src"
+fpkg       ${LIBMOWGLI} "http://distfiles.atheme.org"
+fpkg       ${LIBMCS} "http://distfiles.atheme.org"
+fpkg       ${AUDACIOUS} "http://distfiles.atheme.org"
+fpkg       ${AUDACIOUS_PLUGINS} "http://distfiles.atheme.org"
+fpkg_sf    ${GRIP}
+fpkg_sf    ${CDRDAO}
+fpkg_hv    ${PORTAUDIO}
+fpkg_sf    ${WXGTK} "wxwindows"
+
+fpkg_hv    ${AUDACITY}
+
+fpkg       ${SYLPHEED} "http://sylpheed.good-day.net/sylpheed/v$(get_pkg_ver_base ${SYLPHEED})"
+fpkg       ${QT}       "http://ftp.silug.org/mirrors/ftp.trolltech.com/qt/source"
+
+fpkg_hv    ${OPERA}
+fpkg_hv    ${OPERA_LANG_FR}
+
+fpkg_hv    ${NSS}
+# Il faut simplement renommer firefox-3.0.1-source.tar.bz2 en firefox-3.0.1.tar.bz2
+fpkg_hv    ${FIREFOX}
+
+fpkg_hv    ${JAVA}
+fpkg_hv    ${FLASH_PLUGIN}
+
+fpkg       ${XVIDCORE} "http://downloads.xvid.org/downloads"
+fpkg_sf    ${XINELIB} "xine"
+fpkg_sf    ${GXINE}   "xine"
+fpkg_hv    ${MPLAYER_CODECS}
+fpkg_hv    ${MPLAYER}
+
+fpkg_hv    ${MINICOM}
+
+fpkg       ${DBUS} "http://dbus.freedesktop.org/releases/dbus"
+fpkg       ${DBUS_GLIB} "http://dbus.freedesktop.org/releases/dbus-glib"
+fpkg       ${HAL} "http://people.freedesktop.org/~david/dist"
+
+fpkg       ${SASL2} "ftp://ftp.andrew.cmu.edu/pub/cyrus-mail"
+fpkg_mis   ${OPENLDAP} "openldap-stable-20070831" \
+    "ftp://ftp.openldap.org/pub/OpenLDAP/openldap-stable"
+fpkg_hv    ${KERBEROS5}
+
+fpkg_mis   ${SENDMAIL} "sendmail.$(get_pkg_ver ${SENDMAIL})" "ftp://ftp.sendmail.org/pub/sendmail"
+fpkg       ${LIBSPF2} "http://libspf2.org/spf"
+fpkg       ${MILTER_GREYLIST} "ftp://ftp.espci.fr/pub/milter-greylist"
+fpkg_hv    ${MILTER_SPF}
+fpkg       ${PROCMAIL} "http://www.procmail.org"
+
+fpkg_mis   ${FCRON} "${FCRON}.src" "ftp://ftp.seul.org/pub/fcron"
+fpkg_hv    ${GETDATE}
+
+fpkg_sf    ${CLAMAV}
+
+fpkg       ${PERL_MOD_HTML_TAGSET} "http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules"
+fpkg       ${PERL_MOD_HTML_PARSER} "http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules"
+fpkg       ${PERL_MOD_APACHE_LOGGED_AUTH_DBI} "http://search.cpan.org/CPAN/authors/id/S/SI/SIMKIN"
+fpkg       ${PERL_MOD_DB_FILE} "http://search.cpan.org/CPAN/authors/id/P/PM/PMQS"
+fpkg       ${PERL_MOD_DIGEST_SHA1} "http://anduin.linuxfromscratch.org/sources/BLFS/svn/perl-modules"
+# URI is needed by LWP
+fpkg       ${PERL_MOD_URI} "http://search.cpan.org/CPAN/authors/id/G/GA/GAAS"
+# LWP is Needed by LTSP
+fpkg       ${PERL_MOD_LWP} "http://www.linpro.no/lwp"
+
+# ZIP is Needed by OO
+fpkg       ${PERL_MOD_ARCHIVE_ZIP} "http://search.cpan.org/CPAN/authors/id/A/AD/ADAMK"
+fpkg       ${PERL_MOD_COMPRESS_ZLIB} "http://search.cpan.org/CPAN/authors/id/P/PM/PMQS"
+fpkg       ${PERL_MOD_IO_COMPRESS_BASE} "http://search.cpan.org/CPAN/authors/id/P/PM/PMQS"
+fpkg       ${PERL_MOD_IO_COMPRESS_ZLIB} "http://search.cpan.org/CPAN/authors/id/P/PM/PMQS"
+fpkg       ${PERL_MOD_COMPRESS_RAW_ZLIB} "http://search.cpan.org/CPAN/authors/id/P/PM/PMQS"
+fpkg       ${PERL_MOD_NET_DNS} "http://search.cpan.org/CPAN/authors/id/O/OL/OLAF"
+
+fpkg       ${SPAMASSASSIN} "http://apache.sunsite.ualberta.ca/spamassassin/source"
+fpkg       ${UW_IMAP} "ftp://ftp.cac.washington.edu/imap"
+
+fpkg       ${HTTPD} "http://www.apache.org/dist/httpd"
+
+fpkg       ${CURL} "http://curl.haxx.se/download"
+
+fpkg_sf    ${MAILMAN}
+
+fpkg       ${SAMBA} "ftp://ftp.samba.org/pub/samba/old-versions"
+
+fpkg       ${PHP}   "http://us2.php.net/distributions"
+
+fpkg_sf    ${STRACE}
+lpkg     2 ${SUBVERSION}
+fpkg       ${GIT} "http://www.kernel.org/pub/software/scm/git"
+fpkg_hv    ${GIT_MANPAGES}
+
+fpkg       ${LTSP_UTILS} "http://ltsp.mirrors.tds.net/pub/ltsp/utils"
+fpkg       ${TFTP_HPA} "http://freshmeat.net/redir/tftp-hpa/14040/url_bz2"
+
+fpkg_sf    ${KVM}
+fpkg_hv    ${BRIDGE_UTILS}
+fpkg_hv    ${UML_UTILITIES}
+
+fpkg_gnu   ${GMP}
+fpkg_gnu   ${GUILE}
+
+fpkg_sf    ${LIBBOOST}
+
+# Return last error
+exit $?
diff --git a/stage3/resources/ColorGNU.xpm b/stage3/resources/ColorGNU.xpm
new file mode 100644 (file)
index 0000000..6e069f6
--- /dev/null
@@ -0,0 +1,76 @@
+/* XPM */
+static char * ColorGNU_xpm[] = {
+"48 48 25 1",
+"      c None",
+".     c #965871C65144",
+"X     c #DF7DAEBA8617",
+"o     c #965861855144",
+"O     c #5144410330C2",
+"+     c #000000000000",
+"@     c #861771C65144",
+"#     c #EFBEEFBEEFBE",
+"$     c #9E79A2899E79",
+"%     c #618561854103",
+"&     c #9E79A2898617",
+"*     c #AEBAA2898617",
+"=     c #9E79A28971C6",
+"-     c #861771C64103",
+";     c #9E79AEBA8617",
+":     c #9E79AEBA71C6",
+">     c #DF7DBEFB71C6",
+",     c #71C661855144",
+"<     c #DF7DBEFB8617",
+"1     c #DF7DAEBA71C6",
+"2     c #4103410330C2",
+"3     c #618571C64103",
+"4     c #514441032081",
+"5     c #514430C230C2",
+"6     c #410341032081",
+"                                      .Xo..OO+OO",
+"    O                           O   . ..@O.O+OO.",
+"   +#             ++#####$##O%   O ....@oOO+OOoO",
+"   O#            O###OO$#+###++O$$O+++@OO&OOOOO.",
+"  +#O         O+$###*O+OOO####*#++OOOO++*=+OOOo-",
+"  %#O         ###+##;*+.@#O#O####$O+OO+&;*+OO.O.",
+"  O#$        +####*=*OO@o@#O$##=*+OOOO+=*=++OOo@",
+"  ;O#O       ##O#&;#+.@X@.OO%O##:#+OOO#&:&+OO.@.",
+"  *O#+      +$###=*:O.o>X.oO,###*O+++O#:*O+OOOo-",
+"  :&#+     +#####O:##.<X<X@.OO##;#++O#:&;+XOOOO.",
+"  *##$    +#####*=*+o@X1X@oOO$###O+O$#*=*+XOOOoO",
+"  ;&##    ###$#&:&++@X<X<X@.O+###&#+%#;O:+OOOOO.",
+"  *:##$  +####*:*++Oo1X>X.o+++*:##*%,=*:*++OO.O-",
+"  %&###$+###;*:&;O+.@X<X<OO++++&;##O;*%&O.O+O+O.",
+"   =*######=*=*%O%+@o1X1oX++++++*=*=*=*%+@O+++O@",
+"   &:#####;&:&+++++X<X<.@+++2+O++&;&:O3O%++X+OO.",
+"   :*=*#*=*:,+.++4+4X1X>5++45+O-o+#%,%+++OO+O++-",
+"   &#*:&;*:&O +.+O2O2.@O2+2O+O+O@+$O+++++++.+++.",
+"    O=O=O=OO  $+.65456545654+++++@+%+O+OOXo@+OO@",
+"     O3O%O     +.O+++O2O+++O+#O++.OXO.OX@+++++O.",
+"               4++5454++O+O-o#oO++++++++++++++o-",
+"               O+.@.+++++O+O+.+++++++++++++++OO.",
+"               4++o@+++456o+oOo++6++++++++++oOO@",
+"              ++O.<.O++O@.@.@.+O+O+++O+O+O2O2.@.",
+"               4o.X>o+5-o1X>o.O+54++++O+5454oOo-",
+"               O@.<X@O2.<X<.@.O++++++O+O2O2.O.@.",
+"               45@X1o6o@X1X@O+++O+++O+5456oOo@o@",
+"               O2.<X@+@X<X@O+++O+++O+O2O2O2.@.@X",
+"               .5.X>XOo>X1o-+O.+++++O+5454o-o.X-",
+"              ..2.@X<O@X<X@O++.O+++O+O2.2.O.@X@X",
+"              ..56o1XOo1X@O+++  O+O+565456o@X@X1",
+"               .2O@X<.@X<.O+++   ++O+O2.2.@.@X<X",
+"              .-54o-o+o-oO+++O   +++5454oOo-X.X>",
+"              <O2O2.@+2.@O+++    $+++O2.O.@.@X<X",
+"              +45@o456545++++     ++5654oOo@X@X1",
+"              <+++2O+O2O+.@O+     +O+O2O2.@X@X<X",
+"              <++X54+454X+o+5     $+++54oOo-X.X>",
+"              @.+O2O2O2OX+@++      $+O+O@.@.@X<X",
+"              +OX6o@o@5XX+oO+       O+5456o@X@X1",
+"              O++O@.OO+O+O2++        ++O2.@.@X@X",
+"                O++++++$+4++         +++54o-o.X>",
+"                  O$XXXXXX+           ++2.O.@.@X",
+"                  $O+$+@oO+           ++56oOo@X@",
+"                   O++OO++            ++2O2.@.@X",
+"                    o.+OO$            O+545-o.o-",
+"                       +               ++O2O2.@.",
+"                       $               ++654oOo@",
+"                                       +++2O2.@X"};
diff --git a/stage3/resources/mail-files.sh b/stage3/resources/mail-files.sh
new file mode 100755 (executable)
index 0000000..b910580
--- /dev/null
@@ -0,0 +1,307 @@
+#!/bin/sh
+
+# script to email files as attachments.
+# ------------------------------------
+
+# Additional documentation for this script, including a brief introdcution 
+# to MIME can be found at:  http://home.clara.net/dwotton/unix/mail_files.htm
+
+# Written: Dave Wotton, July 1998, (Cambridge UK)
+#          This script comes with no warranty or support. You are
+#          free to modify it as you wish, but please retain an
+#          acknowledgement of my original authorship.
+
+# Amended: Dave Wotton, 6/3/99
+#          -t flag now optional. subject also optional
+#
+# Amended: Dave Wotton, 3/8/00
+#          added -b and -u  options. By default a file-list which is not
+#          preceded by a -n, -b, or -u flag is now NOT encoded (the previous
+#          default was to base64 encode it.).
+#
+# Amended: Dave Wotton, 10/10/00
+#          added a -c (cc:) option.
+#          Added a tty -s test to prevent the prompt to enter the text body
+#          being displayed when not connected to a tty. (The text body is
+#          still required though. /dev/null will suffice.)
+#
+# Amended: Dave Wotton, 24/2/01
+#          Now uses perl to perform the base64 encoding, as it comes as
+#          standard on most modern Unixes. (You need the perl MIME package
+#          though, which I believe is standard. )
+
+# Amended: Dave Wotton, 22/09/01
+#          Now creates a "To:" header and uses the sendmail -t flag to
+#          duplicate this as the envelope recipients, rather than using the
+#          user supplied list of addresses simply as envelope recipients.
+#          This confused some mail clients, specifically Lotus Notes.
+
+# Amended: Dave Wotton, 30/09/01
+#          Now initialises the main variables, so that previously set
+#          environment variable values (eg. $CC) aren't used instead.
+#          Enable multiple occurrences of the -t and -c flags. Thanks to
+#          Jason Judge for these suggestions.
+
+
+# Usage:   mail_files [-t] mailid [ -c mailid ] [ -s subject ] [ -f mailid ] 
+#          [-n file_list] [-u file_list] [-b file_list] file_list
+#
+#    -f      : The mailid of the sender ( defaults to your userid )
+#              Only userids that have been defined as "trusted" in the sendmail
+#              config file can make use of the -f option. For non-trusted users
+#              any value specified by this parameter will be ignored by 
+#              sendmail.
+#    -t      : The mailid of the recipient. Mandatory, no default
+#              multiple mailids can be specified, separated by commas.
+#    -c      : The mailid of any carbon-copy recipients. Optional.
+#              multiple mailids can be specified, separated by commas.
+#    -s      : The subject string. Optional, default = "Not specified".
+#              Enclose in quotes.
+#    -n      : no-encode: indicates a list of files which are NOT to be base64
+#              or uuencode encoded. Multiple files may be enclosed in double
+#              quotes. Usual wildcard notation can be used. This option is
+#              for completeness and can be omitted because the default action 
+#              is not to encode the file-list.
+#    -b      : base64 encoding: indicates a list of files which are to be 
+#              base64 encoded. Multiple files may be enclosed in double quotes.
+#              Usual wildcard notation can be used.
+#    -u      : uuencode encoding: indicates a list of files which are to be 
+#              uuencode encoded. Multiple files may be enclosed in double 
+#              quotes. Usual wildcard notation can be used.
+#  file_list : The list of files to send as attachments with no-encoding
+#              (same as -n option, but the file list does not need to be
+#              enclosed in quotes if more than one file specified). 
+#              Usual wildcard notation can be used.
+
+# The program will also prompt for text to be supplied on standard input
+# as the main text of the message.
+
+# eg.
+#      1) mail_files Dave.Wotton -b file9.gif t*.htm < /dev/null
+#
+#         email file9.gif as a base64 encoded attachment and the t*.htm
+#         files unencoded.
+#
+#      2) mail_files Dave.Wotton -s "my test" -b "file1.gif file2.gif" \
+#                    < /dev/null
+#
+#         email file1.gif and file2.gif as base64 encoded attachments.
+
+# The script makes use of perl's MIME package to perform the base-64 
+# encoding/decoding. 
+
+# Note that files destined for Windows environments should have a name of
+# the form aaaa.bbb where aaaa is up to 8 characters long, and bbb is a
+# 3 character sufix. The suffix determines which program is used to
+# display/process the data at the remote end.
+
+# Simple text files can be emailed unencoded. Binary files, or text files
+# with long lines ( ie > 1000 chars ) should use the  base64 or uuencode 
+# encoding procedures. Base64 is preferred because it is more universally
+# supported. In particular, most PC mail-clients can automatically decode
+# base64 encoded attachments. Note that simple text files with short lines 
+# which are destined for PC environments should not be base64 encoded.
+# This is because PCs use a different line-break character to Unix.
+# If the text is base64 encoded, the line-breaks are not converted
+# automatically and so the data arrives at the remote end without
+# line-breaks.
+
+# set up a 'usage' routine
+# ------------------------
+
+usage()
+{
+  [ "$1" ] && ( echo $* ; echo "" )
+
+  cat <<!
+  Usage:   mail_files [-t] mailid [ -c mailid ] [ -s subject ] [ -f mailid ] 
+           [-n file_list] [-u file_list] [-b file_list] file_list
+!
+  exit 4
+}
+
+# Initialise main variables ...
+# -------------------------
+
+FROM=$LOGNAME
+SUBJ=${SUBJ:-"Not specified"}
+
+TO="" ; CC="" ; SUBJ="" ; NOENC="" ; BASE64="" ; UUE=""
+
+# First parse the command line options. Using getopts means the parameters
+# can be supplied in any order. But first we handle the first parameter,
+# which may be a recipient, without a -t flag...
+
+case "$1" in
+   -* ) : ;;                   # ignore it, let getopts handle flags
+    * ) TO=$1 ; shift ;;
+esac
+
+while getopts f:s:t:c:n:b:u: OPT
+do
+     case $OPT in
+         "f" ) FROM=$OPTARG ;;
+         "t" ) TO="$TO,$OPTARG" ;;
+         "c" ) CC="$CC,$OPTARG" ;;
+         "s" ) SUBJ=$OPTARG ;;
+         "n" ) NOENC="$NOENC $OPTARG" ;;
+         "b" ) BASE64="$BASE64 $OPTARG" ;;
+         "u" ) UUE="$UUE $OPTARG" ;;
+          *  ) usage ;;
+     esac
+done
+
+shift `expr $OPTIND - 1`
+
+if [ "$TO" = "" ]
+then
+    usage "An addressee must be specified"
+fi
+
+# All remaining parameters are files not requiring encoding ...
+# ---------------------------------------------------------
+
+# Build up $FILES as the list of non-encoded files. Use sed to remove
+# any leading space from the variable.
+
+FILES=`echo $NOENC $*|sed 's/^ //'`
+
+if [ "$BASE64" = "" -a "$FILES" = "" -a "$UUE" = "" ]
+then
+    usage "At least one file must be specified"
+fi
+
+# Remove leading commas from TO, CC  ...
+# ---------------------------------
+
+TO=`echo $TO | sed 's/^,//'`
+CC=`echo $CC | sed 's/^,//'`
+
+# Validate that the files exist ...
+# -----------------------------
+
+for F in $FILES $BASE64 $UUE
+do
+   if [ ! -r $F ]
+   then
+      echo "Error: File $F does not exist / is not readable."
+      echo "Exiting. ( Mail not sent )."
+      exit
+   fi
+done
+
+tty -s && echo "Enter text of main message ( finish with CTRL-D ) ..."
+
+# Now do the work ...
+# ---------------
+
+# The generated mail message is output onto standard out, which is then
+# piped in to sendmail.
+
+(
+cat <<!
+From: $FROM
+Subject: $SUBJ
+To: $TO
+!
+
+[ "$CC" ] && echo "Cc: $CC"
+
+cat <<!
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"
+
+This is a Mime message, which your mail program may not understand. Parts
+of the message will appear as text. If the remainder appears as random
+characters in the message body, instead of as attachments, then you'll
+have to extract these parts and decode them manually.
+
+--DMW.Boundary.605592468
+Content-Type: text/plain; name="message.txt"; charset=US-ASCII
+Content-Disposition: inline; filename="message.txt"
+Content-Transfer-Encoding: 7bit
+
+!
+
+# Read the standard input as the main text of the message ...
+# -------------------------------------------------------
+
+cat - 
+
+# Now process the non-encrypted attachments ...
+# -----------------------------------------
+
+if [ "$FILES" ]
+then
+    for F in $FILES
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: 7bit
+       echo
+
+       cat $F
+
+    done
+fi
+
+# Now process the base64 encrypted attachments ...
+# --------------------------------------------
+
+if [ "$BASE64" ]
+then
+    for F in $BASE64
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: base64
+       echo
+
+       perl -e '
+       use MIME::Base64 qw(encode_base64);
+       local($/) = undef;
+       print encode_base64(<STDIN>);' < $F
+
+    done
+fi
+
+# Now process the uuencode encrypted attachments ...
+# ----------------------------------------------
+
+# Sorry, this bit is untested - I haven't got a mail-client which can
+# handle uuencoded MIME messages automatically, so can't test if the
+# 'Content-Transfer-Encoding: uuencode' line is correct and whether I
+# need the uuencode "begin" and "end" lines.
+
+if [ "$UUE" ]
+then
+    for F in $UUE
+    do
+
+       BASE=`basename $F`
+
+       echo --DMW.Boundary.605592468
+       echo Content-Type: application/octet-stream\; name=\"$BASE\"
+       echo Content-Disposition: attachment\; filename=\"$BASE\"
+       echo Content-Transfer-Encoding: uuencode
+       echo
+
+       uuencode < $F xxx 
+
+    done
+fi
+
+# append the final boundary line ...
+
+echo --DMW.Boundary.605592468--
+
+) | /usr/sbin/sendmail -t -r ${FROM}
+#> test.txt
diff --git a/stage3/stage3-additions b/stage3/stage3-additions
new file mode 100755 (executable)
index 0000000..c486323
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage3"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage3
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+init_log_file
+
+ipkg     ${JAVA} cis-java
+ipkg_ac  ${ED}
+ipkg      ${UML_UTILITIES} cis-uml-utilities
+
+exit $?
diff --git a/stage3/stage3-install b/stage3/stage3-install
new file mode 100755 (executable)
index 0000000..0af34fb
--- /dev/null
@@ -0,0 +1,353 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage3"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage3
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/tmp
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+init_log_file
+
+# For updating dynamic DNS entries.
+if [ "x${USE_DYNAMIC_DNS}" = "xyes" ]; then
+    ipkg     ${DDCLIENT} cis-ddclient
+fi
+
+# Networking
+ipkg       ${INETUTILS} cis-inetutils
+
+# Network/debugging tools
+ipkg_ac    ${LIBPCAP} "--enable-yydebug"
+ipkg_ac    ${TCPDUMP}
+ipkg_ac_nb ${NMAP}
+ipkg_ac    ${STRACE}
+
+# Bind server
+ipkg     ${BIND} cis-bind
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg     ${IPTABLES} cis-iptables
+    ipkg     ${MYSQL} cis-mysql
+fi
+
+ipkg       ${UNZIP} cis-unzip
+ipkg       ${ZIP}   cis-zip
+
+# Installing only CVS client.
+ipkg_ac    ${CVS_PACKAGE} "--disable-server"
+
+ipkg_ac    ${PARTED}
+
+# Graphic libraries
+ipkg_ac    ${LIBJPEG} "--enable-static --enable-shared"
+ipkg_ac    ${LIBPNG}
+ipkg_ac    ${LIBTIFF}
+ipkg_ac    ${GIFLIB}
+ipkg_ac_nb ${LCMS}
+ipkg       ${LIBMNG}   cis-libmng
+ipkg_ac    ${LIBEXIF}
+ipkg_ac    ${LIBART}
+ipkg_ac    ${FRIBIDI}
+
+# X
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg_ac  ${FREETYPE}
+    ipkg     ${FONTCONFIG}  cis-fontconfig
+    ipkg     ${T1LIB}       cis-t1lib
+    ipkg     ${XFREE86}     cis-xfree86
+    source /etc/profile
+
+    # Some packages (Gnome control center) require a more
+    # recent version of libxft than the one installed by XFree86.
+    ipkg_ac  ${LIBXFT}  "--prefix=/usr/X11R6"
+
+    ipkg     ${WINDOWMAKER} cis-windowmaker
+    ipkg_ac  ${WINDOWMAKER_EXTRA}
+
+    # Open Source version of OSF/Motif
+    ipkg_ac  ${LESSTIF} "--disable-debug --enable-production --with-xdnd --disable-build-tests"
+    # Re-installing emacs now that X is present (it was installed in stage 2)
+    ipkg     ${EMACS} cis-emacs
+fi
+
+ipkg     ${TCL} cis-tcl
+ipkg     ${TK}  cis-tk
+
+# Python is required by libxml2
+ipkg_ac ${PYTHON} "--enable-shared"
+
+# Needed by inkscape
+ipkg    ${LIBBOOST} cis-boost
+
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    # DocBook
+    ipkg       ${SGML_COMMON}   cis-sgml-common
+    ipkg       ${SGML_DTD3}     cis-sgml-dtd3
+    ipkg       ${SGML_DTD4}     cis-sgml-dtd4
+    ipkg       ${OPENSP}        cis-opensp
+    ipkg       ${OPENJADE}      cis-openjade
+    ipkg       ${DOCBOOK_DSSSL} cis-docbook-dsssl
+    ipkg       ${DOCBOOK_UTILS} cis-docbook-utils
+    ipkg_ac_nb ${LIBXML2}
+    ipkg_ac_nb ${LIBXSLT}
+    ipkg       ${DOCBOOK_XML}   cis-docbook-xml
+    ipkg       ${DOCBOOK_XSL}   cis-docbook-xsl
+    ipkg       ${SGML_SPM}      cis-sgml-spm
+
+    ipkg       ${XMLTOMAN}      cis-xmltoman
+
+    # Perl modules
+    ipkg_pm    ${PERL_MOD_PDL}
+    ipkg_pm    ${PERL_MOD_XML_WRITER}
+    ipkg_pm    ${PERL_MOD_XML_PARSER}
+
+    # Needed by Tango
+    ipkg_pm    ${PERL_MOD_XML_SIMPLE}
+    ipkg_pm    ${PERL_MOD_PARSE_REDESCENT}
+
+    # Required PERL modules for SpamAssassin
+    ipkg_pm    ${PERL_MOD_HTML_TAGSET}
+    ipkg_pm    ${PERL_MOD_HTML_PARSER}
+    ipkg_pm    ${PERL_MOD_APACHE_LOGGED_AUTH_DBI}
+    ipkg_pm    ${PERL_MOD_DB_FILE}
+    ipkg_pm    ${PERL_MOD_DIGEST_SHA1}
+    ipkg_pm    ${PERL_MOD_URI}
+    ipkg_pm    ${PERL_MOD_LWP}
+    ipkg       ${PERL_MOD_NET_DNS} cis-pm-net-dns
+
+    # Needed by OpenOffice ???
+    ipkg_pm    ${PERL_MOD_ARCHIVE_ZIP}
+    ipkg_pm    ${PERL_MOD_COMPRESS_ZLIB}
+    ipkg_pm    ${PERL_MOD_IO_COMPRESS_BASE}
+    ipkg_pm    ${PERL_MOD_COMPRESS_RAW_ZLIB}
+    ipkg_pm    ${PERL_MOD_IO_COMPRESS_ZLIB}
+
+    # Gtk
+    ipkg_ac    ${GTK_DOC}
+    ipkg_ac    ${GLIB2}
+    ipkg_ac    ${PIXMAN}
+    ipkg_ac    ${GLITZ}
+    ipkg_ac    ${CAIRO} "--enable-glitz"
+    ipkg_ac    ${PANGO}
+    ipkg_ac    ${ATK}
+    ipkg_ac    ${GTK2}
+    ipkg_ac    ${GTK_ENGINES}
+    ipkg_ac    ${PYGTK}
+
+    ipkg_ac    ${LIBSIGCPP}
+    ipkg_ac    ${GC}
+    ipkg_ac    ${GLIBMM}
+    ipkg_ac    ${CAIROMM}
+    ipkg_ac    ${GTKMM}
+    ipkg_ac_nb ${HICOLOR_ICON_THEME}
+
+    ipkg_ac    ${HVCLOCK}
+    ipkg_ac    ${WMNOTIFY}
+
+    # Needed by GNOME-2
+    ipkg_ac    ${DESKTOP_FILE_UTILS}
+    ipkg_ac    ${SHARED_MIME_INFO}
+    ipkg_ac    ${STARTUP_NOTIFICATION}
+    ipkg_ac    ${LIBWNCK}
+    ipkg_ac    ${LIBXKLAVIER}
+    ipkg_ac    ${LIBGLADE}
+    ipkg_ac    ${LIBSOUP}
+    ipkg_ac    ${LIBIDL}
+fi
+
+# Needed by inkscape SVN
+ipkg_ac ${INTLTOOL}
+
+ipkg_ac ${GSL}
+
+ipkg     ${CUPS}     cis-cups
+ipkg     ${ESPGS}    cis-espgs
+
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg       ${LIBUSB}  cis-libusb
+    ipkg_ac    ${LIBGPHOTO2}
+
+    ipkg_ac    ${IMAGE_MAGICK} "--with-modules"
+
+    ipkg_ac    ${POPPLER} "--enable-xpdf-headers --enable-zlib"
+
+    ipkg_ac    ${LIBRSVG} "--disable-gtk-doc --disable-mozilla-plugin"
+    ipkg_ac    ${GIMP} "--disable-print"
+
+    ipkg_ac    ${INKSCAPE} "CFLAGS=\"-DPOPPLER_NEW_GFXFONT\""
+fi
+
+ipkg     ${FOX} cis-fox
+ipkg     ${XFE} cis-xfe
+
+ipkg_ac  ${BC} "--with-readline"
+ipkg     ${CDRTOOLS} cis-cdrtools
+ipkg     ${DVDRWTOOLS} cis-dvd-rw-tools
+
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    # TeTeX needs ed.
+    ipkg_ac  ${ED}
+    ipkg     ${TETEX_SRC} cis-tetex
+    ipkg     ${JADETEX}   cis-jadetex
+    ipkg_ac  ${PSTOEDIT}
+fi
+
+if [ "x${SANE_SUPPORT}" = "xyes" ]; then
+    ipkg     ${SANE_BACKENDS} cis-sane-backends
+    ipkg     ${XSANE} cis-xsane
+fi
+
+ipkg_ac  ${ICON_NAMING_UTILS}
+ipkg_ac  ${TANGO_ICON_THEME}
+ipkg_ac  ${TANGO_ICON_THEME_EXTRAS}
+
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    # Sound
+    if [ "x${SOUND_CARD}" = "xyes" ]; then
+        # Needed by some packages, mostly audio applications.
+        ipkg_ac    ${LIBOIL}
+
+        # ALSA
+       ipkg       ${ALSA_LIB}   cis-alsa-lib
+       ipkg       ${ALSA_UTILS} cis-alsa-utils
+       ipkg_ac    ${ALSA_OSS}
+
+        # Audio raw utilities
+        ipkg_ac    ${LIBSAMPLERATE}
+       ipkg_ac    ${TAGLIB}
+
+        # Audio file formats
+       ipkg_ac    ${LIBOGG}
+       ipkg_ac    ${LIBVORBIS}
+       ipkg_ac_nb ${FLAC}
+       ipkg_ac    ${LAME}
+        ipkg_ac    ${LIBA52} "--enable-shared"
+       ipkg       ${LIBID3TAG} cis-libid3tag
+       ipkg       ${LIBMAD} cis-libmad
+
+        ipkg_ac_nb ${LIBFAAC}
+        ipkg_ac_nb ${LIBFAAD2}
+
+        # Audio libraries
+       ipkg_ac_nb ${AUDIOFILE}
+        ipkg_ac    ${PORTAUDIO}
+       ipkg_ac    ${LIBSNDFILE}
+
+        # Audio servers
+       ipkg_ac  ${ESOUND}
+        ipkg     ${PULSEAUDIO} cis-pulseaudio
+       ipkg_ac  ${JACK} "--disable-portaudio"
+
+       ipkg_ac  ${ALSA_PLUGINS} # Depends on pulseaudio
+       ipkg_ac  ${VORBIS_TOOLS}
+        
+        # Audio applications
+       ipkg_ac_nb ${LIBMCS}
+        ipkg_ac_nb ${LIBMOWGLI}
+       ipkg_ac_nb ${AUDACIOUS} # Depends on mcs and libmowgli
+       ipkg_ac_nb ${AUDACIOUS_PLUGINS} "--disable-hotkey"
+       ipkg_ac_nb ${GRIP}
+        ipkg_ac_nb ${CDRDAO}
+        ipkg_ac    ${WXGTK} "--enable-unicode"
+        ipkg       ${AUDACITY} cis-audacity # Depends on portaudio and wxgtk
+    fi
+
+    ipkg_ac    ${SYLPHEED} "--enable-ssl --enable-ldap"
+
+    ipkg       ${QT} cis-qt
+    ipkg       ${OPERA} cis-opera
+
+    ipkg       ${NSS} cis-nss
+
+    ipkg       ${FIREFOX} cis-firefox
+
+    # Plugins for Opera and Firefox
+    ipkg       ${JAVA} cis-java
+    ipkg       ${FLASH_PLUGIN} cis-flashplugin
+
+    ipkg_ac_nb ${FFMPEG} "--enable-shared --enable-pthreads --enable-swscaler --enable-liba52 \
+                          --enable-gpl --disable-ffplay --enable-libfaac --enable-libfaad \
+                          --enable-libmp3lame"
+    ipkg       ${XVIDCORE} cis-xvidcore
+    ipkg_ac    ${XINELIB}
+    ipkg_ac_nb ${GXINE}
+    ipkg       ${MPLAYER_CODECS} cis-mplayer-codecs
+    ipkg       ${MPLAYER} cis-mplayer
+fi
+
+ipkg_ac  ${MINICOM}
+
+ipkg    ${DBUS}      cis-dbus
+ipkg_ac ${DBUS_GLIB} "--disable-tests --disable-dependency-tracking --disable-xml-docs --disable-doxygen-docs"
+ipkg    ${HAL}       cis-hal
+
+# Mail
+ipkg     ${SASL2}     cis-sasl2
+ipkg     ${OPENLDAP}  cis-openldap
+ipkg     ${KERBEROS5} cis-krb5
+ipkg     ${SENDMAIL}  cis-sendmail
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg     ${PROCMAIL} cis-procmail
+    ipkg_ac  ${LIBSPF2}
+    ipkg     ${MILTER_SPF} cis-milter-spf
+    ipkg     ${MILTER_GREYLIST} cis-milter-greylist
+fi
+
+# fcron needs sendmail installed.
+ipkg     ${FCRON}   cis-fcron
+ipkg     ${GETDATE} cis-getdate
+
+if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg     ${CLAMAV}       cis-clamav
+    ipkg     ${SPAMASSASSIN} cis-spamassassin
+    ipkg     ${UW_IMAP}      cis-uw-imap
+
+    # Apache
+    ipkg     ${HTTPD} cis-apache
+    # CURL is needed by PHP
+    ipkg_ac  ${CURL}
+    ipkg     ${PHP}   cis-php
+
+    ipkg     ${SQUIRRELMAIL} cis-squirrelmail
+
+    ipkg     ${MAILMAN} cis-mailman
+
+    # Subversion server (client was already installed in stage2) 
+    ipkg     ${SUBVERSION} cis-subversion
+fi
+
+    ipkg_ac_nb ${GIT}
+    ipkg       ${GIT_MANPAGES} cis-git-manpages
+
+if [ "x${USE_SAMBA}" = "xyes" ]; then
+    ipkg     ${SAMBA} cis-samba
+fi
+
+if [ "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg     ${TFTP_HPA} cis-tftp-hpa
+    ipkg     ${LTSP_UTILS} cis-ltsp-utils
+fi
+
+ipkg_ac_nb ${KVM}
+ipkg_ac_nb ${BRIDGE_UTILS}
+ipkg       ${UML_UTILITIES} cis-uml-utilities
+
+# Pour lilypond
+ipkg_ac   ${GMP} "--enable-cxx --enable-mpbsd ABI=32"
+ipkg      ${GUILE} cis-guile
+#ipkg mftrace
+
+./cis-postinstall
+
+exit $?
diff --git a/stage4/TODO b/stage4/TODO
new file mode 100644 (file)
index 0000000..3af397a
--- /dev/null
@@ -0,0 +1,2 @@
+
+-Gnome: Utiliser --disable-accessibility pour tous les packages?
diff --git a/stage4/cis-ac b/stage4/cis-ac
new file mode 120000 (symlink)
index 0000000..9214a69
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac
\ No newline at end of file
diff --git a/stage4/cis-ac-nobuild b/stage4/cis-ac-nobuild
new file mode 120000 (symlink)
index 0000000..06c3fe7
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac-nobuild
\ No newline at end of file
diff --git a/stage4/cis-evolution b/stage4/cis-evolution
new file mode 100755 (executable)
index 0000000..68fd22f
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} \
+    --with-nss-includes=/usr/include/nss \
+    --with-nspr-includes=/usr/include/nspr \
+    --with-openldap=yes \
+    --with-krb5=/usr &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-evolution-data-server b/stage4/cis-evolution-data-server
new file mode 100755 (executable)
index 0000000..104496d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} \
+    --with-nss-includes=/usr/include/nss \
+    --with-nspr-includes=/usr/include/nspr \
+    --with-openldap=yes \
+    --with-krb5=/usr &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-evolution-exchange b/stage4/cis-evolution-exchange
new file mode 100755 (executable)
index 0000000..98db036
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gail b/stage4/cis-gail
new file mode 100755 (executable)
index 0000000..a8b64aa
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --localstatedir=/var/lib \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install || exit 1
+
+if [ x"${GNOME2_PREFIX}" != "x/usr" ]; then
+    ln -v -sf ${GNOME2_PREFIX}/lib/gtk-2.0/modules \
+       /usr/lib/gtk-2.0 || exit 1
+fi
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gal b/stage4/cis-gal
new file mode 100755 (executable)
index 0000000..83b0f5a
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# In order to build the documentation using GTK-Doc, to fix a build problem.
+cd ${LFS_TMP}/${1} &&
+mv docs/gal-decl.txt docs/gal-2.4-decl.txt &&
+mv docs/gal-sections.txt docs/gal-2.4-sections.txt &&
+sed -i -e "s/gal-decl/gal-2.4-decl/" \
+    -e "s/gal-sections/gal-2.4-sections/" docs/Makefile.in &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --localstatedir=/var/lib \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gdm b/stage4/cis-gdm
new file mode 100755 (executable)
index 0000000..804dba8
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+hv_groupadd -g 21 gdm &&
+hv_useradd -c "GDM_Daemon_Owner" -d /dev/null -g gdm -s /bin/bash -u 21 gdm &&
+
+CFLAGS="${CFLAGS} -ldl"
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --localstatedir=/var/lib \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --with-pam-prefix=/etc \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+install -v -m755 -d /var/log/gdm &&
+
+# Changing the directory containing the GDM log files to the /var/log hierarchy.
+sed -i.orig "/\[daemon\]/ a LogDir=/var/log/gdm" \
+    /etc/gnome/${GNOME2_VER}/gdm/custom.conf &&
+rmdir -v /var/lib/log/gdm &&
+rmdir -v /var/lib/log &&
+
+cat > /etc/pam.d/gdm << "EOF" &&
+auth        required    pam_unix.so
+auth        required    pam_nologin.so
+account     required    pam_unix.so
+password    required    pam_unix.so
+session     required    pam_unix.so
+EOF
+
+cat > /etc/pam.d/gdm-autologin << "EOF" &&
+auth        required    pam_env.so
+auth        required    pam_nologin.so
+auth        required    pam_permit.so
+account     required    pam_unix.so
+password    required    pam_unix.so
+session     required    pam_unix.so
+EOF
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gedit b/stage4/cis-gedit
new file mode 100755 (executable)
index 0000000..12b16e0
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} \
+    --disable-spell &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome b/stage4/cis-gnome
new file mode 100755 (executable)
index 0000000..b6297eb
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-applets b/stage4/cis-gnome-applets
new file mode 100755 (executable)
index 0000000..f473faf
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+make -C man install-man &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-audio b/stage4/cis-gnome-audio
new file mode 100755 (executable)
index 0000000..ff667e3
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+make prefix=${GNOME2_PREFIX} install
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-config b/stage4/cis-gnome-config
new file mode 100755 (executable)
index 0000000..b1b0e6c
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# For Gnome 2 variables
+var_add_path "PATH" /etc/profile "/opt/${GNOME2_VER}/bin" &&
+var_export   "PATH" /etc/profile &&
+var_add_path "PKG_CONFIG_PATH" /etc/profile "/opt/${GNOME2_VER}/lib/pkgconfig" &&
+var_export   "PKG_CONFIG_PATH" /etc/profile &&
+var_add_path "LIBGLADE_MODULE_PATH" /etc/profile "${GNOME2_PREFIX}/lib/libglade/2.0" &&
+var_export   "LIBGLADE_MODULE_PATH" /etc/profile &&
+var_add_path "XDG_CONFIG_DIRS" /etc/profile "/etc/gnome/${GNOME2_VER}/xdg" &&
+var_export   "XDG_CONFIG_DIRS" /etc/profile &&
+
+# For Gnome 1 and 2 common variable
+var_add_path "GNOME_LIBCONFIG_PATH" /etc/profile "/usr/lib" &&
+var_export   "GNOME_LIBCONFIG_PATH" /etc/profile &&
+
+string_add "/opt/${GNOME2_VER}/lib" /etc/ld.so.conf &&
+
+var_add_path "MANPATH" /etc/profile "/opt/${GNOME2_VER}/man" &&
+var_export   "MANPATH" /etc/profile &&
+
+# There is a third mechanism for customizing the search path. If a
+# `dirlist' file exists in acdir, then that file is assumed to contain a
+# list of directories, one per line, to be added to the search list. These
+# directories are searched after all other directories.
+touch /usr/share/aclocal/dirlist &&
+string_add "/opt/${GNOME2_VER}/share/aclocal" /usr/share/aclocal/dirlist &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-media b/stage4/cis-gnome-media
new file mode 100755 (executable)
index 0000000..7f57142
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+./cis-gnome ${1} &&
+gst-register
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-mime-data b/stage4/cis-gnome-mime-data
new file mode 100755 (executable)
index 0000000..c5f35e1
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+install -v -m644 -D man/gnome-vfs-mime.5 \
+    ${GNOME2_PREFIX}/man/man5/gnome-vfs-mime.5 &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnome-nobuild b/stage4/cis-gnome-nobuild
new file mode 100755 (executable)
index 0000000..98db036
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-gnumeric b/stage4/cis-gnumeric
new file mode 100755 (executable)
index 0000000..53158b7
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --localstatedir=/var/lib \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+
+ln -svf /usr/share/gnome/help/gnumeric \
+    /usr/share/gnumeric/$(get_pkg_ver ${1})/doc &&
+
+if [ $(pkg-config --variable=prefix ORBit-2.0) != "/usr" ]; then
+    mv -v /usr/lib/bonobo/servers/GNOME_Gnumeric.server \
+        $(pkg-config --variable=prefix ORBit-2.0)/lib/bonobo/servers &&
+    rmdir -v /usr/lib/{bonobo/servers,bonobo}
+fi &&
+
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-iso-codes b/stage4/cis-iso-codes
new file mode 100755 (executable)
index 0000000..54884db
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./autogen.sh --prefix=/usr &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-libmusicbrainz b/stage4/cis-libmusicbrainz
new file mode 100755 (executable)
index 0000000..ddc0865
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+cd ${LFS_TMP}/${1} &&
+install -v -m644 -D docs/mb_howto.txt /usr/share/doc/${1}/mb_howto.txt &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-metacity b/stage4/cis-metacity
new file mode 100755 (executable)
index 0000000..7845d26
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/lib/metacity \
+    --with-gconf-schema-file-dir=/etc/gnome/${GNOME2_VER}/gconf/schemas \
+    --sysconfdir=/etc &&
+make &&
+make install &&
+cd ${LFS_TMP}/${1} &&
+install -v -m755 -d /usr/share/doc/${1} &&
+install -v -m644 README rationales.txt doc/*.txt /usr/share/doc/${1} &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-nautilus b/stage4/cis-nautilus
new file mode 100755 (executable)
index 0000000..59c3c34
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=${GNOME2_PREFIX} \
+    --libexecdir=${GNOME2_PREFIX}/sbin \
+    --localstatedir=/var/lib \
+    --infodir=${GNOME2_PREFIX}/share/info \
+    --sysconfdir=/etc/gnome/${GNOME2_VER} &&
+make &&
+make install &&
+install -v -m755 -d ${GNOME2_PREFIX}/share/doc/${NAUTILUS} &&
+install -v -m644 ${LFS_TMP}/${1}/docs/*.{txt,dia,pdf,sxw,faq,html} \
+    ${GNOME2_PREFIX}/share/doc/${NAUTILUS} &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-pcre b/stage4/cis-pcre
new file mode 100755 (executable)
index 0000000..9c7cf79
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --docdir=/usr/share/doc/${1} \
+    --enable-utf8 &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-scrollkeeper b/stage4/cis-scrollkeeper
new file mode 100755 (executable)
index 0000000..e8c3684
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --localstatedir=/var \
+    --disable-static \
+    --with-omfdirs=/usr/share/omf:/opt/${GNOME2_VER}/share/omf &&
+make
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/cis-vte b/stage4/cis-vte
new file mode 100755 (executable)
index 0000000..13127d2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name.
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1} &&
+sed -i -e 's%\\177:%&kh=\\EOH:@7=\\EOF:%g' termcaps/xterm &&
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --libexecdir=/usr/sbin \
+    --disable-gtk-doc &&
+make &&
+make install &&
+ldconfig
+
+# Return last error
+exit $?
diff --git a/stage4/packages-update b/stage4/packages-update
new file mode 100644 (file)
index 0000000..b995e13
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+# Must be defined before sourcing other files.
+LFS_STAGE="stage4"
+
+# Reading system configuration informations, functions and package versions.
+source ../functions
+source ../functions-update
+source ../packages-list
+
+update_packages_init
+
+# Begin
+
+# Gnome 2 core packages
+fpkg_gnome ${ORBIT2}
+fpkg_gnome ${LIBBONOBO}
+fpkg_gnome ${GCONF}
+fpkg_gnome ${GNOME_MIME_DATA}
+fpkg_gnome ${GNOME_VFS}
+fpkg_gnome ${GNOME_VFS_MONIKERS}
+fpkg_gnome ${LIBGNOME}
+fpkg_gnome ${LIBGNOMECANVAS}
+fpkg_gnome ${LIBBONOBOUI}
+fpkg_gnome ${GNOME_ICON_THEME}
+fpkg_gnome ${GNOME_KEYRING}
+fpkg_gnome ${LIBGNOMEUI}
+fpkg_gnome ${GNOME_THEMES}
+fpkg_gnome ${SCROLLKEEPER}
+fpkg_gnome ${GNOME_DOC_UTILS}
+fpkg_gnome ${GNOME_DESKTOP}
+fpkg_gnome ${GNOME_BACKGROUNDS}
+fpkg_gnome ${GNOME_MENUS}
+fpkg_gnome ${GNOME_PANEL}
+fpkg_gnome ${GNOME_SESSION}
+fpkg_gnome ${VTE}
+fpkg_gnome ${GNOME_TERMINAL}
+fpkg_gnome ${LIBGTOP}
+fpkg_gnome ${LIBGNOMEKBD}
+fpkg_gnome ${GAIL}
+fpkg_gnome ${GNOME_APPLETS}
+fpkg_gnome ${EEL}
+fpkg_gnome ${NAUTILUS}
+fpkg_gnome ${YELP}
+fpkg_gnome ${METACITY}
+fpkg_gnome ${GNOME_CONTROL_CENTER}
+fpkg_gnome ${GNOME_USER_DOCS}
+
+# Gnome 2 additional packages - Libraries
+fpkg_gnome ${LIBGNOMECUPS}
+fpkg_gnome ${LIBGNOMEPRINT}
+fpkg_gnome ${LIBGNOMEPRINTUI}
+fpkg_gnome ${GTKHTML}
+fpkg_gnome ${EVOLUTION_DATA_SERVER}
+fpkg_gnome ${GTKSOURCEVIEW}
+fpkg_gnome ${SYSTEM_TOOLS_BACKENDS}
+fpkg_gnome ${GNOME_AUDIO}
+
+# Gnome 2 additional packages - Utilities
+fpkg_gnome ${GEDIT}
+fpkg_gnome ${EOG}
+fpkg_gnome ${EVINCE}
+fpkg_gnome ${GGV} # Gnome Ghostview
+fpkg_gnome ${FILE_ROLLER}
+fpkg_gnome ${GCONF_EDITOR}
+fpkg_gnome ${GNOME_UTILS}
+fpkg_gnome ${GNOME_SYSTEM_MONITOR}
+fpkg_gnome ${NAUTILUS_CD_BURNER}
+fpkg_gnome ${GSTREAMER}
+fpkg_gnome ${GST_PLUGINS_BASE}
+fpkg       ${GST_PLUGINS_GOOD} "http://gstreamer.freedesktop.org/src/gst-plugins-good"
+fpkg       ${GST_PLUGINS_UGLY} "http://gstreamer.freedesktop.org/src/gst-plugins-ugly"
+fpkg       ${GST_FFMPEG} "http://gstreamer.freedesktop.org/src/gst-ffmpeg"
+fpkg_gnome ${GNOME_MEDIA}
+fpkg_gnome ${GNOME_NETSTATUS}
+fpkg_gnome ${GCALCTOOL}
+fpkg_gnome ${GUCHARMAP}
+fpkg_gnome ${ZENITY}
+
+fpkg_gnome ${GNOME_KEYRING_MANAGER}
+fpkg_gnome ${GNOME_VOLUME_MANAGER}
+fpkg       ${LIBMUSICBRAINZ} "http://ftp.musicbrainz.org/pub/musicbrainz"
+fpkg_gnome ${GNOME_SOUND_JUICER}
+fpkg       ${ISO_CODES} "ftp://pkg-isocodes.alioth.debian.org/pub/pkg-isocodes"
+
+fpkg_gnome ${GNOME_TOTEM}
+fpkg_gnome ${GDM}
+fpkg       ${LIBNOTIFY} "http://www.galago-project.org/files/releases/source/libnotify"
+fpkg       ${GNOME_MOUNT} "http://people.freedesktop.org/~david/dist"
+
+fpkg_gnome ${LIBGSF}
+fpkg       ${PCRE} "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre" # Needed by goffice
+fpkg_gnome ${GOFFICE}
+fpkg_gnome ${GNUMERIC}
+fpkg_sf    ${WV}
+fpkg       ${ABIWORD} "http://www.abisource.com/downloads/abiword/$(get_pkg_ver ${ABIWORD})/source"
+
+fpkg_gnome ${EVOLUTION_EXCHANGE}
+fpkg_gnome ${EVOLUTION}
+
+fpkg       ${LIBGPG_ERROR} "http://ftp.gnupg.org/gcrypt/libgpg-error"
+fpkg       ${LIBGCRYPT} "http://ftp.gnupg.org/gcrypt/libgcrypt"
+fpkg       ${GNUTLS} "http://ftp.gnupg.org/gcrypt/gnutls"
+fpkg_sf    ${PIDGIN}
+
+# Return last error
+exit $?
diff --git a/stage4/stage4-additions b/stage4/stage4-additions
new file mode 100755 (executable)
index 0000000..613ddc8
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage4"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage4
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/tmp
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+init_log_file
+
+ipkg ${GNOME_DOC_UTILS} cis-gnome
+
+exit $?
diff --git a/stage4/stage4-install b/stage4/stage4-install
new file mode 100755 (executable)
index 0000000..445c19c
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage4"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage4
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/tmp
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+init_log_file
+
+# GNOME-2.X configuration
+
+action_checkbox "Configuring ${GNOME2_VER}" ./cis-gnome-config
+action_checkbox "Reloading /etc/profile" source /etc/profile
+
+# Gnome 2 core packages
+ipkg_gnome ${ORBIT2}
+ipkg_gnome ${LIBBONOBO}
+ipkg_gnome ${GCONF}
+ipkg       ${GNOME_MIME_DATA} cis-gnome-mime-data
+ipkg_gnome ${GNOME_VFS}
+ipkg_gnome ${LIBGNOME}
+ipkg_gnome ${LIBGNOMECANVAS}
+ipkg_gnome ${LIBBONOBOUI}
+ipkg_ac    ${GNOME_ICON_THEME}
+ipkg_gnome ${GNOME_KEYRING}
+ipkg_gnome ${LIBGNOMEUI}
+ipkg_ac    ${GNOME_THEMES}
+ipkg       ${SCROLLKEEPER} cis-scrollkeeper
+ipkg_gnome ${GNOME_DOC_UTILS}
+ipkg_gnome ${GNOME_DESKTOP}
+ipkg_gnome ${GNOME_BACKGROUNDS}
+ipkg_gnome ${GNOME_MENUS}
+ipkg_gnome ${GNOME_PANEL}
+ipkg_ac    ${GSTREAMER}
+ipkg_ac    ${GST_PLUGINS_BASE}
+ipkg_ac    ${GST_PLUGINS_GOOD}
+ipkg_ac    ${GST_PLUGINS_UGLY}
+ipkg_ac    ${GST_FFMPEG}
+ipkg       ${VTE} cis-vte
+ipkg_gnome ${GNOME_TERMINAL}
+ipkg_gnome ${LIBGTOP}
+ipkg_gnome ${LIBGNOMEKBD}
+ipkg       ${GAIL} cis-gail
+ipkg       ${GNOME_APPLETS} cis-gnome-applets
+ipkg_gnome ${EEL}
+ipkg_gnome ${NAUTILUS}
+ipkg_gnome ${YELP}
+ipkg       ${METACITY} cis-metacity
+
+ipkg_gnome ${GNOME_CONTROL_CENTER}
+ipkg_gnome ${GNOME_SESSION}
+ipkg_gnome ${GNOME_USER_DOCS}
+action_checkbox "Updating the MIME-type application database" update-desktop-database
+
+# Gnome 2 additional packages - Libraries
+ipkg_gnome ${LIBGNOMECUPS}
+ipkg_gnome ${LIBGNOMEPRINT}
+ipkg_gnome ${LIBGNOMEPRINTUI}
+ipkg_gnome ${GTKHTML}
+ipkg       ${EVOLUTION_DATA_SERVER} cis-evolution-data-server
+ipkg_gnome ${GTKSOURCEVIEW}
+ipkg       ${SYSTEM_TOOLS_BACKENDS} cis-gnome-nobuild
+ipkg       ${GNOME_AUDIO} cis-gnome-audio
+
+# Gnome 2 additional packages - Utilities
+ipkg       ${GEDIT} cis-gedit
+ipkg_gnome ${EOG}
+ipkg_gnome ${EVINCE}
+ipkg_gnome ${GGV} # Gnome Ghostview
+ipkg_gnome ${FILE_ROLLER}
+ipkg_gnome ${GCONF_EDITOR}
+ipkg_gnome ${GNOME_UTILS}
+ipkg_gnome ${GNOME_SYSTEM_MONITOR}
+ipkg_gnome ${NAUTILUS_CD_BURNER}
+ipkg_gnome ${GNOME_MEDIA}
+ipkg_gnome ${GNOME_NETSTATUS}
+ipkg       ${GCALCTOOL} cis-gnome-nobuild
+ipkg_gnome ${GUCHARMAP}
+ipkg_gnome ${ZENITY}
+ipkg_gnome ${GNOME_KEYRING_MANAGER}
+
+# Needs hal, which needs D-BUS...
+ipkg_gnome ${GNOME_VOLUME_MANAGER}
+
+ipkg       ${LIBMUSICBRAINZ} cis-libmusicbrainz
+ipkg_gnome ${GNOME_SOUND_JUICER}
+ipkg_ac    ${ISO_CODES}
+ipkg_gnome ${GNOME_TOTEM}
+ipkg       ${GDM} cis-gdm
+ipkg_ac    ${LIBNOTIFY}
+ipkg       ${GNOME_MOUNT} cis-gnome-nobuild
+
+ipkg_ac    ${LIBGSF}
+ipkg       ${PCRE} cis-pcre
+ipkg       ${GOFFICE} cis-ac-nobuild # Depends on libgsf and pcre
+ipkg       ${GNUMERIC} cis-gnumeric # Depends on GOffice
+
+ipkg_ac    ${WV} # Needed by Abiword
+ipkg_ac    ${ABIWORD} "--disable-spellcheck"
+ipkg       ${EVOLUTION}          cis-evolution
+ipkg       ${EVOLUTION_EXCHANGE} cis-evolution-exchange
+
+ipkg_ac    ${LIBGPG_ERROR}
+ipkg_ac    ${LIBGCRYPT}
+ipkg_ac    ${GNUTLS}
+ipkg_ac    ${PIDGIN}
+
+exit $?
diff --git a/stage5/README b/stage5/README
new file mode 100644 (file)
index 0000000..db4bd73
--- /dev/null
@@ -0,0 +1,6 @@
+
+Installation instructions
+-------------------------
+
+1. ./stage5-install-avr
+2. ./stage5-install-arm
diff --git a/stage5/TODO b/stage5/TODO
new file mode 100644 (file)
index 0000000..5e991c8
--- /dev/null
@@ -0,0 +1,3 @@
+
+-Ajouter splint.
+-Ajouter l'installatuion des man pages de avr-libc et du manuel de avr-libc.
diff --git a/stage5/cis-ac b/stage5/cis-ac
new file mode 120000 (symlink)
index 0000000..9214a69
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac
\ No newline at end of file
diff --git a/stage5/cis-ac-nobuild b/stage5/cis-ac-nobuild
new file mode 120000 (symlink)
index 0000000..06c3fe7
--- /dev/null
@@ -0,0 +1 @@
+../stage2/cis-ac-nobuild
\ No newline at end of file
diff --git a/stage5/cis-avr-libc b/stage5/cis-avr-libc
new file mode 100755 (executable)
index 0000000..57284d2
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --host=${TARGET} \
+    --prefix=${PREFIX} &&
+make &&
+make install &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage5/cis-avrdude b/stage5/cis-avrdude
new file mode 100755 (executable)
index 0000000..2035993
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --prefix=/usr \
+    --sysconfdir=/etc &&
+make all &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage5/cis-binutils b/stage5/cis-binutils
new file mode 100755 (executable)
index 0000000..da05271
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --target=${TARGET} \
+    --prefix=${PREFIX} \
+    --with-sysroot=${SYSROOT} &&
+make &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage5/cis-gcc1 b/stage5/cis-gcc1
new file mode 100755 (executable)
index 0000000..de0b1c9
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+# This is necessary so that the compiler is built without
+# libc includes, which are not yet installed for this target.
+#export CFLAGS="${CFLAGS} -Dinhibit_libc"
+
+#Fortunately, there are configuration options for GCC which tell it not
+#to build 'libgcc_s.so'.  The '--without-headers' option is supposed to
+#take care of this, but its implementation is incomplete, so you must
+#also configure with the '--with-newlib' option.  While '--with-newlib'
+#appears to mean "Use the Newlib C library", its effect is to tell the
+#GCC build machinery, "Don't assume there is a C library available."
+
+#We also need to disable some of the libraries that would normally be
+#built along with GCC, and specify that only the compiler for the C
+#language is needed.
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --target=${TARGET} \
+    --prefix=${PREFIX} \
+    --with-sysroot=${SYSROOT} \
+    --without-headers --with-newlib \
+    --disable-shared \
+    --disable-threads \
+    --disable-libssp \
+    --disable-libgomp \
+    --disable-libmudflap \
+    --enable-languages=c &&
+make all-gcc &&
+make install-gcc
+
+exit $?
diff --git a/stage5/cis-gcc2 b/stage5/cis-gcc2
new file mode 100755 (executable)
index 0000000..87330e9
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --target=${TARGET} \
+    --prefix=${PREFIX} \
+    --without-dwarf2 \
+    --without-stabs \
+    --disable-libssp \
+    --enable-languages=c &&
+make all &&
+make install &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage5/cis-gdb b/stage5/cis-gdb
new file mode 100755 (executable)
index 0000000..255dde4
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --target=${TARGET} \
+    --prefix=${PREFIX} &&
+make &&
+make install
+
+# Return last error
+exit $?
diff --git a/stage5/cis-glibc b/stage5/cis-glibc
new file mode 100755 (executable)
index 0000000..13ad8f6
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+cd ${LFS_TMP}/${1} &&
+
+# Configure options:
+# --disable-profile
+#     Builds the libraries without profiling information.
+# --enable-add-ons
+#     Use all the add-ons it finds.
+#     crypt and localdata are now part of glibc.
+# --enable-kernel=2.x.x
+#     Compile the library for support of linux 2.6.x kernels.
+#     The kernel version specified must not be newer than the
+#     version of the kernel running on the build machine.
+# --without-gd
+#     Prevents the build of the memusagestat program, which
+#     strangely enough insists on linking against the host's
+#     libraries (libgd, libpng, libz, and so forth).
+cd ${LFS_TMP}/${1}-build &&
+BUILD_CC=gcc CC=${CROSS_COMPILE}gcc AR=${CROSS_COMPILE}ar RANLIB=${CROSS_COMPILE}ranlib AS=${CROSS_COMPILE}as LD=${CROSS_COMPILE}ld \
+    ../${1}/configure \
+    --prefix=/usr \
+    --host=${TARGET} \
+    --with-headers=${SYSROOT}/usr/include \
+    --enable-add-ons \
+    --enable-kernel=${GLIBC_KERNEL_VERSION} \
+    --disable-profile \
+    --without-gd \
+    --without-cvs \
+    --without-selinux &&
+
+#    --enable-threads=posix \
+#    --enable-static-nss \
+#    --enable-add-ons \
+#    --disable-sanity-checks \
+#    --without-__thread \
+
+make &&
+make install_root=${SYSROOT} install
+  
+# Return last error
+exit $?
diff --git a/stage5/cis-kernel b/stage5/cis-kernel
new file mode 100755 (executable)
index 0000000..00a4941
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# The ARCH variable must be exported for this script
+#   eg. ARCH=powerpc
+
+# We don't compile anything, we only install headers
+##################################################################unset CROSS_COMPILE &&
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Move files to their final destination 
+mkdir -pv ${SYSROOT}/usr/src &&
+cp -a ${LFS_TMP}/${1} ${SYSROOT}/usr/src &&
+
+cd ${SYSROOT}/usr/src &&
+
+# Create the link only if it does not exist. Otherwise, the
+# new link will be created inside kernel directory.
+rm -fv linux &&
+ln -sfv ${1} linux &&
+
+cd ${SYSROOT}/usr/src/${1} &&
+
+# First step, install kernel API headers:
+make mrproper &&
+make headers_check &&
+make INSTALL_HDR_PATH=dest headers_install &&
+mkdir -pv ${SYSROOT}/usr/include &&
+cp -rv dest/include/* ${SYSROOT}/usr/include &&
+
+# Second, install HV kernel compilation script:
+cat > ${SYSROOT}/usr/src/compile-kernel << "EOF" &&
+#!/bin/sh
+
+KERNEL_VERSION=$(basename $(pwd))
+DEST=/boot
+
+export ARCH=_ARCH_
+export CROSS_COMPILE=_CROSS_COMPILE_
+export SYSROOT=_SYSROOT_
+
+KERNELMAKE="make -j 4"
+
+${KERNELMAKE} bzImage &&
+
+if cat .config | grep "CONFIG_MODULES=y" 1> /dev/null 2>&1; then
+    ${KERNELMAKE} modules &&
+    ${KERNELMAKE} INSTALL_MOD_PATH=${SYSROOT} modules_install
+fi &&
+
+cp arch/${ARCH}/boot/images/zImage.elf ${DEST}/vmlinuz-${KERNEL_VERSION} &&
+cp arch/${ARCH}/boot/images/zImage.elf ${DEST}/vmlinuz-latest &&
+cp System.map                          ${DEST}/System-${KERNEL_VERSION}.map &&
+cp .config                             ${DEST}/config-${KERNEL_VERSION}
+
+if [ $? -ne 0 ]; then
+    echo "*** Kernel compilation error ***."
+    exit 1
+fi
+
+exit 0
+EOF
+
+sed -i -e "s!_ARCH_!${ARCH}!g"                   ${SYSROOT}/usr/src/compile-kernel &&
+sed -i -e "s!_CROSS_COMPILE_!${CROSS_COMPILE}!g" ${SYSROOT}/usr/src/compile-kernel &&
+sed -i -e "s!_SYSROOT_!${SYSROOT}!g"             ${SYSROOT}/usr/src/compile-kernel &&
+
+chmod -v u+x ${SYSROOT}/usr/src/compile-kernel
+
+# Return last error
+exit $?
diff --git a/stage5/cis-newlib b/stage5/cis-newlib
new file mode 100755 (executable)
index 0000000..45f3650
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# First argument of this script is the package name
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Applying patches (if any)
+apply_patches ${1} &&
+
+# Saves CFLAGS and CXXFLAGS, and clears them.
+save_flags_no_optimizations
+
+cd ${LFS_TMP}/${1}-build &&
+../${1}/configure \
+    --target=${TARGET} \
+    --prefix=${PREFIX} &&
+make all &&
+make install &&
+
+# Restore original CFLAGS and CXXFLAGS values.
+restore_flags
+
+# Return last error
+exit $?
diff --git a/stage5/packages-update b/stage5/packages-update
new file mode 100755 (executable)
index 0000000..fbad3af
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Must be defined before sourcing other files.
+LFS_STAGE="stage5"
+
+# Reading system configuration informations, functions and package versions.
+source ../functions
+source ../functions-update
+source ../packages-list
+
+update_packages_init
+
+# Begin
+
+lpkg     1 ${AVR_BINUTILS}
+lpkg     1 ${ARM_BINUTILS}
+lpkg     1 ${KERNEL}
+lpkg     1 ${GLIBC}
+lpkg     1 ${AVR_GCC_CORE}
+lpkg     1 ${ARM_GCC_CORE}
+fpkg       ${AVR_LIBC} "http://download.savannah.gnu.org/releases/avr-libc"
+fpkg       ${NEWLIB} "ftp://sources.redhat.com/pub/newlib"
+fpkg_gnu   ${AVR_GDB}
+fpkg       ${AVRDUDE} "http://download.savannah.gnu.org/releases/avrdude"
+fpkg_mis   ${SPLINT} "${SPLINT}.src" "http://splint.org/downloads"
+
+GEDA_BASE_URL=http://geda.seul.org/release/v$(get_pkg_ver_base ${LIBGEDA})/$(get_pkg_ver ${LIBGEDA})
+
+fpkg       ${LIBGEDA}       ${GEDA_BASE_URL}
+fpkg       ${GEDA_SYMBOLS}  ${GEDA_BASE_URL}
+fpkg       ${GEDA_GSCHEM}   ${GEDA_BASE_URL}
+fpkg       ${GEDA_GNETLIST} ${GEDA_BASE_URL}
+fpkg       ${GEDA_SYMCHECK} ${GEDA_BASE_URL}
+fpkg       ${GEDA_GATTRIB}  ${GEDA_BASE_URL}
+
+# Return last error
+exit $?
diff --git a/stage5/stage5-additions b/stage5/stage5-additions
new file mode 100755 (executable)
index 0000000..5c1538b
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage4"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage4
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+# Init log file
+mkdir -p ${LFS_LOG_DIR} || exit 1
+if [ ! -f ${LFS_LOG_FILE} ]; then
+    touch ${LFS_LOG_FILE} || exit 1
+fi
+
+ipkg ${GDB} cis-gdb
+
+exit $?
diff --git a/stage5/stage5-install-arm b/stage5/stage5-install-arm
new file mode 100644 (file)
index 0000000..9dcb7c1
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage5"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage5
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/mnt/hv-packages/tmp
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+init_log_file
+
+export TARGET="arm-elf"
+export PREFIX="/usr/arm-elf"
+
+var_add_path "PATH" /etc/profile "${PREFIX}/bin" &&
+source /etc/profile &&
+
+ipkg      ${ARM_BINUTILS} cis-binutils
+ipkg_mult ${ARM_GCC_CORE} cis-gcc1 "${GCC_CORE}-pass1" 
+ipkg      ${NEWLIB}       cis-newlib
+ipkg_mult ${ARM_GCC_CORE} cis-gcc2 "${GCC_CORE}-pass2" 
+ipkg      ${GDB}          cis-gdb
+
+exit $?
diff --git a/stage5/stage5-install-avr b/stage5/stage5-install-avr
new file mode 100755 (executable)
index 0000000..8cb4c7f
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage5"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage5
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="/tmp"
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+init_log_file
+
+export TARGET="avr"
+export PREFIX="/usr/avr"
+
+var_add_path "PATH" /etc/profile "${PREFIX}/bin" &&
+source /etc/profile &&
+
+ipkg      ${AVR_BINUTILS} cis-binutils
+ipkg_mult ${AVR_GCC_CORE} cis-gcc2 "${GCC_CORE}-pass2"
+ipkg      ${AVR_LIBC}     cis-avr-libc
+ipkg      ${AVRDUDE}      cis-avrdude
+ipkg      ${SPLINT}       cis-ac-nobuild
+ipkg      ${AVR_GDB}      cis-gdb
+
+exit $?
diff --git a/stage5/stage5-install-geda b/stage5/stage5-install-geda
new file mode 100755 (executable)
index 0000000..6ee68d5
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage5"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage5
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP="$(dirname $(dirname $(pwd)))/packages/tmp"
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+init_log_file
+
+if [ "x${INST_TYPE}" = "xworkstation" -o "x${INST_TYPE}" = "xltsp-server" ]; then
+    ipkg_ac  ${LIBGEDA}
+    ipkg_ac  ${GEDA_SYMBOLS}
+    ipkg_ac  ${GEDA_GSCHEM}
+    ipkg_ac  ${GEDA_GNETLIST}
+    ipkg_ac  ${GEDA_SYMCHECK}
+    ipkg_ac  ${GEDA_GATTRIB}
+fi
+
+exit $?
diff --git a/stage5/stage5-install-ppc b/stage5/stage5-install-ppc
new file mode 100755 (executable)
index 0000000..8d80feb
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+export LFS_PKG_DIR="$(dirname $(dirname $(pwd)))/packages/stage5"
+export LFS_LOG_DIR=/var/log/hvlinux-install/stage5
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/tmp
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
+
+init_log_file
+
+export CFLAGS="-pipe -O2"
+export CXXFLAGS=${CFLAGS}
+
+export ARCH="powerpc"
+export TARGET="powerpc-405-linux-gnu"
+export PREFIX="/usr/powerpc-405"
+export SYSROOT=${PREFIX}/sysroot
+export CROSS_COMPILE=${TARGET}-
+
+var_add_path "PATH" /etc/profile "${PREFIX}/bin" &&
+source /etc/profile &&
+
+ipkg      ${BINUTILS} cis-binutils
+ipkg_mult ${GCC_CORE} cis-gcc1 "${GCC_CORE}-pass1"
+ipkg      ${KERNEL}   cis-kernel
+ipkg      ${GLIBC}    cis-glibc
+
+exit 1
+exit 1
+
+ipkg_mult ${GCC_CORE} cis-gcc2 "${GCC_CORE}-pass2" 
+ipkg      ${GDB}      cis-gdb
+
+exit $?
diff --git a/sysinfos.server b/sysinfos.server
new file mode 100644 (file)
index 0000000..569fa9d
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# This file contains the informations specific to the target system
+# onto which Linux-HV will be installed
+
+# This is the number of make jobs that can be executed
+# simultaneously. Normally, a value of 2 per processor
+# gives good results.
+MAKEJOBS=4
+
+# Installation type: server, ltsp-server or workstation.
+INST_TYPE="server"
+
+# New user to create
+REGUSER=""
+
+# Destination path where to install new Linux-HV system
+LFS="/mnt/hvlinux"
+
+# Destination partition where to install new Linux-HV system
+LFS_PARTITION="/dev/hda10"
+
+# Boot partition (if applicable)
+BOOT_PARTITION="/dev/hda1"
+
+# Swap partition (if applicable)
+SWAP_PARTITION="/dev/hda5"
+
+# Used for setting '-march=xxx' option in CFLAGS and CPPFLAGS
+MACHINE_ARCHITECTURE="pentium"
+
+DEFAULT_EDITOR="emacs"
+
+# Keyboard mapping (example: us)
+KEYBOARD="us"
+
+# Sound card support: yes or no
+SOUND_CARD="no"
+
+# Removable media drives
+CDROM="/dev/hdc"
+DVD="/dev/hdc"
+
+# Define this if you want to use a remote CUPS print server
+#CUPS_SERVER="server.hugovil.com"
+
+TIMEZONE="America/Montreal"
+
+# General network settings
+INTERFACES="eth0 eth1"
+# GATEWAY is not required if using DHCP 
+GATEWAY=""
+MACHINE_NAME="server"
+DOMAIN="hugovil.com"
+LAN_NETWORK_MASK="192.168.0.0/24"
+# Define to yes if you have a dynamic address and you use a dynamic dns
+# service.
+USE_DYNAMIC_DNS="yes"
+
+# Network interface card #1 settings (INTERNET)
+BOOTPROTO[0]="dhcp"
+IP_ADDRESS[0]=""
+
+# Network interface card #2 settings (LAN)
+BOOTPROTO[1]="static"
+IP_ADDRESS[1]="192.168.0.1"
+PREFIX_LENGTH[1]=24
+
+# DNS servers addresses (not required if using DHCP)
+#NAMESERVER[0]="24.200.243.250"
+#NAMESERVER[1]="24.201.245.106"
+#NAMESERVER[2]="24.200.243.242"
+
+# Define this if you want the mail addressed to the root user automatically
+# be forwarded to someone else
+MAIL_ADMIN="hugo"
+
+# Define to unix (mbox) or mbx
+MAILBOX_FORMAT=unix
+
+# Alternate port for Sendmail (comment this line to use the standard port 25)
+SENDMAIL_PORT="25"
+
+# Alternate port for Apache (comment this line to use the standard port 80)
+HTTPD_PORT="80"
+APACHE_USER="www"
+
+# Samba support
+USE_SAMBA="no"
diff --git a/sysinfos.workstn b/sysinfos.workstn
new file mode 100644 (file)
index 0000000..89e00c0
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# This file contains the informations specific to the target system
+# onto which Linux-HV will be installed
+
+# This is the number of make jobs that can be executed
+# simultaneously. Normally, a value of 2 per processor
+# gives good results.
+MAKEJOBS=4
+
+# Installation type: server, ltsp-server or workstation.
+INST_TYPE="workstation"
+
+# New user to create
+REGUSER=""
+
+# Destination path where to install new Linux-HV system
+LFS="/mnt/hvlinux"
+
+# Destination partition where to install new Linux-HV system
+LFS_PARTITION="/dev/hda10"
+
+# Boot partition (if applicable)
+BOOT_PARTITION="/dev/hda1"
+
+# Swap partition (if applicable)
+SWAP_PARTITION="/dev/hda5"
+
+# Used for setting '-march=xxx' option in CFLAGS and CPPFLAGS
+MACHINE_ARCHITECTURE="pentium"
+
+DEFAULT_EDITOR="emacs"
+
+# Keyboard mapping (example: us)
+KEYBOARD="us"
+
+HV_XF86_KEYBOARD_LAYOUT="ca_enhanced"
+XF86_CARD_DRIVER="ati"
+
+# Sound card support: yes or no
+SOUND_CARD="yes"
+
+# Removable media drives
+CDROM="/dev/hdc"
+DVD="/dev/hdc"
+
+#--------------------
+# SCANNER definitions
+#--------------------
+# Set to yes to have SANE support
+SANE_SUPPORT="no"
+# Define to the driver name corresponding to your scanner, if you have one
+# (see SANE documentation for drivers name).  Comment out if you will be using
+# a scanner on a remote computer.
+SANE_DRIVER=""
+# If your scanner is located onto a remote computer, define the following
+# variable to the IP address of that remote computer.
+SANE_SERVER=""
+
+# Define this if you want to use a remote CUPS print server
+CUPS_SERVER="server.hugovil.com"
+
+# Samba support
+USE_SAMBA="no"
+
+TIMEZONE="America/Montreal"
+
+# General network settings
+INTERFACES="eth0"
+# GATEWAY is not required if using DHCP 
+GATEWAY=""
+MACHINE_NAME="workstation"
+DOMAIN="hugovil.com"
+LAN_NETWORK_MASK="192.168.0.0/24"
+# Define to yes if you have a dynamic address and you use a dynamic dns
+# service.
+#USE_DYNAMIC_DNS="yes"
+
+# Network interface card #1 settings (LAN)
+BOOTPROTO[0]="static"
+IP_ADDRESS[0]="192.168.0.2"
+PREFIX_LENGTH[0]="24"
+
+# DNS server addresses (not required if using DHCP)
+NAMESERVER[0]="192.168.0.1"