Commit Graph

31 Commits

Author SHA1 Message Date
Lucas CHOLLET
c2d999eb52 Meta: Remove hardcoded resize2fs executable path
Let which find the resize2fs executable path for us, and use `/usr/sbin`
as a default.
2022-05-08 16:49:52 +02:00
Linus Groh
fbc1448eab Meta: Fix shellcheck errors in build-image-qemu.sh 2022-05-07 23:36:02 +02:00
Linus Groh
b9f1c44dbb Meta: Tweak default disk size calculation to not be as gratuitous
Instead of first doubling the required size for the determined inode
count and then _also_ tripling the sum of that and the determined disk
size, let's be a bit more reasonable and just double the sum of inode
count * size and disk size.

This results in a 1.4GB _disk_image, instead of the 2GB from before
(for < 800MB worth of files).
2022-05-07 23:36:02 +02:00
Linus Groh
3d5645f07d Meta: Allow overriding the default calculated _disk_image size
By providing SERENITY_DISK_SIZE_BYTES as an environment variable, the
calculation of default value considered suitable for the size of files
and number of inodes that will be included can be sidestepped.
2022-05-07 23:36:02 +02:00
Tom Maisey
d63cb35c0d Meta: Fix e2fsck variable on macOS in build-image-qemu.sh
Despite carefully adding homebrew's e2fsprogs to the PATH,
the script then defined E2FSCK as if we are always on Linux.
2022-03-30 01:57:51 -07:00
Gunnar Beutner
6b9913f010 Meta: Explicitly set number of available inodes for genext2fs
According to its manpage genext2fs tries to create the file system with
as few inodes as possible. This causes SerenityOS to fail at boot time
when creating temporary files.
2022-02-19 13:13:22 +02:00
Στέφανος
43d706a29e Meta: Fix problematic e2fsck behavior (Debian)
Under Debian `e2fsck` is found in `/sbin/` which does not match the
existing "version" the script currently uses (`/usr/sbin/e2fsck`
versus `/sbin/e2fsck`); therefore I added a simple `if` condition to
remedy the situation by verifying whether the original path exists or
not, so I can use the one Debian expects.

Special thanks goes to Tim Flynn a.k.a. `trflynn89` for his valuable
feedback.
2022-02-05 19:34:40 +00:00
Lucas CHOLLET
daec521010 Build: Remove hardcoded executable path
Let which find the fuse2fs executable path for us, as it is not in
`/usr/sbin` in every distro.
2022-02-01 10:20:54 +01:00
Mika Sundland
06d905622a Meta: Check if gdu is part of GNU coreutils 2022-01-28 07:19:52 +00:00
Chris Frey
8f3759c04f Meta: Use fuse2fs if available to avoid root when building image
The fuse2fs tool that is part of e2fsprogs-1.46 has a 'fakeroot'
mount option.  This allows a non-root users to modify file ownership
and permissions without actually being root.  This package is
available in Debian bullseye and buster-backports.

If available, the script assumes the user wants to use it.
Otherwise, it falls back to the usual root requirements.

Now that root is not required, the root check in
build-root-filesystem.sh is not necessary.  Since
build-root-filesystem.sh has 'set -e' enabled, removing this check
will not cause a change in functionality.
2022-01-13 03:35:21 -08:00
Chris Frey
951f7becec Meta: Use consistent indents in build-image-qemu.sh
This is a whitespace only commit to avoid confusion with the
next feature commit.
2022-01-13 03:35:21 -08:00
Chris Frey
319cdf4ff3 Meta: Do not ignore error message with exec
When calling sub-programs from shell with exec, the useful || die
idiom does not actually do anything, since the first script is gone.
2022-01-13 03:35:21 -08:00
tuftedocelot
6dee1e91be Meta+Documentation: Don't rebuild disk image for every run on OpenBSD 2021-12-29 03:46:56 -08:00
Martin Åberg
0ed2a03450 Meta: Assume and find GNU du
We want to use use the 'du' option '--apparent-size' which is a
GNU coreutils extension. GNU coreutils is a build dependency so
we know it is available. With this commit we first try to pick up
du as 'gdu', and if that fails, try 'du' instead.
2021-08-18 10:59:50 +02:00
Martin Åberg
0bf867bb9a Meta: Create memory disk before mounting it on FreeBSD
There was previously a case where the build-image-qemu.sh script
decided to mount an existing disk image, but without creating the
memory disk device and recording its /dev file name.

After this commit, We create the memory disk device just before
it is used to mount the disk image.
2021-08-18 10:25:00 +02:00
Jean-Baptiste Boric
f641cc6470 Meta: Tune default QEMU disk size
Having lots of small files in Base/ may require more inodes in the
ext2 filesystem than the format utility sets aside by default. Let's
make a more educated guess since we have a rough idea of how many
inodes we need by counting files and directories.
2021-08-13 08:04:59 +02:00
Gunnar Beutner
cc0914ae58 Meta: Add Homebrew paths for macOS on M1 to the PATH env variable 2021-07-24 14:04:13 +02:00
Gunnar Beutner
0ec1077bcb Meta: Prefer to use the QEMU binaries from the toolchain directory 2021-07-03 12:06:20 +02:00
Gunnar Beutner
6e094b8dbe Meta: Increase additional space for disk images
Previously we'd add 100MB on top of what du returned for the Root
directory. This increases that to 500MB.
2021-06-17 11:03:51 +02:00
Siddharth Kapoor
dbd9d13857
Meta: Run 'du' with '--apparent-size', except on macOS
Fixes #7172.
2021-05-16 22:50:46 +01:00
Eric Butler
1a48609c6b Meta: Always try genext2fs as fallback to build disk image
If mounting disk image fails (e.g. fuse is not available on macos),
always try using genext2fs before giving up.
2021-05-09 15:34:12 +02:00
Gunnar Beutner
479905be6c Meta: Re-use existing disk image where possible
This adds support for re-using and re-sizing existing disk images.
Disk images are checked with e2fsck prior to re-use and a new disk
image is automatically created when that check fails.
2021-04-23 22:34:05 +02:00
Panagiotis Vasilopoulos
e45e0eeb47 Everywhere: Replace SERENITY_ROOT with SERENITY_SOURCE_DIR 2021-04-20 15:27:52 +02:00
joshua stein
0d215b5548 Build: Sprinkle some portability, fix on OpenBSD
realpath(1) is specific to coreutils and its behavior can be had
with readlink -f

Create the Toolchain Build directory if it doesn't exist before
calling readlink, since realpath(3) on at least OpenBSD will error
on a non-existent path
2021-02-14 09:29:22 +01:00
Laurent Cimon
b4790010a8 Build: Modify various parts to allow the build to succeed on FreeBSD 2020-10-20 14:40:47 +02:00
Peter Elliott
fc425a218d Meta: Fix style of image building scripts
Oops. I didn't know there was a style guide for the scripts.
2020-07-28 19:09:44 +02:00
Peter Elliott
6f12ab3ced Meta: Calculate image size based on size of Build/Root and Base
This reduces the size of the default build, while allowing people to
install as many ports as they want, without having to manually specify
disk size.
2020-07-28 18:32:05 +02:00
Emanuele Torre
8e24a17d0d Meta: default SUDO_UID and SUDO_GID to 0 in build-image-*.sh scripts
In the GNU coreutils version of chown, ":" is a valid argument
(the command will result in a no-op), but POSIX chown does not
consider that valid.

If the user who ran build-image-*.sh was root, SUDO_UID and SUDO_GID
would not be set and, if the version of chown installed on the system
did not allow passing just a ":" as argument, the script would fail.

Let's default the value of SUDO_UID and SUDO_GID to 0 just in case.
2020-06-21 10:13:04 +02:00
Emanuele Torre
4a784d4d1b Meta: get rid of sync.sh using the technique used in the previous commit 2020-06-21 10:13:04 +02:00
Yonatan Goldschmidt
00c0650f96 Build: Add Dockerfile 2020-05-22 01:19:15 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00