mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
* refactor project structure * environment-based default registry * fix tests * update build container * use docker platform for iso build emulation * simplify compat * Fix docker platform spec in run-compat.sh * handle riscv compat * fix bug with dep error exists attr * undo removal of sorting * use qemu for iso stage --------- Co-authored-by: Mariusz Kogen <k0gen@pm.me> Co-authored-by: Matt Hill <mattnine@protonmail.com>
31 lines
867 B
Bash
Executable File
31 lines
867 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
set -e
|
|
|
|
STATIC_DIR=dist/static/$1
|
|
RAW_DIR=dist/raw/$1
|
|
|
|
mkdir -p $STATIC_DIR
|
|
rm -rf $STATIC_DIR
|
|
|
|
if ! [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
|
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 gzip -kf
|
|
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 brotli -kf
|
|
|
|
for file in $(find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br'); do
|
|
raw_size=$(du $file | awk '{print $1 * 512}')
|
|
gz_size=$(du $file.gz | awk '{print $1 * 512}')
|
|
br_size=$(du $file.br | awk '{print $1 * 512}')
|
|
if [ $((gz_size * 100 / raw_size)) -gt 70 ]; then
|
|
rm $file.gz
|
|
fi
|
|
if [ $((br_size * 100 / raw_size)) -gt 70 ]; then
|
|
rm $file.br
|
|
fi
|
|
done
|
|
fi
|
|
|
|
|
|
cp -r $RAW_DIR $STATIC_DIR |