Commit Graph

1099 Commits

Author SHA1 Message Date
nl6720
863247d0a6
Keep all SYSLINUX files in /syslinux
This gets rid of the duplicate ldlinux.c32 and the useless isolinux.cfg which only points to syslinux.cfg.

Implements https://gitlab.archlinux.org/archlinux/archiso/-/issues/46 .
2020-11-30 16:00:15 +02:00
nl6720
183ae52792
Prevent path traversal outside of $airootfs_dir 2020-11-30 09:21:35 +02:00
nl6720
42d9e4f983
Allow specifying ownership and mode of custom airootfs files and directories
profiledef.sh can now contain an associative array called file_permissions which can be used to set custom ownership and mode of custom airootfs files. The array's keys contain the path and the value is a colon separated list of owner UID, owner GID and access mode.
For example:

    file_permissions=(
      ["/etc/shadow"]="0:0:400"
    )

This means that mkarchiso now copies airootfs files (and directores) without permissions and anything that should be owned by a user other than root and/or if the mode should be something other than 644 for files and 755 for directories must to be listed in ${file_permission[@]} in profiledef.sh.

Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/61 .
2020-11-30 08:46:24 +02:00
fdupoux
2c99df5c9b Reset network interfaces at the end of the PXE boot to allow DHCP to run 2020-11-18 21:16:27 +00:00
David Runge
3160db0e9e
Fix evaluation bugs in mkarchiso
archiso/mkarchiso:
Guard the call to `_mksignature()` in `_prepare_airootfs_image()` by an if statement.
Using the `&&` logic leads to `_prepare_airootfs_image()` evaluating to false if `$gpg_key` is not set.

Add `_msg_info()` calls to `_set_override()` which prevent the function from evaluating to false if no override is
being done. Additionally this is great for debugging purposes.

Add `_msg_info()` calls to `_read_profile()` (which is great for debugging purposes).

Fixes #81
2020-11-18 19:24:02 +01:00
Sven-Hendrik Haase
6c397136fd Use official archlinux Docker image
archlinux/base is being deprecated anyway.
2020-11-17 11:35:46 +00:00
nl6720
96ac5e2454
mkarchiso: add xorrisofs options from boot mode specific functions instead of hardcoding them in _build_iso 2020-11-14 15:36:45 +02:00
nl6720
4dfb473748
mkarchiso: validate profile right after reading it
Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/76 .
2020-11-14 15:29:51 +02:00
nl6720
57d510fe7f
mkarchiso: general cleanup and simplification
- Remove remnants of the now removed legacy commands.
- Improve readability by getting rid of some "if" statements when performing string comparisons.
- Rename functions to make their purpose more clear.
- Move some conditions from functions to their invocations.
2020-11-14 14:49:33 +02:00
Sven-Hendrik Haase
bb91fd52d9
Use better xz options
Default: 732M
With these options: 675M
2020-11-03 21:17:20 +01:00
nl6720
cc169d7e31
configs/releng/packages.x86_64: add fatresize, gpart and tmux
- fatresize is a utility to resize FAT filesystems using libparted.
- gpart is partition table rescue/guessing tool.
- tmux is a terminal multiplexer. Requested in https://bugs.archlinux.org/task/68252 .
2020-11-01 19:46:32 +02:00
David Runge
40ae3ba97c
Set syslinux bootloader timeout to 15s
configs/releng/syslinux/archiso_sys.cfg:
Set the syslinux bootloader timeout to 15s.
In !97 it has accidentally been set to 1.5s.
2020-10-31 19:12:44 +01:00
David Runge
ee6c5faa86
Set bootloader timeouts to 15s
configs/releng/efiboot/loader/loader.conf,
configs/releng/syslinux/archiso_sys.cfg:

Set the bootloader timeout to 15s, as they have been set to an overly generous 30s in !79.

Fixes #80
2020-10-31 17:53:40 +01:00
fdupoux
9f16862acd Configure the image type and image creation options using profiles (#54) 2020-10-30 21:33:08 +00:00
Alexander Epaneshnikov
e369ade17d fix a typo, add myself in AUTHORS.rst 2020-10-29 16:55:16 +00:00
David Runge
e748a770b1
Add accessibility support based on option flag
scripts/run_archiso.sh:
Add the `-a` option flag to add accessibility support on demand for `run_archiso`.

Add accessibility specific options to qemu in `run_image()`.

Not providing the specific braille chardev hardware otherwise blocks running run_archiso with
`qemu-system-x86_64: -chardev braille,id=brltty: brlapi__openConnection: connect: No such file or directory`.

Fixes #77
2020-10-29 16:57:04 +01:00
David Runge
8bb3e8c12f
Fix linter errors in livecd-sound
configs/releng/airootfs/usr/local/bin/livecd-sound:
Replace oldstyle expr with a bash test in `is_numeric()`.

Replace use of `nword()` with call to `wc -w`.

Quote variables in `pick_a_card()`.

Fixes #78
2020-10-29 15:48:51 +01:00
Alexander Epaneshnikov
6a39300b0f implement accessibility support in archiso
this fixes #67
2020-10-29 12:30:37 +00:00
nl6720
6820f2cb69
Add modconf to HOOKS array in mkinitcpio.conf
The default mkinitcpio.conf includes modconf in HOOKS.
2020-10-29 13:36:27 +02:00
nl6720
3caa30fa2a
configs/releng/packages.x86_64: add squashfs-tools and udftools
- squashfs-tools can be used for system backup. https://wiki.archlinux.org/index.php/Full_system_backup_with_SquashFS
- udftools is needed to format UDF file systems.
2020-10-29 13:34:37 +02:00
David Runge
1bd944ee7c
Remove build.sh support from profiles and mkarchiso
configs/{baseline,releng}/build.sh:
Remove `build.sh` scripts. They were deprecated with v47.

archiso/mkarchiso:
Remove all `build.sh` related functionality (i.e. `command_pkglist()`, `command_iso()`, `command_prepare()`,
`command_install()`, `command_init()`, `command_run()`).

Rename `command_build_profile()` to `_build_profile()` to be more in line with the style of the other function naming.

Change `_show_config()` to only print info about the profile and make no more use of parameters.

Remove all help output related to legacy `build.sh` commands.

Fixes #51
2020-10-29 12:32:48 +01:00
David Runge
bff36764d3
Add documentation about how to create profiles
README.profile.rst:
Add information on all necessary components of a profile:

* profiledef.sh
* packages.arch
* airootfs/
* efiboot/
* isolinux/
* syslinux/

Fix wording for pacman.conf documentation

README.rst:
Add a link to README.profile.rst.

Fixes #38
2020-10-29 11:36:40 +01:00
Alexander Epaneshnikov
551edcd56d
run_archiso: fixup !86
forgot to enable USB support.
2020-10-25 00:14:46 +03:00
Alexander Epaneshnikov
cc2d9bbf8e run_archiso: add braille support
necessary for testing brltty in archiso
2020-10-24 19:22:31 +00:00
nl6720
ae0e914114
configs/baseline: support UEFI 2020-10-24 19:57:30 +03:00
David Runge
f3af569205
Set CacheDir and HookDir for profile more sanely
archiso/mkarchiso:
Change `_pacman()` to use the *modified* pacman.conf from the work_dir, instead of using the *unmodified* pacman.conf from
the profile.

Change `_make_pacman_conf()` to compare the system's and the profile's CacheDir setting and use the profile's CacheDir
setting only if it's not the default and not the same as the system's.

Always set the HookDir to the airootfs' override directory, so that no hooks from the host system are being run.

Remove DBPath, LogFile and RootDir settings from the work_dir pacman.conf as they are otherwise referring to the host
system, **even if** pacman is being called with the `-r` flag.

Fix a typo in _make_custom_airootfs().

README.profile.rst:
Add information about the pacman.conf in a profile and how configuration options behave, when used by mkarchiso.

Fixes #73
Fixes #74
2020-10-24 17:00:59 +02:00
nl6720
729d16b48c
Move FAT image to a separate partition outside the ISO 9660 file system
Support bios.syslinux.eltorito boot mode without bios.syslinux.mbr.
bios.syslinux.mbr does not work without bios.syslinux.eltorito because -isohybrid-mbr requires the El Torito boot image.

Support uefi-x64.systemd-boot.esp boot mode without uefi-x64.systemd-boot.eltorito and vice versa.
If uefi-x64.systemd-boot.eltorito is used without uefi-x64.systemd-boot.esp, the El Torito boot image will be placed in the ISO 9660 file system as before.
Note that an ISO created with only uefi-x64.systemd-boot.eltorito will still be bootable as a "hard disk" on OVMF. OVMF will boot the El Torito image.

This change has the following effect on the partition tables:

- *.eltorito options add El Torito boot catalog entries. MBR and GPT are not affected.
- uefi-x64.systemd-boot.esp creates a protective MBR partition table and a GPT table that includes a Linux filesystem data partition for the ISO 9660 volume, an EFI system partition and a Microsoft basic data partition that maps the 300 KiB padding added by xorriso.
- bios.syslinux.mbr (without uefi-x64.systemd-boot.esp): adds a MBR partition table and maps the ISO 9660 volume as a partition of type 0x83. No GPT is produced.
- bios.syslinux.mbr (with uefi-x64.systemd-boot.esp): adds an second partition in the MBR (after 0xEE) starting from sector 0 to sector 1 with type 0 and marks it as bootable. This violates the GPT specification, but allows some systems to succesfully boot in BIOS mode from GPT.

Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/49
2020-10-24 13:15:37 +03:00
Alexander Epaneshnikov
5f4260fcb1 add sound support in run_archiso.sh
also included serial output on stdio it helps in debugging without sight.
2020-10-10 13:03:02 +00:00
David Runge
2c66cd45e0
Add Contribute section to README
README.rst:
Add Contribute section to README to provide information about code of conduct, contributing guide and contact
information (mailing list and IRC).

Fixes #72
2020-10-10 11:32:20 +02:00
nl6720
bfab360529
Ensure that _make_boot_uefi-x64.systemd-boot.esp can be re-run if it fails
Remove efiboot.img if it exists so that mkfs.fat does not fail.
2020-10-07 11:42:08 +03:00
nl6720
f45fc29fe0
Save SOURCE_DATE_EPOCH to a file and read it from the file when resuming a build
Print the build date.
Don't re-run mksquashfs if it succeeded, but the failure was in gpg signing. For example, if the gpg pinentry timed out.
2020-10-07 11:42:08 +03:00
nl6720
455e2b94c0
Check command line parameter count instead of option count, and do it after evaluating option arguments
Fixes b6241cb1d0 .
2020-10-07 11:33:56 +03:00
nl6720
b6241cb1d0
Don't require root privileges just to show a "No command specified" error
Check if a profile or command is specified before looking at EUID.
2020-10-04 11:31:14 +03:00
David Runge
55cfb8ba02
Replace bash arithmetic with awk functions
archiso/mkarchiso:
The bash arithmethics in _make_boot_uefi-x64.systemd-boot.esp() introduced rounding issues, that can lead to
insufficient FAT image size for the files.
Conversion functions for awk now replace the bash arithmetics and additionally a ceil() function rounds the calculated
size up to the next full MiB.
Add an info message about the size of the created FAT image.

Fixes #70
2020-10-03 22:55:31 +02:00
David Runge
2e1ddec0a7
Fix info message for legacy command
archiso/mkarchiso:
Change the way _show_config() displays information about the build environment, as displaying a profile directory as a
legacy command to mkarchiso is confusing.
The function now prints a deprecation message if '$command_name' is not a directory (i.e. not a profile).
Remove 'command_' prefix from help output for legacy commands (the prefix is only in use for internal functions).

Relates to !69
Fixes #60
2020-09-29 17:29:15 +02:00
nl6720
f34c95797d
Calculate required efiboot.img size instead of hardcoding it
Use du to count the file size of the kernel(s), initramfs images and boot loader (and its configuration).
This allows to compress initramfs with something other than xz, or have more than one kernel installed.

Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/62 .
2020-09-27 20:54:11 +03:00
nl6720
8c047047ab
Split SYSLINUX configuration into per-kernel configuration files
Slightly simplifies adding boot loader configuration for more kernels.
Unfortunately the INCLUDE statement doesn't support wildcards, so each new file must be manually included in the main syslinux configuration file (syslinux.cfg for baseline and archiso_sys.cfg for releng).
2020-09-27 20:54:11 +03:00
nl6720
8276616f6f
archiso/mkarchiso: do not hardcode the kernel and initramfs file names
All kernels and initramfs images from airootfs are copied to ${install_dir}/boot/ on both ISO 9660 and FAT.
This allows providing multiple kernels. The kernel package needs to be added to packages.x86_64 and the boot loader configuration files created/adjusted appropriately.

Support all possible microcode initrd file names.
2020-09-27 20:54:11 +03:00
nl6720
83e4cb9fb9
Use the same file paths in both ISO 9660 and FAT
This allows to use only one systemd-boot configuration file per kernel.
Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/44 .
2020-09-27 20:54:11 +03:00
nl6720
136152e672
Do not rename the initramfs image
This is a breaking change. archweb, archiso-manager and various documentation must be updated.

* https://github.com/archlinux/archweb/blob/master/templates/releng/archlinux.ipxe
* https://github.com/pierres/archiso-manager/blob/master/Makefile
2020-09-27 20:54:10 +03:00
nl6720
9544bbfdf1
configs/releng: remove custom reflector.service and use the service provided by the package
archiso specific options are placed in a /etc/systemd/system/reflector.service.d/archiso.conf drop-in.
2020-09-27 19:55:38 +03:00
nl6720
486b1910dd
Do not overwrite existing files when copying from /etc/skel/
Copy /etc/skel/ only for users with UID in range 1000–60000.
Correct user home directory permission after copying files.
Fixes all /etc/skel issues from https://bugs.archlinux.org/task/67729 .
2020-09-05 11:23:00 +03:00
nl6720
45a5d229b3
Create directories and copy files to the FAT image using mtools instead of mounting the file system
- mtools supports SOURCE_DATE_EPOCH.
- The image file is operated on directly instead of mounting the file system. This is a prerequisite to limit the commands that run with root privileges. Related to https://gitlab.archlinux.org/archlinux/archiso/-/issues/40 .
- Add a reminder comment to not get rid of the dosfstools dependency, since a mformat made FAT image can fail to boot on some systems.
2020-09-02 22:31:04 +03:00
David Runge
4b401931bd
Add missing declaration of override_install_dir
**archiso/mkarchiso**:

In d90184a the unbound variable `override_install_dir` was introduced by accident.

It is required to be set to empty string to provide override functionality for `install_dir`.

Fixes #57
2020-08-25 22:02:50 +02:00
David Runge
d90184a7f0
Pass profile directory as parameter to mkarchiso
**archiso/mkarchiso**:

Change all override option parameters (i.e. `-A`, `-C`, `-D`, `-L`, `-P` and `-g`) to not directly override the global
variable they are tied to, but instead using an `override_` prefixed variable.

Add `_set_overrides()` to use `override_` prefixed variables (if set) to override those without a prefix.

Remove `-B` (a profile directory) from the list of parameters. The profile directory is now provided as separate
non-option parameter.

Add a call to `_read_profile()`, `_set_overrides()` and `command_build_profile()` to the fallthrough option of the
switch-case checking `command_name` - a non-option parameter to mkarchiso. This effectively provides the possibility to
set the profile directory using a non-option parameter, while still maintaining compatibility to legacy named arguments
used in the configs' `build.sh` scripts.

Extend the warning in regards to legacy `build.sh` based commands to mkarchiso by providing an EOL with archiso v49.

Change the help output to reflect the changes and further elaborate on the legacy commands used by `build.sh` scripts.

Change help output to be ordered alphabetically.

Add help output for `-r` and `-g` options.

Call `_set_overrides()` for legacy commands that accept one or more of the overriden options (i.e. `command_init`,
`command_install`, `command_prepare` and `command_iso`).

Various style fixes.

**configs/{baseline,releng}/build.sh**:

Change call to mkarchiso to use the profile's directory as a named argument instead of an option-argument.

**README.rst**:

Fix documentation on how to call mkarchiso with a profile directory.

Fix wording and ordering of option arguments for run_archiso documentation.

Fixes #52
2020-08-25 19:06:43 +02:00
nl6720
e2c5b4527f
archiso/mkarchiso: reduce duplication and add more info messages
Fixes to issues introduced in https://gitlab.archlinux.org/archlinux/archiso/-/merge_requests/59 :
- _make_boot_on_fat(): copy initramfs from "${airootfs_dir}/boot/" not "${isofs_dir}/". Otherwise UEFI-only ISOs cannot be built.

Some general fixes:
- Replace mkdir with install. Unlike mkdir, install does not complain when the target exists.
- Reduce excess newlines produced by messages.
- Ensure FAT image gets unmounted in case the script is interrupted.
- Create the ext4 image with mkfs.ext4 instead of truncate.
- Do not rely on user and group names for chown commands. Use numeric UID and GID instead.
- Minimize the times stderr is redirected to /dev/null.
- Add missing '?' to getopts.
- Standardize function definitions by removing spaces between the function name and () .
2020-08-21 14:16:32 +03:00
nl6720
13b8c7d099
archiso/mkarchiso: correct the path of airootfs/etc/machine-id
Use "${airootfs_dir}".
Fixes a mistake introduced when rebasing https://gitlab.archlinux.org/archlinux/archiso/-/merge_requests/64 .
2020-08-18 21:59:18 +03:00
nl6720
41d3d7d489
Add Joliet file system to the ISO
Joliet ensures correct file names capitalization on operating systems that support Joliet but not support Rock Ridge.
Implements https://gitlab.archlinux.org/archlinux/archiso/-/issues/45 .
2020-08-18 21:41:37 +03:00
nl6720
e6455b885b
archiso/mkarchiso: create an empty /etc/machine-id
Fixes https://gitlab.archlinux.org/archlinux/archiso/-/issues/42 .
2020-08-18 21:27:52 +03:00
nl6720
ba3e8345ad
scripts/run_archiso.sh: support booting the image as a hard disk or an optical disc
Use virtio-scsi to attach the image. virtio-blk (if=virtio) is inconsistent about the used media type.
2020-08-18 21:21:23 +03:00