Minor Changes

This commit is contained in:
Howard Wu 2022-10-22 18:57:06 +08:00
parent ff4ca1921d
commit 8367bf2b60
2 changed files with 7 additions and 5 deletions

View File

@ -865,19 +865,20 @@ if [ "$COMPRESS_OUTPUT" ] || [ -n "$COMPRESS_FORMAT" ]; then
if [ "$FILE_EXT" = ".xz" ]; then if [ "$FILE_EXT" = ".xz" ]; then
FILE_EXT=".tar$FILE_EXT" FILE_EXT=".tar$FILE_EXT"
fi fi
OUTPUT_PATH="$OUTPUT_PATH$FILE_EXT"
fi fi
rm -f "${OUTPUT_PATH:?}$FILE_EXT" || abort rm -f "${OUTPUT_PATH:?}" || abort
if [ "$COMPRESS_FORMAT" = "7z" ]; then if [ "$COMPRESS_FORMAT" = "7z" ]; then
echo "Compressing with 7z" echo "Compressing with 7z"
7z a "${OUTPUT_PATH:?}$FILE_EXT" "$WORK_DIR/wsa/$artifact_name" || abort 7z a "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
elif [ "$COMPRESS_FORMAT" = "xz" ]; then elif [ "$COMPRESS_FORMAT" = "xz" ]; then
echo "Compressing with tar xz" echo "Compressing with tar xz"
if ! (tar -cP -I 'xz -9 -T0' -f "${OUTPUT_PATH:?}$FILE_EXT" "$WORK_DIR/wsa/$artifact_name"); then if ! (tar -cP -I 'xz -9 -T0' -f "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name"); then
echo "Out of memory? Trying again with single threads..." echo "Out of memory? Trying again with single threads..."
tar -cPJvf "${OUTPUT_PATH:?}$FILE_EXT" "$WORK_DIR/wsa/$artifact_name" || abort tar -cPJvf "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
fi fi
elif [ "$COMPRESS_FORMAT" = "zip" ]; then elif [ "$COMPRESS_FORMAT" = "zip" ]; then
7z -tzip a "${OUTPUT_PATH:?}$FILE_EXT" "$WORK_DIR/wsa/$artifact_name" || abort 7z -tzip a "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
fi fi
else else
rm -rf "${OUTPUT_PATH:?}" || abort rm -rf "${OUTPUT_PATH:?}" || abort

View File

@ -53,6 +53,7 @@ check_dependencies() {
command -v 7z > /dev/null 2>&1 || NEED_INSTALL+=("p7zip-full") command -v 7z > /dev/null 2>&1 || NEED_INSTALL+=("p7zip-full")
command -v setfattr > /dev/null 2>&1 || NEED_INSTALL+=("attr") command -v setfattr > /dev/null 2>&1 || NEED_INSTALL+=("attr")
command -v xz > /dev/null 2>&1 || NEED_INSTALL+=("xz-utils") command -v xz > /dev/null 2>&1 || NEED_INSTALL+=("xz-utils")
command -v unzip > /dev/null 2>&1 || NEED_INSTALL+=("unzip")
} }
check_dependencies check_dependencies
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release); osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release);