Commit graph

9 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 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
Brian Gianforcaro ee61739e0a Meta: Add install-native-partition CMake target installing to a real FS
While playing around with getting serenity to run on my main desktop
machine I wanted a way of easily updating my physical serenity
partition.

To use it you just need to:
- Create and format your local partition to ext4
- Set `SERENITY_TARGET_INSTALL_PARTITION` to the partition /dev path.
- Run the `install-native-partition` build target.

Example:

    $ export SERENITY_TARGET_INSTALL_PARTITION=/dev/nvme1n1p3
    $ cd serenity/Build/x86_64
    $ ninja install-native-partition
2022-02-04 12:44:50 +01:00