Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Commit

Permalink
Add additional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Kron4ek authored Aug 24, 2020
1 parent 496861d commit 02dbe64
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions create_wine_portable.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

## Required packages: squashfs-tools wget
## Required packages: squashfs-tools wget xz

script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"

Expand All @@ -14,6 +14,21 @@ wine_url="https://github.com/Kron4ek/Wine-Builds/releases/download/5.15/wine-5.1
squashfs_compressor="lz4"
compressor_arguments="-Xhc"

if ! command -v mksquashfs 1>/dev/null; then
echo "squashfs-tools is required!"
exit 1
fi

if ! command -v wget 1>/dev/null; then
echo "wget is required!"
exit 1
fi

if ! command -v xz 1>/dev/null; then
echo "xz is required!"
exit 1
fi

rm -rf "${script_dir}"/wine-portable
mkdir -p "${script_dir}"/wine-portable/squashfs-root

Expand All @@ -23,17 +38,17 @@ cd "${script_dir}"/wine-portable/squashfs-root || exit 1
if [ ! -d wine ]; then
if [ ! -d "${script_dir}"/wine ]; then
wget -nv -O wine.tar.xz "${wine_url}" -q --show-progress

if [ $? -ne 0 ]; then
echo "URL for downloading Wine is incorrect!"
echo "Please set wine_url variable to correct URL"
exit 1
fi

tar xf wine.tar.xz
rm wine.tar.xz
mv wine* wine

cp -r wine "${script_dir}"
else
cp -r "${script_dir}"/wine .
Expand All @@ -44,6 +59,9 @@ if [ ! -d wine-runtime ]; then
if [ ! -f "${script_dir}"/binaries/wine-runtime.tar.xz ]; then
echo "binaries/wine-runtime.tar.xz is required!"
exit 1
elif [ "$(stat -c%s "${script_dir}"/binaries/wine-runtime.tar.xz)" -lt 10000 ];
echo "Seems like binaries/wine-runtime.tar.xz is corrupted!"
exit 1
else
tar xf "${script_dir}"/binaries/wine-runtime.tar.xz
fi
Expand All @@ -56,7 +74,7 @@ if [ ! -f wine.sh ]; then
else
cp "${script_dir}"/wine.sh .
fi

chmod +x wine.sh
fi

Expand All @@ -67,7 +85,7 @@ if [ ! -f winetricks ]; then
else
cp "${script_dir}"/winetricks .
fi

chmod +x winetricks
fi

Expand All @@ -77,6 +95,9 @@ if [ ! -f squashfuse.tar ]; then
if [ ! -f "${script_dir}"/binaries/squashfuse.tar ]; then
echo "binaries/squashfuse.tar is required!"
exit 1
elif [ "$(stat -c%s "${script_dir}"/binaries/squashfuse.tar)" -lt 10000 ];
echo "Seems like binaries/squashfuse.tar is corrupted!"
exit 1
else
cp -L "${script_dir}"/binaries/squashfuse.tar .
fi
Expand All @@ -89,7 +110,7 @@ if [ ! -f squashfs-start.sh ]; then
else
cp "${script_dir}"/squashfs-start.sh .
fi

chmod +x squashfs-start.sh
fi

Expand Down

0 comments on commit 02dbe64

Please sign in to comment.