https://github.com/Obarun/obarun-mkiso

This package was splitted from obarun-install scripts.

File path location/explanation :
- /etc/obarun/mkiso.conf : file configuration where you can find all the necessary variable to build an iso. This file is automaticaly updated when you change something on running time.
- /usr/bin/obarun-mkiso : main script
- /usr/lib/obarun/{build_iso, make_iso, mkiso_functions} : scripts called by obarun-mkiso main script.
- /var/lib/obarun/obarun-mkiso : This directory contains all the necessary to build properly an iso.

Assumptions
- You have a valid system installed on a directory e.g /mnt
- Squashfs-tools, libisoburn, gzip is intalled on your system. If it's not the case, the scripts install it for you.

How to

Nothing special here, just launch :
$ sudo obarun-mkiso
This script ask you if you want to update it. A good practice is to answer yes but this behaviour can be disactived on the file mkiso.conf by setting the variable to update=no.
Change as you wish the divers variables by picking the number corresponding e.g press 2 to change the name of the iso.
When you are ready pick the number 11 to start the build
That's it :)

Note : if you launch obarun-mkiso multiple time, you need to clean the directory /var/lib/obarun/obarun-mkiso/work first before making an another iso. This is can be achieve by choosing the number 13 before starting the build by the number 11.
4 years later
The following procedure is used to make the official Obarun ISO.

Create or select a directory to work on:
% mkdir $HOME/tmp
% cd $HOME/tmp
Now save and make executable this simple script:
# !/usr/bin/bash

if [[ -z "${1}" ]];then
	echo "give a name for the image to create"
	exit 1
fi

create() {
	local name="${1}"
	
	# create an empty file of 5G
	oblog "Create disk image: ${name}"
	truncate -s 5G "${name}"
	
	# format that image
	oblog "Format: ${name}"
	mkfs.ext4 -m 1 -v "${name}"
	
	# umount the previous mountpoint in case 
	# of successively use of the script
	oblog "Umount mounted directory"
	umount -R mounted/
	
	# mount it
	oblog "Mount ${name}.img to mounted/"
	mount "${name}" mounted/
	
	# same as previous, in case of successive use
	# we erase the things done previously
	oblog "Delete mounted/{boot,home}"
	rm -rf mounted/boot
	rm -rf mounted/home
	oblog "Create directories mounted/{boot,home}"
	
	# finally create the boot, home directory
	mkdir mounted/{boot,home}

}

if (( EUID ));then
    oblog -f "you need to be root"
    exit 111
fi

create "${1}"

See the comment inside the code to understand it. Now use it like this:
% sudo ./create minimal
I took "create" as the name of the script, it's up to you to name it as you want. So, i asked it to create an image named minimal because in my example i want to create an ISO from a minimal installation. Obviously you can name it as you want :).

Now launch obarun-install and pick $HOME/tmp/mounted as mountpoint for the main menu at the step number 1(Path to the mounted disk for installation).

So, now you have a fresh installation made by obarun-install at $HOME/tmp/mounted directory. Before using obarun-mkiso you need to umount it(some trouble exist on the script about an already mounted directory)
so,
% sudo umount -R mounted/
Finally launch obarun-mkiso and pick $HOME/tmp/mounted at step number 1 of the main menu. It should provide you a bootable ISO from your fresh installation.

Depending of the installation, some step to build the ISO can take time. So be patient.

Enjoy
I would think obarun-mkiso is meant for an installation you have already configured and is a working system, not to make an iso out of a new installation.

The script demands that what is placed on 1 is a mounted file system, if you unmount all that is there is any mountpoint.
obarun-mkiso: out_action: tracing: Enter your root directory :
/mnt
obarun-mkiso: out_notvalid: warning: This is not a valide mountpoint, please retry :
valide should be valid

When in one I use a mounted installation, a real bootable system, I get:
  -> Disabling key 6DD4217456569BA711566AC7F06E8FDE7B45DAAC...
==> Updating trust database...
gpg: next trustdb check due at 2021-01-01
mount: /var/lib/obarun/obarun-mkiso/work/airootfs/run: mount point does not exist.
mount: /var/lib/obarun/obarun-mkiso/work/airootfs/tmp: mount point does not exist.
build.sh: out_action: tracing: Install needed extra-packages
2020-10-14 15:05:30.88 build.sh: fatal:  Failed to install extra-packages
build.sh: out_action: tracing: Cleaning up
build.sh: out_valid: success: Umount /var/lib/obarun/obarun-mkiso/work/airootfs
build.sh: out_valid: success: Restore your shell options
Ok, cleaned up and run it again, "iso builded successfully" (built not builded) ... but there is no iso to be found in the output directory, no errors.
  -> Running build hook: [memdisk]
==> ERROR: file not found: `memdiskfind'
==> ERROR: Hook 'archiso_shutdown' cannot be found
==> ERROR: Hook 'archiso' cannot be found
==> ERROR: Hook 'archiso_loop_mnt' cannot be found
==> ERROR: Hook 'archiso_kms' cannot be found
This is reported in the procedure even though it finishes successfully
Sorry, my bad. forgot to specify you to remount the image right after the umount before running obarun-mkiso
%  sudo umount -R mounted
% sudo mount minimal mounted
where minimal is the name of the image created before.

So, it should not get successfully exit if any procedure go wrong. i need to check what's happen...

Also, did you installed obarun-mkiso by pacman? Take care about the dependencies of the package..
This is confusing a bit, and the mount/umount help is not clearing it up.
Say /dev/sdb3 is mounted on /mnt/source
Os this "minimal" like a label for the mounted volume?
And on line 1 I specify /mnt/source
This is the installation I want to make an iso from
When the ob..mkiso runs it creates a copy of the contents and adds a few pkgs necessary to boot live and does this in /var/lib/,,,mkiso/work/airootfs
then it makes an img or sfs out of the whole and adds the boot specific to booting the image.
At the last step it transforms a copy of all this into a ro iso filesystem file so it can be burned to dvd/cd/usb
This last step is not working.
The sw is the last version and is updated from framagit to:
0.1.0+4+g5505a2a-1
All dependencies are satisfied
First thing first and to be clear, obarun-mkiso is not intended to make an ISO from your current system.

So now let's say you have a second disk with an installed system (let's call it sdb3)
% sudo mount /dev/sdb3 /mnt
% sudo obarun-mkiso # choose /mnt at step 1
that's it.
Apparently this is what you did, so please try to provide any weird/error log messages that you find. Without it i can know what happens exactly. Also please provide your /etc/obarun/mkiso.conf
I have verbosity one, the script runs now and ends saying image built, but no iso is to be found. I thought maybe it run out of space and there was no error code for that, but there is plenty of space and chose the output to be saved in different places with plenty of space ... no difference. It is a small installation, 1.2GB so I learn how it works better.
new try clean work same output no iso created:
==> Starting build: 5.9.0-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [memdisk]
==> ERROR: file not found: `memdiskfind'
==> ERROR: Hook 'archiso_shutdown' cannot be found
==> ERROR: Hook 'archiso' cannot be found
==> ERROR: Hook 'archiso_loop_mnt' cannot be found
==> ERROR: Hook 'archiso_kms' cannot be found
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: advansys
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: csiostor
==> WARNING: Possibly missing firmware for module: cxgb3
==> WARNING: Possibly missing firmware for module: cxgb4
==> WARNING: Possibly missing firmware for module: isci
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: Possibly missing firmware for module: ums_eneub6250
==> WARNING: Possibly missing firmware for module: smsmdtv
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
==> Generating module dependencies
==> Creating xz-compressed initcpio image: /boot/archiso.img
==> WARNING: errors were encountered during the build. The image may not be complete.
build.sh: out_action: tracing: Prepare initial ramdisk boot
build.sh: out_action: tracing: Prepare extra-packages for boot
build.sh: out_action: tracing: Set syslinux
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/*.c32': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/lpxelinux.0': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/memdisk': No such file or directory
gzip: /var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules/*-ARCH/modules.alias: No such file or directory
build.sh: out_action: tracing: Set isolinux
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/isolinux.bin': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/isohdpfx.bin': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/ldlinux.c32': No such file or directory
build.sh: out_action: tracing: Prepare efiboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    14  100    14    0     0     22      0 --:--:-- --:--:-- --:--:--    22
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    14  100    14    0     0     22      0 --:--:-- --:--:-- --:--:--    22
build.sh: out_action: tracing: Set efiboot
mkfs.fat 4.1 (2017-01-24)
build.sh: out_action: tracing: Creating a list of installed packages on live-enviroment...
make.sh: out_valid: success: Done!
build.sh: out_action: tracing: Prepare and compress airootfs
make.sh: out_action: tracing: Cleaning up what we can on airootfs...
make.sh: out_valid: success: Done!
make.sh: out_action: tracing: Creating SquashFS image, this may take some time...
make.sh: out_valid: success: Done!
make.sh: out_action: tracing: Creating checksum file for self-test...
make.sh: out_valid: success: Done!
build.sh: out_action: tracing: Build the iso
2020-10-16 14:23:13.70 make.sh: fatal: The file '/var/lib/obarun/obarun-mkiso/work/iso/isolinux/isolinux.bin' does not exist.
make.sh: out_action: tracing: Cleaning up
make.sh: out_valid: success: Restore your shell options
build.sh: out_valid: success: Iso builded successfully

i found obarun's mkiso confusing compared to the likes of artix or void. ill revisit doing these again if i am able to rebuild my custom obarun stuff (lost all data due to failed hdd a few weeks back)
All dependencies are satisfied < are you sure?
==> ERROR: file not found: `memdiskfind'
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/lpxelinux.0': No such file or directory
These errors is clear, you don't have syslinux installed.
==> ERROR: Hook 'archiso_shutdown' cannot be found
So, Arch linux dev changed the archiso package and this hook is no longer available :/. I need to change to code to reflect this change, but i'm currently sick and i don't have the courage to do it right now.

to remember you the PKGBUILD of obarun-mkiso declare as dependencies
'git' 'pacman' 'obarun-libs' 'squashfs-tools' 'libisoburn' 'gzip' 'archiso' 'syslinux'
So downgrade archiso package 44-2 version and install syslinux, it should be ok
Get well soon, I told you work for others is bad for you ;)

I do have syslinux installed, it is a dependency for something else, mkisolinux I think.
And this is my archive of archisos
obcore/syslinux                  6.04.pre2.r11.gbf6db5b4-4  6.04.pre2.r11.gbf6db5b4-4    0.00 MiB   

-rwxr-xr-x 1 root root 70K Oct 16  2019 /var/cache/pacman/pkg/archiso-43-1-any.pkg.tar.xz*
-rw-r--r-- 1 root root 72K May 15 15:19 /var/cache/pacman/pkg/archiso-43-2-any.pkg.tar.zst
-rw-r--r-- 1 root root 72K Jun  1 00:39 /var/cache/pacman/pkg/archiso-44-2-any.pkg.tar.zst
-rw-r--r-- 1 root root 74K Jun 30 23:52 /var/cache/pacman/pkg/archiso-45-1-any.pkg.tar.zst
-rw-r--r-- 1 root root 74K Jul 30 22:17 /var/cache/pacman/pkg/archiso-46-1-any.pkg.tar.zst
-rw-r--r-- 1 root root 75K Aug 25 23:21 /var/cache/pacman/pkg/archiso-47.1-1-any.pkg.tar.zst
-rw-r--r-- 1 root root 75K Sep 29 19:30 /var/cache/pacman/pkg/archiso-48-1-any.pkg.tar.zst
-rw-r--r-- 1 root root 75K Oct  4 00:01 /var/cache/pacman/pkg/archiso-48.1-1-any.pkg.tar.zst            
44 also has lynx as dependency, which I had dropped in favor of elinks, but I don't think it makes a difference.
Syslinux has been here for a long while, even though I don't use it in favor of grub.

1st try "success, no errors but no iso"
2nd try "some error about installing a pkg" missed it because I restarted the program, used clean and restarted, 2nd try no built image though.

Again it seems some archiso component/hook is missing:
(2/2) Updating system user/group accounts...
obsysusers: info: create system group: nbd
obsysusers: info: create system user: nbd - comment="Network Block Device" ,uid=996,gid=nbd,home=/var/empty,shell=/sbin/nologin
obsysusers: info: disable login for user: nbd
obsysusers: info: add user: bin to group: daemon
obsysusers: info: add user: bin to group: sys
obsysusers: info: add user: daemon to group: adm
obsysusers: info: add user: daemon to group: bin
obsysusers: info: add user: daemon to group: lp
build.sh: out_action: tracing: Set hook for initcpio
build.sh: out_action: tracing: Create an initial ramdisk environment
==> Starting build: 5.9.0-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [memdisk]
==> ERROR: file not found: `memdiskfind'
  -> Running build hook: [archiso_shutdown]
  -> Running build hook: [archiso]
  -> Running build hook: [archiso_loop_mnt]
  -> Running build hook: [archiso_kms]
==> WARNING: Possibly missing firmware for module: radeon
==> WARNING: Possibly missing firmware for module: nouveau
==> WARNING: Possibly missing firmware for module: i915
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: advansys
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: qla2xxx
==> WARNING: Possibly missing firmware for module: csiostor
==> WARNING: Possibly missing firmware for module: cxgb3
==> WARNING: Possibly missing firmware for module: cxgb4
==> WARNING: Possibly missing firmware for module: isci
==> WARNING: Possibly missing firmware for module: qla1280
==> WARNING: Possibly missing firmware for module: bfa
==> WARNING: Possibly missing firmware for module: qed
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
==> WARNING: Possibly missing firmware for module: ums_eneub6250
==> WARNING: Possibly missing firmware for module: smsmdtv
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
==> Generating module dependencies
==> Creating xz-compressed initcpio image: /boot/archiso.img
==> WARNING: errors were encountered during the build. The image may not be complete.
build.sh: out_action: tracing: Prepare initial ramdisk boot
build.sh: out_action: tracing: Prepare extra-packages for boot
build.sh: out_action: tracing: Set syslinux
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/*.c32': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/lpxelinux.0': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/memdisk': No such file or directory
gzip: /var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules/*-ARCH/modules.alias: No such file or directory
build.sh: out_action: tracing: Set isolinux
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/isolinux.bin': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/isohdpfx.bin': No such file or directory
cp: cannot stat '/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/syslinux/bios/ldlinux.c32': No such file or directory
build.sh: out_action: tracing: Prepare efiboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    14  100    14    0     0     19      0 --:--:-- --:--:-- --:--:--    19
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    14  100    14    0     0     18      0 --:--:-- --:--:-- --:--:--    18
build.sh: out_action: tracing: Set efiboot
mkfs.fat 4.1 (2017-01-24)
build.sh: out_action: tracing: Creating a list of installed packages on live-enviroment...
make.sh: out_valid: success: Done!
build.sh: out_action: tracing: Prepare and compress airootfs
make.sh: out_action: tracing: Cleaning up what we can on airootfs...
make.sh: out_valid: success: Done!
make.sh: out_action: tracing: Creating SquashFS image, this may take some time...
make.sh: out_valid: success: Done!
make.sh: out_action: tracing: Creating checksum file for self-test...
make.sh: out_valid: success: Done!
build.sh: out_action: tracing: Build the iso
2020-10-17 20:05:19.34 make.sh: fatal: The file '/var/lib/obarun/obarun-mkiso/work/iso/isolinux/isolinux.bin' does not exist.
make.sh: out_action: tracing: Cleaning up
make.sh: out_valid: success: Restore your shell options
build.sh: out_valid: success: Iso builded successfully

% pkg -Qs archiso   
local/archiso 44-2
    Tools for creating Arch Linux live and install iso images
No hurry, I am trying to see how this works, I remember giving up on it long ago.
Also, if you change pacman.conf to match the one on the target (-testing in my case) why does updating the script keep changing the pacman,conf? That is annoying too.

Can this be a source of problems? The previous runs were with my pacman.conf, the latest ones I noticed it run the default again.

I hope you didn't catch that cia-flu! I think it was sent to china but they are good at ping-pong and sent it right back to them :)

EDIT: chrooted to target and installed syslinux there too, it wasn't there, upgraded and unmounted everything, exited, cleaned and rerun:
2020-10-17 21:03:56.77 build.sh: fatal:  Failed to install extra-packages
build.sh: out_action: tracing: Cleaning up
build.sh: out_valid: success: Umount /var/lib/obarun/obarun-mkiso/work/airootfs
build.sh: out_valid: success: Restore your shell options
first thing first:
% sudo pacman -Sy obarun-mkiso
Take care about the installed /etc/obarun/mkiso.conf.pacnew file!!!

But...
This new package will not fix your "broken system". As far as know 1 + 1 = 2 but on your system 1 + 1 = fish :D.
If you have syslinux installed you should not get
 ==> ERROR: file not found: `memdiskfind'
because
% pacman -Ql syslinux | grep memdiskfind
syslinux /usr/bin/memdiskfind
syslinux /usr/share/man/man1/memdiskfind.1.gz
all syslinux related error come from the fact that your system is unable to find the file from the syslinux package. Why? i don't know.

Also, the new package resolve the hook error behavior. The dependency of the package had changed: archiso was replaced by mkinitcpio-archiso which install the necessaries hook file.
Now, all errors stop the script
2020-10-17 21:03:56.77 build.sh: fatal:  Failed to install extra-packages
this command try to execute pacman -r <what it need to do>. So, again something wrong on your system or you don't have pacman installed on it :D
% pacman -Ql syslinux | grep memdiskfind
syslinux /usr/bin/memdiskfind
syslinux /usr/share/man/man1/memdiskfind.1.gz
% whereis memdiskfind
memdiskfind: /usr/bin/memdiskfind
twice cleaned and rerun:
obarun-mkiso: info: Set syslinux
gzip: /var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules/*-ARCH/modules.alias: No such file or directory
obarun-mkiso: fatal: unable to run make_syslinux
obarun-mkiso: info: Cleaning up
obarun-mkiso: info: Restore your shell options
 % lsd /var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules/            
total 44K
drwxr-xr-x 65 root root  32K Oct 17 20:33 ../
drwxr-xr-x  4 root root 4.0K Oct 17 20:49 5.9.1-arch1-1/
drwxr-xr-x  3 root root 4.0K Oct 18 12:38 ./
I think it is an isolinux hook that looks for an -ARCH wildcard extension instead of -arch1?
ok, i think i understand your trouble about syslinux and it's my fault, do you have the syslinux package installed on your fresh installation meaning the system that you want an ISO from?

if not, try to install it inside your fresh installation before running obarun-mkiso, and tell me.
/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules/*-ARCH/modules.alias: No such file or directory
Are you sure to run the last commit? because the path was changed to
/var/lib/obarun/obarun-mkiso/work/airootfs/usr/lib/modules
it doesn't specify anymore the kernel version
ok please
% sudo pacman -Sy obarun-mkiso
many thanks for your help fungal_net :)

Powered by Obarun