Skip to content

Instantly share code, notes, and snippets.

@hradec
Created March 21, 2023 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hradec/50237b1086109c8eb63ccc481179e1c3 to your computer and use it in GitHub Desktop.
Save hradec/50237b1086109c8eb63ccc481179e1c3 to your computer and use it in GitHub Desktop.
wine-dowloader.sh - a script that downloads wine from winehq Ubuntu 18.04 depot (can be used in most distros as standalone wine)
#!/bin/bash
CD=$(dirname $(readlink -f $0))
while getopts hlv: option ; do
case "${option}"
in
h) export HELP=1;;
l) export LIST=1;;
v) ver="${OPTARG}";;
esac
done
if [ "$LIST" != "" ] ; then
version_list=$(curl -L 'https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-amd64' | grep '.deb"' | awk -F'<a href="' '{print $2}' | awk -F'">' '{print $1}' | grep devel_ | grep -v winehq | while read p ; do echo -e "$(echo $p | sed 's/~/_/g' | awk -F'_' '{print $2}')\t$p" ; done | sort)
echo "$version_list"
exit -1
# v=$(echo "$version_list" | tail -1 | awk '{print $1}')
fi
v=$ver
if [ "$v" == "" ] || [ "$HELP" != "" ] ; then
echo "$(basename $0) - downloads wine versions from WineHQ Ubuntu 18.04 depot"
echo ""
echo " -h show this help"
echo " -l list the available versions for download"
echo " -v specify the version to download"
echo ""
echo "The version version will be installed in a 'wine' folder at the same path this script"
echo "is located - $CD/wine/<version>"
echo ""
echo ""
exit -1
fi
echo "downloading version $v..."
mkdir -p $CD/wine/download/temp
cd $CD/wine/download/
# wine-devel-i386 (= 8.4~bionic-1), wine-devel-amd64 (= 8.4~bionic-1)
curl -L -O "https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-amd64/wine-devel_$v~bionic-1_amd64.deb"
curl -L -O "https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-i386/wine-devel-i386_$v~bionic-1_i386.deb"
curl -L -O "https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/main/binary-amd64/wine-devel-amd64_$v~bionic-1_amd64.deb"
cd $CD/wine/download/temp
ar x ../wine-devel_$v~bionic-1_amd64.deb
tar xf data.tar.*
ar x ../wine-devel-i386_$v~bionic-1_i386.deb
tar xf data.tar.*
ar x ../wine-devel-amd64_$v~bionic-1_amd64.deb
tar xf data.tar.*
mv opt/wine-devel $CD/wine/$v
ls -l $CD/wine/
cd ..
rm -rf $CD/wine-download/temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment