1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 13:30:45 +00:00
Commit Graph

22 Commits

Author SHA1 Message Date
Ali Mohammad Pur
a720feba2f Meta: Pass -- to sudo instead of '$SHELL -c' in build scripts
fddbd11baa made it so the command executed
read `sh -c -- '"script" args*'`, the -- in this command is redundant as
the script name never starts with a dash and can never be interpreted as
an option or a flag.
The actually meaningful placement for -- here is after `$SUDO`, to make
sure `$SUDO` does not incorrectly treat `-c` as an option to itself, and
`$SHELL` cannot be interpreted as an option/flag in the extremely
unlikely event that it starts with a dash.
2023-07-16 16:28:18 +01:00
Dominique Liberda
d7644d1d86 Meta: Improve build compatibility with non-GNU userspaces
We depend on GNU-specific du switch `--apparent-size`. Busybox has this
implemented, but as `-b` instead.
Another part of the build system uses `cp --preserve=timestamps`. This
can be replaced by `rsync -t`, and rsync is already used through the
file.

Thanks to those changes, Serenity can be built on a Busybox system,
without GNU coreutils.
2023-07-09 06:16:31 +01:00
Dominique Liberda
fddbd11baa Meta: Implement proper checks for sudo alternatives
This introduces support for building with doas.
2023-07-09 06:16:31 +01:00
Nico Weber
c6f81b5b83 Meta: Tweak shell_include.sh
* `chmod -x` as it's for sourcing, not for executing
* Remove run line, for the same reason
* Rename it from .shell_include.sh to shell_include.sh, since e.g.
  `rg` doesn't search in hidden files by default

No behavior change.
2022-12-20 09:23:32 -05:00
Lucas CHOLLET
0fde7fe3c5 Meta: Factorize path resolution
This patch adds the `find_executable()` function that will hopefully
find executables in a distro-agnostic way and that is (hopefully as
well) easily upgradable.

The function uses some bash functionalities. So, we now require bash
for each script that includes `.shell_include.sh`.
2022-12-14 16:43:44 +00:00
Baitinq
88c9e4f3b0 Meta: Don't depend on sudo for privileged operations
We previously depended on sudo's specific -E flag to keep all the
environment variables when performing a privilege escalation. We now
incorporate the -E flag into the $SUDO variable, allowing for other
privilege escalation binaries (such as doas) to be used (as long as
they preserve the current environment variables).
2022-12-14 14:38:13 +00:00
Tim Schumacher
2a4f81fc83 Meta: Start moving common shell definitions into a common file 2022-10-16 23:39:45 +02:00
Tim Schumacher
032ef1b461 Meta: Define SUDO for all the image building scripts
Back when adding support for `pls` as a `sudo` replacement,
`build-image-qemu` dynamically set the `SUDO` variable depending on what
system it was running on and used the contents of that variable to call
the correct elevation utility.

During recent changes to the elevation error message, that usage of the
variable was replicated across all of our scripts, but without also
replicating the logic to set that variable in the first place.

Add back the variable setting logic to all the other scripts to keep
them from running into unset variables.
2022-10-16 23:39:45 +02:00
demostanis
48aea321c5 Meta: Don't tell to run script as root when that's not the actual error
Before, and that was the cause of many confusion in #build-problems
on Discord, the Meta/build-image-*.sh scripts would error out with
the message "this script needs to run as root" while the actual error
was unrelated.
2022-10-15 01:40:01 +02:00
Siddharth Kapoor
dbd9d13857
Meta: Run 'du' with '--apparent-size', except on macOS
Fixes #7172.
2021-05-16 22:50:46 +01:00
Linus Groh
5ee9aab7e1 Meta: Bump BIOS/MBR boot partition size of grub disk image to 1MiB
As of ~April 2021 the Meta/build-image-grub.sh script no longer works
for me (on Fedora 34) and fails with the following error:

    /usr/sbin/grub2-install: warning: ../grub-core/partmap/msdos.c:403:
    your core.img is unusually large. It won't fit in the embedding
    area.

    /usr/sbin/grub2-install: warning: Embedding is not possible. GRUB
    can only be installed in this setup by using blocklists. However,
    blocklists are UNRELIABLE and their use is discouraged..

    /usr/sbin/grub2-install: error: will not proceed with blocklists.

Changing the size of the boot partition from 32 kiB to 1 MiB (2048
sectors) fixes the issue. This is also described in the following Ubuntu
grub2 bug (as well as 40 duplicates!) from 2012, which suggests the same
fix: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1059827

The Arch Linux wiki also uses 1 MiB in their BIOS/MBR examples for
parted: https://wiki.archlinux.org/title/Parted

I'm not sure why this suddenly stopped working, however I was able to
boot with an image created with this change applied.
2021-05-15 00:57:35 +02:00
Panagiotis Vasilopoulos
e45e0eeb47 Everywhere: Replace SERENITY_ROOT with SERENITY_SOURCE_DIR 2021-04-20 15:27:52 +02:00
Tom
5b1edc0678 Meta: Allow specifying custom grub config file for build-image-grub.sh
This allows passing a custom grub config file as second argument to
build-image-grub.sh.
2021-03-01 11:11:56 +01:00
Liav A
bc18712adf Build: Fix build of grub image when choosing EBR scheme 2020-12-27 23:07:44 +01:00
Liav A
0f208669af Build: Fix build of grub image when choosing GPT scheme 2020-12-27 23:07:44 +01: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
e42f4abd61 Meta: tweak build-image-grub.sh to allow running make grub-image..
without sudo.
2020-06-21 10:13:04 +02:00
etaIneLp
330aecb5d8
Build: Use a separate byproduct name for the GRUB disk image (#2424)
The grub-image target no longer conflicts with normal image target.
This unbreaks using CMake with Ninja.

Fixes #2423.
2020-05-28 10:08:38 +02:00
etaIneLp
0c1ed0ebf3 Meta: build-image-grub.sh looks for grub configs in the right place 2020-05-28 00:50:55 +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