1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

UPDATEAVAILABLE="false"
FILELIST=""

curl -s http://store.steampowered.com/public/client/steam_client_linux | grep -i \"file\" | cut -f 4 -d \" > steam.temp
while read FILENAME ; do
  SHORTNAME="${FILENAME%\.*}"
  FILELIST="$FILELIST $SHORTNAME"
  if [[ -e "./$FILENAME" ]] ; then
    echo "Didn't update ${SHORTNAME}"
    continue
  else
    UPDATEAVAILABLE="true"
    echo "Downloading 'http://store.steampowered.com/public/client/$FILENAME' ..."
    wget "http://store.steampowered.com/public/client/$FILENAME"
    rm "$SHORTNAME" &>/dev/null 
    ln -s "$FILENAME" "$SHORTNAME"
  fi
done < steam.temp
rm steam.temp

if [[ "$UPDATEAVAILABLE" == "true" ]] || [[ ! -e ./steam ]]; then
  echo "Updating Steam Client ..."
  if [[ -e "./steam" ]]; then
    echo "The directory './steam' exists. Do you want delete it? (y/n)"
    read answer
    [[ "$answer" != "y" ]] && exit 0
    rm -r ./steam
  fi
  mkdir steam ; cd steam
  for FILENAME in $FILELIST ; do
    unzip -e "../$FILENAME"
  done
  chmod +x steam.sh
  chmod +x linux32/steam
  echo "You can execute './steam/steam.sh' now."
else
  echo "No Steam Client updates available"
  exit 0
fi