Remote borging kit

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
edit: Files are now uploaded and linked. Have at it!
edit2: Switched files over to new ISP.
edit3: unhappy_mage has written a graphical installer (for the console client) which is linked later in this thread: here This is better for your non-technical friends. The source is available, so you can change the defaults to help make sure your friends fold for you.

I recently instituted a new policy for anyone whose computer I help fix. Among requirements like using Firefox, patching every month, etc, I install (with permission of course) F@H on their box. Folding under my name, natch.

I came upon a problem: my limited-computer-skills sister lives 1500 miles away, and I don't trust her to set up F@H correctly. So I created a kit including a registry file, a client.cfg, and the F@H client. I wrote a batch file to create a F@H directory, copy the necessary files (fah client + client.cfg) there, add the registry entry, and then delete all the install files. I cannot hold a candle to the coding/config skills of someone like unhappy_mage, but consider this my small contribution to the Windows folders out there.

Here are the instructions.
1) create a new directory for all the files you will need (4 total)
2) download the batch file and the reg file into this directory
3) copy your client.cfg (Sample) into this directory (you may want to make adjustments, i.e. timeless if needed)
4) put a copy of FAH502-Console.exe in the directory
5) zip everything up
Send it to everybody you know! Oh, wait, you can't redistribute the client either. At least not legally. So...tell your friends to download F@H and send them the other 3 files.

Notes:
What do your borgee friends have to do?
1) unzip the files so that all 4 are in the same directory
2) double-click fah.bat
The way this works, it requires a reboot before it runs as a service. Even after the batch file runs, Windows doesn't see the F@H service until it reboots, and F@H won't run with the -svcstart tag from the command line. If you know how to fix this, please let me know.
The batch file's pretty simple. Feel free to open it, inspect it, make sure it doesn't do nasty things, poke it with a stick, and generally ridicule it.

 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
"net start FAH-whatever" will start it. I forget exactly what the name of the service is. Windows people?

 

Kvothe

[H]ard|DCer of the Month - October 2006
Joined
Sep 27, 2004
Messages
8,702
net start "FAH@C:+Path:FAH502-Console.exe"

Replace with the appropriate drive letter and path in that syntax using "+" instead of "\" and you should be good, although that would be more appropriately suited to using a standalone installer which is prohibited by Stanford.

 

budec

Gawd
Joined
Jul 10, 2002
Messages
748
How do you change the Reg file?

Basically I got a duel setup so I run two clients:

C:\fah\1
C::\fah\2

I have a .cmd in C:\fah\start.cmd that launches both clients (running out of differant directories)... manually this works good... but how to I launch C:\fah\start.cmd as a service (and hide the FAH consoles?)
 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
I have a .cmd in C:\fah\start.cmd that launches both clients (running out of differant directories)... manually this works good... but how to I launch C:\fah\start.cmd as a service (and hide the FAH consoles?)
You need a registry entry for each instance. Each instance should also run with the -local flag, and each client.cfg should have a unique machineID (1, 2, ...)

The easy way to do this is to run
FAH502-Console.exe -local -configonly
from each directory. Set a different ID for each one, and tell each one to run as a service. Then go into the services thingamabobber and make sure that each instance will run with the -local and -svcstart flags.
 

marty9876

[H]ard|DCer of the Month - February 2006
Joined
Jun 11, 2003
Messages
4,905
Kinda sounds like you need a one click. Never used one, but ocforums has these for everything possible I think.

D/L theirs, change it to what you want and done.
 

budec

Gawd
Joined
Jul 10, 2002
Messages
748
I'm working on a Win32 borging script. It's one cmd (batch) file.

So far I have it so that when you double click it, it detects number of CPUs, downloads FAH, configures it and let's it run. :) So if you have 1 CPU, it'll run once, if you have 4 CPUs it'll run 4 times.

Just have to firgure out how to get the service stuff working, am going to play with that tomorrow.

The batch file will be less then 5,000 bytes when I'm done with it. I'm going to put it on a web server... if someone wants to borg a workstation, they give the URL to the person, open it and it does everything else.

Here is the work in progress:
http://63.231.238.227/~bud/fah/fah_install.cmd
in fire fox just do a "save page as"

I still need to do a lot of things and clean it up a bit. But basically the way it works:

1. gives disclaimer :p
2. Sets up base directories
3. checks for wget locally, if not avaiable it downloads it
(wget info: http://www.gnu.org/software/wget/wget.html)
4. checks for FAH client locally, if not avaiable it downloads it
5. checks for client configs locally, if not avaiable it downloads them

Basically you could put everything on a floppy (wget, client configs) and stuff it in the drive and double click, or you could modify it (to point to configs on your web server) and then just double click it.

Basically I want it to work so that if you have the "fah_install.cmd" file, you run it and it does everything for you (without needing anything besides the fah_install.cmd file.

The idea being, if I'm at my sisters house or my parents, I just have to remember the URL of the fah_install.cmd and not worry about configuring it or setting it up or just send them the .cmd file though email.

To do:
Dynamic configs... make it so that it creates the configs optimized for the workstation your borging.... it takes number of CPUs into account, but would also like it to consider memory and if it has SSE or not, etc..

Automatic startup.

Uninstaller (for now just delete everything from C:\FAH_TEST and delete fah_install.cmd)

I've tested it under Windows XP Pro... it might have problems with 98/ME, I don't have access to any to test it on. I'll test Win2K in a bit.



Any suggestions or feedback?
 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
Ok, budec's put me to shame. However, I think I can help you, budec, with the whole download-wget-and-download-fah thing. There's a way to do it without having to go through internet explorer. I'll see if I can put together a java app that'll do the same thing as the script--except with no user input required. I'll make the source code available, naturally, for anyone to tweak. I'll also see if I can turn it into a native app, so it doesn't rely on the end user having java installed.
 

budec

Gawd
Joined
Jul 10, 2002
Messages
748
unhappy_mage said:
http://nsis.sourceforge.net/

Someone take a look at this. I tried it a while ago but got distracted by something shiny.

Thanks!

I took a look at it breifly, but the scripting launage looks kinda horrid.. I wish it was more C/C++ syntax, it's kinda ulgy :p hehe, I'll give it a more indepth look when I get time.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
It is pretty horrid... I figured out how to do the replace \ with + thing, though; here's code:
Add this to the "-Post" Section:
Code:
  ; Write proper reg key.  For example, installing FAH in C:\fah with a console name of
  ; FAH502-Console.exe should produce subkeys in:
  ; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FAH@C:+fah+FAH502-Console.exe
  Push $INSTDIR
  Push "\"
  Push "+"
  Call StrRep
  Pop "$R0" ;result
  WriteRegStr HKLM "SYSTEM\CurrentControlSet\Services\FAH@$R0" "ImagePath" "$INSTDIR\$CONSOLENAME -forceasm -svcstart"
;  MessageBox MB_OK "Writing reg entry at SYSTEM\CurrentControlSet\Services\$R0, with contents $INSTDIR\$CONSOLENAME -forceasm -svcstart"
and put this anywhere at the end:
Code:
; Originally from "dirtydingus".  Thanks!

Function StrRep
  Exch $R4 ; $R4 = Replacement String
  Exch
  Exch $R3 ; $R3 = String to replace (needle)
  Exch 2
  Exch $R1 ; $R1 = String to do replacement in (haystack)
  Push $R2 ; Replaced haystack
  Push $R5 ; Len (needle)
  Push $R6 ; len (haystack)
  Push $R7 ; Scratch reg
  StrCpy $R2 ""
  StrLen $R5 $R3
  StrLen $R6 $R1
loop:
  StrCpy $R7 $R1 $R5
  StrCmp $R7 $R3 found
  StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  StrCpy $R2 "$R2$R7"
  StrCpy $R1 $R1 $R6 1
  StrCmp $R1 "" done loop
found:
  StrCpy $R2 "$R2$R4"
  StrCpy $R1 $R1 $R6 $R5
  StrCmp $R1 "" done loop
done:
  StrCpy $R3 $R2
  Pop $R7
  Pop $R6
  Pop $R5
  Pop $R2
  Pop $R1
  Pop $R4
  Exch $R3
FunctionEnd
Note that I still need to figure out a good way to get $CONSOLENAME defined. I could just make a static variable definition, but that's not very futureproof; I'd have to release a new version every time they updated FAH. The compiler will warn about this.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
Well, I figured it out again; I'd post code in tags here, but I'm completely lost as to what's really used code and what's just junk. So, here's a link for the source and the EXE.

A note for those who actually READ eula's; I'm not redistributing Stanford's client. Just a very explicit, machine-readable, method of getting it from them. From what I've gathered at their forums, this is allowed. Anyone with information otherwise, post or PM and it will come down immediately. I have no intention of violating their license.

Enjoy! :D :D
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455

A little update... I've been working on it some more. Eventually I'll even get all those buttons knobs and switches working instead of sitting there looking pretty :p

It works fine under the 3 themes I've tried - Windows Classic, Windows XP, and the Panther theme. I like the look of the panther best, though:

Now I want a Mac...

 

AtomicMoose

[H]F Junkie
Joined
Sep 26, 2001
Messages
11,803
unhappy_mage said:

A little update... I've been working on it some more. Eventually I'll even get all those buttons knobs and switches working instead of sitting there looking pretty :p

It works fine under the 3 themes I've tried - Windows Classic, Windows XP, and the Panther theme. I like the look of the panther best, though:

Now I want a Mac...

That is sweet looking...you have outdone yourself, mag
 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
I guess I won't have that weekend project...
I just had one suggestion: What would be nice would be a companion program--one that allows you to create a custom installer with the fields already filled in. So I could run the companion program, input my username and team 33 and whatever other configs I want to, and it will generate (or tweak) the installer. Then I can take this custom installer and send it to everybody I know.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
Mohonri said:
I guess I won't have that weekend project...
I just had one suggestion: What would be nice would be a companion program--one that allows you to create a custom installer with the fields already filled in. So I could run the companion program, input my username and team 33 and whatever other configs I want to, and it will generate (or tweak) the installer. Then I can take this custom installer and send it to everybody I know.
The easiest way to do this would be to have a NSI file with constants at the top to change, and then compile it. I'll try to integrate this functionality into the same project.

Has anyone tried the version up right now? It doesn't work very well, but I'd like to know if it gets FAH properly for other people...

 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
Mohonri said:
I guess I won't have that weekend project...
I didn't mean to steal your cheerios or pee on your thunder... Feel free to work on/improve/fix this or start your own. A little competition will help both in the long run ;)

http://www.filefarmer.com/unhappymage/setup-fold.exe
http://www.filefarmer.com/unhappymage/setup-fold-renametonsi.txt

Latest. The problem I ran into, unfortunately, is that FAH doesn't recognize "<" notation to take its input from a file. Can any windows people help me out? What I need to do is this:
FAH502-Console.exe -configonly < a_temp_file
and have it read the answers from it. However, "cmd" isn't running it, so it isn't recognising the syntax. Any answers for a poor lost linux guy?

The best way to test command lines is to run them from the start->run dialog. This doesn't start a cmd, in the same way that NSIS doesn't. So, if you get this to work in Run, it'll work for me. Here was my best guess at how to run it:
cmd /k "'D:\Program Files\Folding@Home\FAH502-Console.exe' -configonly < 'D:\Documents and Settings\will.DRAGON\Local Settings\Temp\nsw77AA.tmp'"
but no luck :(

:confused:

Edit: This Schlock Mercenary strip is the reference in the first paragraph. It's not a great place to start reading, but it's my favorite one ever. There are like five jokes, and they're all funny. They're "smart jokes", but not completely out there.

 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
The easiest way to do this would be to have a NSI file with constants at the top to change, and then compile it. I'll try to integrate this functionality into the same project.
Well, since I don't know squat about NSI files or anything associated with them, I guess I have something new to work on when I have a slow day at work. I don't know that I'll be able to add anything, but we'll see what I can learn. Keep up the great work!

Edit:
Mage, can you point me in the direction of a "NSI files for dummies"-type of page?
 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
Latest. The problem I ran into, unfortunately, is that FAH doesn't recognize "<" notation to take its input from a file. Can any windows people help me out? What I need to do is this:
FAH502-Console.exe -configonly < a_temp_file
Why don't you just avoid that whole mess and just generate the client.cfg file yourself? All you get when you run FAH502-Console.exe -configonly is a generated client.cfg and (optionally) the registry entry, as far as I know. Correct me if I'm wrong.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
http://nsis.sourceforge.net/wiki/Main_Page
This covers all the external things you can do (user functions, libraries)
http://hmne.sourceforge.net/
The help file for this covers all the builtin functions. These are fairly limited (no if/else, for example :eek: ) but they cover the bases.

WRT generating the client.cfg myself, that's easy enough, but I don't know how to manually add all the registry keys needed. I do know how to modify the one reg key in order to add "-forceasm", but I don't know what (for example) the Security key (HKLM\SYSTEM\CurrentControlSet\Services\FAH@Wherever\Security\Security) represents or comes from or needs to be set to. Your example .reg file has a different one than I have, so it's not a constant.

So basically, I can make the client.cfg fine, but the registry entries are beyond me.

 

marty9876

[H]ard|DCer of the Month - February 2006
Joined
Jun 11, 2003
Messages
4,905
unhappy_mage said:
http://nsis.sourceforge.net/wiki/Main_Page
This covers all the external things you can do (user functions, libraries)
http://hmne.sourceforge.net/
The help file for this covers all the builtin functions. These are fairly limited (no if/else, for example :eek: ) but they cover the bases.

WRT generating the client.cfg myself, that's easy enough, but I don't know how to manually add all the registry keys needed. I do know how to modify the one reg key in order to add "-forceasm", but I don't know what (for example) the Security key (HKLM\SYSTEM\CurrentControlSet\Services\FAH@Wherever\Security\Security) represents or comes from or needs to be set to. Your example .reg file has a different one than I have, so it's not a constant.

So basically, I can make the client.cfg fine, but the registry entries are beyond me.

One of my guys makes me .vbs for reg hacks. You can take mine apart if intrested. PM me if you want it.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
marty9876 said:
One of my guys makes me .vbs for reg hacks. You can take mine apart if intrested. PM me if you want it.
Well, it's not so much that I don't know how to write reg keys, but that I don't know what to put in them... the Stanford client puts some weird values in, and I don't know if Windows needs these or if FAH needs these or if they're encrypted pr0n or what. Guess I'll have to ask on the Stanford forum.

 

budec

Gawd
Joined
Jul 10, 2002
Messages
748
unhappy_mage said:
Well, it's not so much that I don't know how to write reg keys, but that I don't know what to put in them... the Stanford client puts some weird values in, and I don't know if Windows needs these or if FAH needs these or if they're encrypted pr0n or what. Guess I'll have to ask on the Stanford forum.


On the Win32 Console client, you slap the config in and run the client from the same directory... it'll read in the config and use those vaules. No reg values needed for console client (if there are reg values then the client adds it after it reads it from the config file).

don't use -configonly.

1. Create config. Put config in $DIRECTORY
2. copy client to $DIRECTORY
3. start client
4. ??
5. profit!



 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
Right, but there *are* reg values required for the service.

FAKE EDIT
W00t! Figured it out! Secret: make a batch file and have cmd run that! Full installer and source will be up when Filefarmer comes back up...

 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
unhappy_mage said:
Right, but there *are* reg values required for the service.

FAKE EDIT
W00t! Figured it out! Secret: make a batch file and have cmd run that! Full installer and source will be up when Filefarmer comes back up...

The only reg files I've seen are the following:

The one to run the service - Pretty safe putting it in ControlSet001. In the command line, it's just a REGEDIT /S <registry key file>
The userID key - created by the client when it first contacts stanford. You don't need to add this one.

I know there is one other (LEGACY), but its absence does not seem to have any ill effect.
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
It does BUT I haven't been able to upload it. Filefarmer is *still* down.

Mirror space anyone?

 

Mohonri

Supreme [H]ardness
Joined
Jul 29, 2005
Messages
5,751
I'm willing to mirror it on my piddly earthlink account if you want. PM if interested.
 

84gthatch

[H]ard|Gawd
Joined
Jan 7, 2004
Messages
1,207
i would be happy to host it up to 5 gigs of transfer a month worth :cool:


lemmie know e-mail = william at ahpathfinders.com
 

84gthatch

[H]ard|Gawd
Joined
Jan 7, 2004
Messages
1,207
i am gonna i just haven't yet i was just going through the source file and was looking at it
 

CaptRingold

Limp Gawd
Joined
Feb 12, 2005
Messages
256
Beatiful; borging made easy. Stick that on the usb stick on my keychain, and whenever i drop by a friends place, borg before they have time to ask a ton of questions like what exactly a service is, why i'm answering all these questions in an old-skool DOS-ish window, etc, etc. Just, "Hey, this helps humanity, you'll never know it was there, bro."

:D :D :D :D

I've got a short list of apps that I make sure are up todate weekly on the usb stick, from anti-virus to firewall to antispyware, a couple recovery tools, etc. This'll definitely become another permanent resident.

You guys are great.

 

budec

Gawd
Joined
Jul 10, 2002
Messages
748
Heya unhappy_mage, I like this, it's really slick. I'm one of the guys giving ya a mirror.... anyways just wanted to give you some feed back:

I installed this out on a Dualie Xeon 3.0Ghz, 2 gigs of ram running WinXP Pro (service pack 1) and noticed a couple problems.

1) It didn't create the config file from what I seen... it had the FAHClient in C:\program files\Folding@home, but no config file.

2) I checked "install as service", but didn't see any service in the Admin Tools->Services menu

3) FAH was never started.... do I have to manually start it?

4) The graphic check boxes in the installer where all "smashed together" and hard to read (problem with the installer package, something they would have to fix)


I know it will probably take some magic to get working, but sure unhappy_mage can work it out... even if he's unhappy, he's still a mage :)
 

unhappy_mage

[H]ard|DCer of the Month - October 2005
Joined
Jun 29, 2004
Messages
11,455
Hooo kay... Sounds like there are a few issues here and there.

1) Is anything in that directory?
2) What do you see when you look in regedit at HKLM\SYSTEM\CurrentControlSet\Services\FAH@Wherever?
3) The service would've taken care of this if it had worked...
4) Yep, they are. They looked fine on the Mac theme, but on standard widgets they suck. Curse you, pixel-based layout!

Sorry about the problems, I'll try to work on it. I have too much time on my hands before classes start anyways.

 
Top