Skip to content
Fulgurance edited this page Jan 7, 2023 · 36 revisions

Welcome to the ISM wiki!

Introduction

This is the very first guide of usage for ISM.

This documentation focus on the Alpha-0.18.96 version and help actually the tester to setup a good environment to test the software. Please, contribute to ISM by test it in a virtual machine and report the bug you can found.

If you have as well any suggestions about the project, to improve it, feel free !

Setup

Actually all test was performed under virtual machine with VirtualBox. It's up to you about the hypervisor you use, but I'm not aware about the bugs you can have.

First install a random Linux distribution in a freshly new virtual machine. I recommand you Calculate Linux actually, because this distribution can build properly Crystal (the language used to code ISM), and follow properly the requirement for the Linux From Scratch Book. Just make sure to allocate enough memory, because ISM will install as well a new Linux system. Make sure as well the user you will use can have sudo access.

After, reboot your virtual machine and we can start to install required packages and set a proper environment before we use ISM.

System setup

We will start to check if the installed linux system have the requirements. Run in a terminal:

cat > version-check.sh << "EOF"
#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -> $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH

echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1

if [ -h /usr/bin/yacc ]; then
  echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
elif [ -x /usr/bin/yacc ]; then
  echo yacc is `/usr/bin/yacc --version | head -n1`
else
  echo "yacc not found" 
fi

bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1

if [ -h /usr/bin/awk ]; then
  echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
elif [ -x /usr/bin/awk ]; then
  echo awk is `/usr/bin/awk --version | head -n1`
else 
  echo "awk not found" 
fi

gcc --version | head -n1
g++ --version | head -n1
ldd --version | head -n1 | cut -d" " -f2-  # glibc version
grep --version | head -n1
gzip --version | head -n1
cat /proc/version
m4 --version | head -n1
make --version | head -n1
patch --version | head -n1
echo Perl `perl -V:version`
python3 --version
sed --version | head -n1
tar --version | head -n1
makeinfo --version | head -n1  # texinfo version
xz --version | head -n1

echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
if [ -x dummy ]
  then echo "g++ compilation OK";
  else echo "g++ compilation failed"; fi
rm -f dummy.c dummy
EOF

bash version-check.sh

Check the result of the executed script and installed the missing programs.

At the end of your ~/.bash_profile, add the following line:

exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash

The same for the ~/.bashrc file:

set +h
umask 022
LC_ALL=POSIX
PATH=/usr/bin
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
PATH=/mnt/ism/tools/bin:$PATH
export LC_ALL PATH

And to finish, as root, run this command:

[ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE

Then, everytime you log in a terminal to use ISM, make sure to load the new ~/.bash_profile:

source ~/.bash_profile

Generate the default directory where we will install the new system:

sudo mkdir -pv /mnt/ism

And make sure actually the path /mnt/ism is owned by you current user, not root:

sudo chown -R username:username /mnt/ism

(Optional): You can change the path where you would like to install the new generated Linux system, it's not a problem. But if you do that , just make sure to change the path as well in the ~./bashrc you generated before, for the PATH variable, and as well in the future instructions when we will set the root path . To finish, make sure in the running system crystal and git are installed.

ISM setup

First clone the ISM repository:

git clone https://github.com/fulgurance/ism

Move to the cloned repository path:

cd ism

And build it:

crystal build Main.cr -o ism

Now you will be able to use ISM like that:

./ism

To be more comfortable, you can set an alias to just type ism in the terminal:

alias ism=./ism

ISM configuration

Now we will start to configure ISM to setup the root path, a proper make option to reduce the compilation time, open the ports we need to install the system base , synchronize them.

So first , set the root path where we will install the new system:

ism settings -srp /mnt/ism

Set an appropriate job number, adapted to your virtual machine capacity:

ism settings -smo -j5

Now open the 2 required port we need for ISM:

ism port open https://github.com/fulgurance/SystemBase-CrossToolchain
ism port open https://github.com/fulgurance/SystemBase-TemporaryTools

Now we can synchronize ism with the remotely ports:

ism software synchronize

ISM is now ready to use !

Install the system base

In this section, we will start now to install the cross toolchain and some temporary tools needed for the next steps. Make sure to copy past properly the commands, because at the beginning, all commands will be execute with normal user, but after, it will be required to run it with sudo.

Install the cross toolchain and temporary tools

Now, as a normal user, we can install the main base of the new Linux system:

ism software install systembase-pass2

ISM will calculate all the dependencies we need , and just enter y for yes and then press enter to start the installation of the main base.

Prepare the new system for the next installation step

Before we will install the last needed temporary tools, we need first to change the ownership of the new system to the user root, and as well mount some require file systems.

So first, we change the ownership. As root, run:

chown -R root:root /mnt/ism/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
  x86_64) chown -R root:root /mnt/ism/lib64 ;;
esac

Then, mount the require file systems. As root again, run:

mknod -m 600 /mnt/ism/dev/console c 5 1
mknod -m 666 /mnt/ism/dev/null c 1 3
mount -v --bind /dev /mnt/ism/dev
mount -v --bind /dev/pts /mnt/ism/dev/pts
mount -vt proc proc /mnt/ism/proc
mount -vt sysfs sysfs /mnt/ism/sys
mount -vt tmpfs tmpfs /mnt/ism/run

Install the last temporary tools

Now we can start to install the last temporary tools. Make sure to run now the following command with sudo:

sudo ism software install util-linux-pass1

Conclusion

Now actually, you finished to install all availables working softwares.

Before you read the next lines (and possibly break the generated system), you can try the new generated system to see if it work properly. With sudo, you can perform a chroot:

sudo chroot "/mnt/ism" /usr/bin/env -i   \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='(ISM Chroot) \u:\w\$ ' \
    PATH=/usr/bin:/usr/sbin     \
    /bin/bash --login +h

Actually the system may have missing important files, like /etc/passwd, /etc/group. It's because systembase-pass3 implementation isn't finished yet. If you wish, you can try to install this last missing package from the SystemBase-TemporaryTools port. But you need to be aware now the next steps are just experimental, and all of the next packages haven't been tested yet.

sudo ism software install systembase-pass3

If you are very curious and would like to help to the development, you can try the recently added port SystemBase-Basic:

sudo ism port open https://github.com/fulgurance/SystemBase-Basic

This port purpose is to contain the basic software for a minimal linux system. Actually some softwares are just not ready for installations and have as well missing dependencies.

If you are looking for a specific software in the database, you can do it like that:

ism software -se <softwarename>

Enjoy !

Clone this wiki locally