mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-11-02 01:11:31 +01:00
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/ash
|
|
|
|
FILES="htm|css|html|js"
|
|
|
|
process() {
|
|
FILE="$1"
|
|
|
|
if ! $(echo "$FILE" | grep -E '.*\.('$FILES')')
|
|
then
|
|
return 0
|
|
fi
|
|
|
|
|
|
if [ -f "$FILE".gz ]
|
|
then
|
|
FILE_ORIG=$(stat -c %Y "$FILE")
|
|
FILE_GZIP=$(stat -c %Y "$FILE".gz)
|
|
if [ $FILE_ORIG -gt $FILE_GZIP ]
|
|
then
|
|
rm "$FILE".gz
|
|
gzip -k -9 "$FILE"
|
|
if [ "$DEBUG" == 1 ]
|
|
then
|
|
echo "Deleted old .gz and created new one at: $FILE.gz"
|
|
sleep $SLEEP_DELAY
|
|
fi
|
|
else
|
|
if [ "$DEBUG" == 1 ]
|
|
then
|
|
echo "Skipping - Already up to date: $FILE.gz"
|
|
fi
|
|
fi
|
|
else
|
|
gzip -k -9 "$FILE"
|
|
echo "Created new: $FILE.gz"
|
|
fi
|
|
}
|
|
process
|