mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2025-12-27 07:00:05 +01:00
* Add patching script with error checking+reporting new file: patches/apply.sh * Run patching script with run_command() at setup and print the output with message() at the end modified: meson.build * Report on patch application failure and exit script with code 1 modified: patches/apply.sh --------- Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>
32 lines
580 B
Bash
Executable file
32 lines
580 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# find all patches in patches/
|
|
PATCHES=$(find patches/ -type f -name '*.patch')
|
|
|
|
check () {
|
|
git apply --check -q -p1 $PATCH
|
|
}
|
|
|
|
apply () {
|
|
git apply -p1 $PATCH
|
|
}
|
|
|
|
check_applied () {
|
|
git apply --check --reverse -q -p1 $PATCH
|
|
}
|
|
|
|
fail () {
|
|
echo =======\> \'$PATCH\' was not applied && exit 1
|
|
}
|
|
|
|
if [[ -n "$PATCHES" ]];
|
|
then
|
|
# check patch validity and apply, else check if already applied and report and exit on failure
|
|
echo 'Patches found. Applying...';
|
|
for PATCH in $PATCHES;
|
|
do
|
|
check && apply || check_applied || fail;
|
|
done
|
|
else
|
|
echo 'No patches found.'
|
|
fi
|