\documentclass[a4paper]{article}
\author{Random Crew}
\usepackage[utf8]{inputenc}
\usepackage{latex2man}
\usepackage{devdoc}

\setVersion{0.2}
\begin{document}

\begin{Name}{7}{LFS with any}{Random Crew}{LFS with any description}{LFS with any overview}


\section{Preface}

Below complete instruction set is listed. It is perfectly enough to execute all comands and get working LFS system.
You may consult original LFS description for comparance of build procedure, but it is not needed for completing the task.

The release of \Prog{any} itself, available at \URL{https://opendistro.org/any/}, is universal tool,
suitable for many projects and environments. Each project takes it as a basement and adds customisation, additional build code,
rules, politics and so on, suitable for that project.

The release of \Prog{any-lfs} is the example of such project. It has all needed tunings and additions to start the work.
It contains \File{ports/} with needed scripts for packages as well.

\section{Tutorial}

To learn all essentials of LFS with \Prog{any} build system, read the following chapter: \href{../tutorial.html}{Tutorial for LFS with any}.
It describes general scheme of package building with simple examples.
It also contains information with majority of code constructions, used for LFS.

More detailed description of build system architecture and usage you may find at \href{https://opendistro.org/any/}{https://opendistro.org/any/}.

\section{Preparation}

\subsection{Working directory}

Download any-lfs build environment and cd there:

\begin{itemize}
    \item[] \URL{https://opendistro.org/lfs/rel/any-lfs-current.tgz}{any-lfs-current}
\end{itemize}
\begin{verbatim}
tar xf any-lfs-*.tgz
cd any-lfs-*
\end{verbatim}

Download the settings for chosen version of LFS: 
\begin{itemize}
    \item[] \URL{https://opendistro.org/lfs/files/%<LFS_VERSION>/rdd.def}
\end{itemize}
File \File{rdd.def} should be in the root of working directory, along with \File{rdd.conf.d/} directory.

\subsection{Main sources}

Download LFS package sources:

\begin{itemize}
    \item[] \URL{https://opendistro.org/lfs/rel/lfs-packs-%<LFS_VERSION>.tar}{lfs-packs-%<LFS_VERSION>.tar}
\end{itemize}

Download sources of a couple of additional packages, needed for important features of build system:

\begin{itemize}
    \item[] \URL{https://opendistro.org/lfs/rel/lfs-packs-add.tar}{lfs-packs-add.tar}
\end{itemize}

Extract them inside the working directory:
\begin{verbatim}
tar xf lfs-packs-%<LFS_VERSION>.tar
tar xf lfs-packs-add.tar
\end{verbatim}

\subsection{Host setup}

You will need to set up the permissions for \texttt{sudo chroot} command, which is used during the build process
to enter isolated environment. It can be done like this (executed as \texttt{root} superuser):
\begin{verbatim}
USER=user
CHROOT=`which chroot`
BUILDDIR='/home/user/build/*'
echo "${USER} ALL=(ALL) NOPASSWD:${CHROOT} ${BUILDDIR}" >> /etc/sudoers
\end{verbatim}
\begin{itemize}
    \item[-]
        First string contains name of general user, which would do the build.
        Change name \Arg{user} to match your actual user.
    \item[-] 
        Second string automatically defines the full path to \Prog{chroot} command.
    \item[-] 
        Third string defines directory, where chroots are allowed. Change it accordingly to your home directory,
        where your user is allowed to write files.
        The asterisk at the end of the string means, that chroots are allowed in nested subdirectories.
    \item[-] 
        The final string writes down the setting to rules file of \Prog{sudo} utility.
\end{itemize}
