summaryrefslogtreecommitdiff
path: root/Meta/lint-missing-resources.sh
blob: 1a1b6f6a6332ff1107759ae35972e85f1f7589a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

set -eo pipefail

script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "$script_path/.."

# The dollar symbol in sed's argument is for "end of line", not any shell variable.
# shellcheck disable=SC2016
grep -Pirh '(?<!file://)(?<!\.)(?<!})(?<!\()/(etc|res|usr|www)/' AK/ Base DevTools/ Documentation/ Kernel/ Services/ Userland/ | \
sed -re 's,^.*["= `]/([^"%`: ]+[^"%`: /.])/?(["%`: .].*)?$,\1,' | \
sort -u | \
while read -r referenced_resource
do
    if ! [ -r "Base/${referenced_resource}" ] && ! [ -r "Build/Root/${referenced_resource}" ]
    then
        echo "Potentially missing resource: ${referenced_resource}"
    fi
done