2020-03-05 20:14:12 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
# Copy folder, without symlinks, but use actual files instead
|
2020-03-29 11:16:01 +00:00
|
|
|
mkdir -p build/_
|
2020-05-07 23:37:34 +00:00
|
|
|
|
|
|
|
|
# Copy custom integrations
|
|
|
|
|
rsync -aL custom_integrations/ build/_
|
|
|
|
|
rsync -aL custom_integrations/ build
|
|
|
|
|
|
|
|
|
|
# Copy core integrations
|
|
|
|
|
rsync -aL --exclude '_homeassistant' core_integrations/ build/_
|
|
|
|
|
rsync -aL --exclude '_homeassistant' --exclude '_placeholder' core_integrations/ build
|
2020-03-05 20:14:12 +00:00
|
|
|
|
|
|
|
|
# Use icon as logo in case of a missing logo
|
|
|
|
|
find ./build -type f -name "icon.png" | while read icon; do
|
|
|
|
|
dir=$(dirname "${icon}")
|
|
|
|
|
if [[ ! -f "${dir}/logo.png" ]]; then
|
|
|
|
|
cp "${icon}" "${dir}/logo.png"
|
|
|
|
|
echo "Using ${icon} as logo"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Use icon as icon@2x in case it is missing
|
|
|
|
|
find ./build -type f -name "icon.png" | while read icon; do
|
|
|
|
|
dir=$(dirname "${icon}")
|
|
|
|
|
if [[ ! -f "${dir}/icon@2x.png" ]]; then
|
|
|
|
|
cp "${icon}" "${dir}/icon@2x.png"
|
|
|
|
|
echo "Using ${icon} as hDPI icon"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Use logo as logo@2x in case it is missing
|
|
|
|
|
find ./build -type f -name "logo.png" | while read logo; do
|
|
|
|
|
dir=$(dirname "${logo}")
|
|
|
|
|
if [[ ! -f "${dir}/logo@2x.png" ]]; then
|
|
|
|
|
cp "${logo}" "${dir}/logo@2x.png"
|
|
|
|
|
echo "Using ${logo} as hDPI logo"
|
|
|
|
|
fi
|
|
|
|
|
done
|
2021-05-04 09:52:59 +00:00
|
|
|
|
2021-08-11 12:19:05 +00:00
|
|
|
# Create fallback for dark variants
|
|
|
|
|
find ./build -type f -type f -name "icon.png" -o -name "icon@2x.png" -o -name "logo.png" -o -name "logo@2x.png" | while read image; do
|
|
|
|
|
dir=$(dirname "${image}")
|
|
|
|
|
filename=$(basename -s .png "${image}")
|
|
|
|
|
if [[ ! -f "${dir}/dark_${filename}.png" ]]; then
|
|
|
|
|
cp "${image}" "${dir}/dark_${filename}.png"
|
|
|
|
|
echo "Using ${image} as dark_${filename}"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2021-05-04 09:52:59 +00:00
|
|
|
# Create domains.json
|
2021-05-13 17:37:56 +00:00
|
|
|
core_integrations=$(find ./core_integrations -maxdepth 1 -exec basename {} \; | sort | jq -sR 'split("\n")[1:]' | jq -r 'map(select(length > 0))')
|
|
|
|
|
custom_integrations=$(find ./custom_integrations -maxdepth 1 -exec basename {} \; | sort | jq -sR 'split("\n")[1:]' | jq -r 'map(select(length > 0))')
|
2021-05-07 07:42:41 +00:00
|
|
|
jq -n '{"core": $core, "custom": $custom}' --argjson core "$core_integrations" --argjson custom "$custom_integrations" | jq -r . > ./build/domains.json
|