mirror of
https://github.com/simon987/sist2.git
synced 2025-12-10 22:18:54 +00:00
Archive file support
This commit is contained in:
@@ -67,5 +67,39 @@ make -j 4
|
||||
cd ..
|
||||
mv libmagic/src/.libs/libmagic.a .
|
||||
|
||||
# libarchive
|
||||
git clone https://github.com/libarchive/libarchive
|
||||
cd libarchive/build
|
||||
./autogen.sh
|
||||
cd ..
|
||||
./configure --without-nettle --without-expat --without-xml2 --without-openssl
|
||||
make -j 4
|
||||
cd ..
|
||||
mv libarchive/.libs/libarchive.a .
|
||||
|
||||
# lz4
|
||||
git clone https://github.com/lz4/lz4
|
||||
cd lz4
|
||||
make -j 4
|
||||
cd ..
|
||||
mv lz4/lib/liblz4.a .
|
||||
|
||||
# lzma
|
||||
wget https://newcontinuum.dl.sourceforge.net/project/lzmautils/xz-5.2.3.tar.gz
|
||||
tar -xzf xz-5.2.3.tar.gz
|
||||
rm xz-5.2.3.tar.gz
|
||||
cd xz-5.2.3
|
||||
./autogen.sh
|
||||
./configure
|
||||
make -j 4
|
||||
cd ..
|
||||
mv xz-5.2.3/src/liblzma/.libs/liblzma.a .
|
||||
|
||||
# zstd
|
||||
git clone https://github.com/facebook/zstd
|
||||
cd zstd
|
||||
make -j 4
|
||||
cd ..
|
||||
mv zstd/lib/libzstd.a .
|
||||
|
||||
cd ..
|
||||
|
||||
@@ -34,6 +34,28 @@ font = (
|
||||
"font/woff2"
|
||||
)
|
||||
|
||||
# Archive "formats"
|
||||
archive = (
|
||||
"application/x-tar",
|
||||
"application/zip",
|
||||
"application/x-rar",
|
||||
"application/x-arc",
|
||||
"application/x-warc",
|
||||
"application/x-7z-compressed",
|
||||
)
|
||||
|
||||
# Archive "filters"
|
||||
arc_filter = (
|
||||
"application/gzip",
|
||||
"application/x-bzip2",
|
||||
"application/x-xz",
|
||||
"application/x-zstd",
|
||||
"application/x-lzma",
|
||||
"application/x-lz4",
|
||||
"application/x-lzip",
|
||||
"application/x-lzop",
|
||||
)
|
||||
|
||||
cnt = 1
|
||||
|
||||
|
||||
@@ -48,6 +70,10 @@ def mime_id(mime):
|
||||
mime_id += " | 0x40000000"
|
||||
elif mime in font:
|
||||
mime_id += " | 0x20000000"
|
||||
elif mime in archive:
|
||||
mime_id += " | 0x10000000"
|
||||
elif mime in arc_filter:
|
||||
mime_id += " | 0x08000000"
|
||||
elif mime == "application/x-empty":
|
||||
return "1"
|
||||
return mime_id
|
||||
|
||||
Reference in New Issue
Block a user