Classic Shell
http://www.classicshell.net/forum/

ftp site?
http://www.classicshell.net/forum/viewtopic.php?f=7&t=2918
Page 1 of 1

Author:  Todd [ Thu Jul 03, 2014 1:32 pm ]
Post subject:  ftp site?

Hi All,

I am trying to write a bash script to download Classic Shell when a new revision gets posted. The web site has some funny business on it that keeps me from being able to download it directly with wget. Do you have an ftp site I can use?

Many thanks,
-T

Author:  Ivo [ Thu Jul 03, 2014 2:21 pm ]
Post subject:  Re: ftp site?

How will you plan to detect when there is a new version?

Author:  Todd [ Thu Jul 03, 2014 2:44 pm ]
Post subject:  Re: ftp site?

Ivo wrote:
How will you plan to detect when there is a new version?


I am sneaky.

Code:
GetClassicShell () {
   # Status: 0 = unknown (default)
   #       1 = no update found
   #       2 = update found
   #       3 = error
   
   RtnState=0
   OldFileName=""

   NotifySound
   WorkingDir="/home/CDs/Windows/W8/ClassicShell"
   if [ ! -d $WorkingDir ]; then  mkdir $WorkingDir; fi
   cd $WorkingDir
   BaseName="ClassicShellSetup"
   Extension="exe"
   RevAddr="http://www.classicshell.net/"
   DownloadAddr="$RevAddr"

   # Turn off any read only tags
   chmod -R 766 ${BaseName}*.${Extension}; chown -R tony.users ${BaseName}*.${Extension}

   OldRev="$(ls $WorkingDir/           | \
          grep -v -i "WebSite.txt"   | \
          grep -v -i "currentversion"  | \
          grep $BaseName         | \
          sed -e 's/^..*-//'       | \
          sed -e "s/.$Extension*$//"   | \
          sort -r              | \
          sed -n 1,1p)"

   OldFileName="$WorkingDir/$BaseName-$OldRev.$Extension"

   ClickHere="$(wget --quiet "$RevAddr" -O -   | \
          grep "The latest version of Classic Shell is" | \
          sed -n '1p'            | \
          awk -F 'href="' '{print $2}' | \
          awk -F '">' '{print $1}')"

   LatestRev="$(echo $ClickHere            | \
         awk -F "_" '{print $2 "." $3 "." $4}' | \
         sed -e 's/.exe//')"

and so on and so forth ...

Author:  Ivo [ Thu Jul 03, 2014 10:56 pm ]
Post subject:  Re: ftp site?

Accessing the main page frequently (especially if it is done by thousands of people) will put extra load on the website.

You should use the auto-update feature. It will pop up if there is a new version and will offer to download it. It will also verify the download to prevent malicious spoofing.

Author:  Todd [ Fri Jul 04, 2014 2:42 pm ]
Post subject:  [solved]Re: ftp site?

Ivo wrote:
Accessing the main page frequently (especially if it is done by thousands of people) will put extra load on the website.

You should use the auto-update feature. It will pop up if there is a new version and will offer to download it. It will also verify the download to prevent malicious spoofing.


Actually no. This bash script is part of a 2000+ line script that goes out and downloads various utilities, drivers, etc. for a stick I carry to customer sites. I could not possible keep up with all the revision changes if I had to do it all manually.

I do not use Classic Shell on my own virtual machine copy of Frankenstein (Windows 8) as I need to be able to see what my customers (who don't ask me first) see when they first get their Frankenstein computers. So, the autoupdate feature does not apply to me.

First thing I do when I get to a customer suffering from Frankenstein is to put Classic Shell on it with their permission. They are EXTREMELY appreciative. As such I need to carry the latest version around with me. (My stick has a read-only switch so I don't catch and spread viruses.)

This would be a lot easier on me if you had an ftp site to download from. If not, how do I get around the recurrsive loop problem trying to download with wget from your web site?

Many thanks,
-T

Edit: figured out how to wget to download it: add "--referer=http://www.classicshell.net/downloads/latest" to the run string.

wget --referer=http://www.classicshell.net/ http://www.classicshell.net/downloads/latest


Love the utility. Thank you for sharing it with us!
-T

Author:  Ivo [ Fri Jul 04, 2014 4:35 pm ]
Post subject:  Re: ftp site?

Try using this link: www.classicshell.net/downloads/latest

Author:  Todd [ Fri Jul 04, 2014 6:09 pm ]
Post subject:  Re: ftp site?

Ivo wrote:


wget downloads it under the name of "latest", but not a problem:

NewFileName="$WorkingDir/$BaseName-$LatestRev.$Extension"
wget http://www.classicshell.net/downloads/latest --output-document "${NewFileName}"

gets around it just fine.

I have ClassicShell spread over two counties now. Customers are tickled with it. Thank you for helping me with this. Let me know if you would like to see the entire subroutine.
-T

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/