forked from flatcar/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_overlay_dups
executable file
·35 lines (26 loc) · 993 Bytes
/
find_overlay_dups
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Prints packages which are in both portage-stable and coreos-overlay
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1
DEFINE_string overlay_path "${SRC_ROOT}/third_party/coreos-overlay" \
"Directory containing the overlay"
DEFINE_string portage_stable_path "${SRC_ROOT}/third_party/portage-stable" \
"Path to portage-stable"
# Parse flags
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
function get_tree_packages() {
# gets a list of all packages in a tree
find "$1" -maxdepth 3 -type f -name "*.ebuild" -printf "%P\n" | xargs dirname | sort | uniq
}
portage_stable_packages=$(get_tree_packages ${FLAGS_portage_stable_path})
overlay_packages=$(get_tree_packages ${FLAGS_overlay_path})
all_packages="$portage_stable_packages $overlay_packages"
dups=$(sort <<< "$all_packages" | uniq -D | uniq)
if [[ -z "$dups" ]]; then
info "No duplicate packages, all good!"
exit 0
fi
warn "Found duplicate package(s):"
warn "$dups"
exit 1