#!/bin/bash

if [ ! -f "sevnz.dll" ] || [ ! -f "sevnz.exe" ]
then
svloc=$(wget "http://7-zip.org/" -O - | grep --ignore-case "a href=\"http://downloads.sourceforge.net/sevenzip/" | grep -v ".msi" | grep -v "x64" | tail -n 1 | tr "<" "\n" | tr ">" "\n" | tr "\"" "\n" | grep "http://downloads.sourceforge.net/sevenzip/")
wget "$svloc" -O sevenzip.exe
svxloc=$(echo "$svloc" | sed 's/.exe/_extra.7z/')
wget "$svxloc" -O sevenzip-extra.7z
7z e -y sevenzip.exe 7z.exe 7z.dll
mv 7z.exe sevnz.exe
mv 7z.dll sevnz.dll
7z e -y sevenzip-extra.7z 7zS.sfx
fi
