diff options
author | MartiMcFly | 2016-01-24 01:00:32 +0000 |
---|---|---|
committer | MartiMcFly | 2016-01-24 01:00:32 +0000 |
commit | 36f95d706ab489bc2604dde4020b586a48beb41e (patch) | |
tree | 64cf27695ef32bee37ec2a50fde0c8e389255551 /compress-static | |
parent | 6dbf0eef04c915161699291942eb73910d015652 (diff) | |
download | aur-36f95d706ab489bc2604dde4020b586a48beb41e.tar.gz |
compression + configs in etc
Diffstat (limited to 'compress-static')
-rwxr-xr-x | compress-static | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/compress-static b/compress-static new file mode 100755 index 000000000000..1dda2f4699b8 --- /dev/null +++ b/compress-static @@ -0,0 +1,34 @@ +#!/bin/bash + +LOCATION=$1 +FILES="htm|css|html|js" + +process() { + FILE="$1" + + 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 +} +export -f process +find $LOCATION -type f -regextype posix-extended -regex '.*\.('$FILES')' -exec /bin/bash -c 'process "{}"' \;
\ No newline at end of file |