From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24287 invoked by alias); 18 Sep 2006 20:53:55 -0000 Received: (qmail 24271 invoked by uid 22791); 18 Sep 2006 20:53:53 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Sep 2006 20:53:50 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GPQ7V-0006Ai-RS for cygwin@cygwin.com; Mon, 18 Sep 2006 22:53:38 +0200 Received: from 71.86.121.26 ([71.86.121.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Sep 2006 22:53:37 +0200 Received: from mikee by 71.86.121.26 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Sep 2006 22:53:37 +0200 To: cygwin@cygwin.com From: Mike Subject: Re: cygwin installation batch file? Date: Mon, 18 Sep 2006 20:53:00 -0000 Message-ID: References: <003001c6da6d$d4bc2bb0$c700a8c0@mikep4pc> User-Agent: slrn/0.9.8.1 (Linux) X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2006-09/txt/msg00353.txt.bz2 On 2006-09-17, Mike Verstegen wrote: > > First, a few apologies... > - I just joined this mailing list, so this reply is cobbled > together using the original message from the archives. > - Though I've used cygwin for several years as an administrative > user, I'm brand new to using cygwin in any complex ways > - I'm not at all skilled at Windows batch files (this is my first one...) > > With that said, I have a similar need to what (the other) Mike needed > to do -- namely the ability to install cygwin in a "batch" mode, preferably > from > an autostart CD. My goal is to have ssh running at the completion. > > In particular, the problem I tried to address was how to install something > other than the set of packages that setup.exe chooses by default. > > After searching the archives, I found two suggested approaches: > > - Igor suggested that one could have one dummy package in the "Base" > category and make it depend on everything you want. > http://sourceware.org/ml/cygwin-apps/2005-05/msg00244.html > > - Fergus' approach was to create a "template" installed.db listing > only those packages you want, with the version numbers of each set to zero. > For example > rxvt rxvt-0.tar.bz2 0 > tar tar-0.tar.bz2 0 > Setup.exe will find this file and update each listed package to the > current (non-zero) version. > http://marc.theaimsgroup.com/?l=cygwin&m=110538795118459&w=2 > > Since making the dummy package in setup.ini would require some magic > to edit setup.ini (downloaded fresh with each execution of setup.exe??) > on the fly that I couldn't quite figure out how to do, I chose the latter > approach. > > With the goal of getting sshd completely up and running, I used the > procedure described at http://pigtail.net/LRP/printsrv/cygwin-sshd.html > and attempted to turn it in to a batch file. > > One tool that I could not find in cygwin was a way to set the Windows > System Environment variables. For ssh it looks like both PATH and CYGWIN > need to be updated/created. To get this done, I used setenv.exe > from http://barnyard.syr.edu/~vefatica/ which looks quite old, is only > available as an executable (ouch!), but solved the immediate problem. > Suggestions welcome on how to do this better. > > The following batch file is intended (haven't actually done the CD part yet) > to be put on a CD containing the following files: > - cygwin_inst.bat -- the following file > - setup.exe -- the cygwin set up program > - setenv.exe -- the program described previously to set environment > variables > - to_be_installed.db -- the list of packages desired, with the versions set > to zero > > >=========== begin batch file ============= > rem -- Batch install file for cygwin > rem -- MDV 9/16/06 > rem > rem -- To set system environment variables (PATH, CYGWIN), this script > depends on > rem -- setenv.exe from http://barnyard.syr.edu/%7Evefatica > rem -- which is used instead of Microsoft setx (which is in a Windows > resource pack) > rem -- because of possible MS licensing restrictions on copying to an > install CD. > rem -- There may be a better way to do this! > > rem -- CYG_MIRROR is the URL of a public or private server from where cygwin > can be downloaded. > rem -- This particular site works, but necessarily the best one... to do... > rem -- the http:// is important > > set CYG_MIRROR="http://www.signal42.com" > > mkdir c:\cygwin > > rem -- Assume that setup.exe and setenv.exe are in the working directory on > the CD when started > rem -- Copy executables from CD to disk > > copy setup.exe c:\cygwin > copy setenv.exe c:\cygwin > > rem -- Now put a hand-crafted installed.db in cygwin's /etc/setup > rem -- This installed.db has the list of packages desired with the revision > level set to zero > rem -- as suggested by Fergus in > http://marc.theaimsgroup.com/?l=cygwin&m=110538795118459&w=2 > rem -- For example > rem -- openssh openssh-0.tar.bz2 0 > > > if exist c:\cygwin\etc\setup\installed.db ( > echo "cygwin already installed" > goto end > ) else ( > mkdir c:\cygwin\etc > mkdir c:\cygwin\etc\setup > copy to_be_installed.db c:\cygwin\etc\setup\installed.db > ) > > rem -- Instead of "goto end", above, do something more appropriate > rem -- Future work: compare the list of packages in our target > to_be_installed.db to the list of > rem -- packages already in /etc/setup/installed.db to make sure that all > the packages that we want > rem -- are included. If not, merge them in with the rev level set to zero. > > rem -- #UNTESTED bash code > rem -- CURRENT_INSTALLED=/etc/setup/installed.db > rem -- TO_BE_INSTALLED=to_be_installed.db > rem -- cat $TO_BE_INSTALLED | while read > rem -- do > rem -- if grep $1 $CURRENT_INSTALLED > rem -- then > rem -- echo "Package " $1 " already included" > rem -- else > rem -- echo $0 >> $CURRENT_INSTALLED > rem -- echo "Added: " $0 > rem -- fi > rem -- DOES INSTALLED.DB NEED TO BE SORTED? > ` > c: > cd \cygwin > > rem -- Now we can finally run setup. Though this will show a status window, > no user interaction > rem -- is required. > > setup --quiet-mode --site %CYG_MIRROR% --no-shortcuts --no-desktop > > > rem -- Now set the Windows System environment variable PATH and CYGWIN as > noted in > rem -- http://pigtail.net/LRP/printsrv/cygwin-sshd.html > > setenv -m PATH "%PATH%;\cygwin\bin" > setenv -m CYGWIN "ntsec tty" > > rem -- Add our new cygwin tools to the path for the remainder of this shell > set PATH=%PATH%;\cygwin\bin;\cygwin\usr\bin > > > rem -- In the following lines, use double quotes to insure that Windows will > not parse the > rem -- file redirection > symbols (Windows found the > inside single > quotes) > > bash.exe -c "/usr/bin/mkpasswd --local > /etc/passwd" > bash.exe -c "/usr/bin/mkgroup --local > /etc/group" > > > rem -- Suggestion to include "tty" in CYGWIN environment variable at > rem -- http://pigtail.net/LRP/printsrv/tty.html > rem -- How does the --cygwin option interact with the setenv CYGWIN above? > > bash.exe -c "/usr/bin/ssh-host-config --yes --cygwin NTSEC" > > net start sshd > >:end > rem -- cleanup > rm /setenv.exe >============== end of batch file ================= > > Well that's my attempt. It seems to work (I'm not sure I could have ever > tested this without Vmware...). Comments welcome. > > Mike > > ________________________________________ > . From: Mike > . To: cygwin at cygwin dot com > . Date: Tue, 12 Sep 2006 00:55:55 +0000 (UTC) > . Subject: cygwin installation batch file? >
> I have used cygwin for many years and now am in a situation > where I need/want to install it on 30 or so windows xp boxes. > Does someone have a batch file I can adapt to my situation? > I've started on one at work (no access to it at the moment) > that attempts to copy setup.exe from a local mirror I've > created, c:, mkdir \cygwin, cd \cygwin, copy \\host\cygwin\setup.exe, > and then I get into a problem trying to get setup.exe to run. > > The command (at work, so I'm going from memory) I'm trying to use > is 'setup.exe --download --site http://host/cygwin --no-shortcuts > --no-desktop perl rsync cvs ssh cygserv'. I am following up the > installation with cd bin, bash.exe --login -i -c '/usr/bin/mkpasswd > --local > /etc/passwd', bash --login -i -c '/usr/bin/mkgroup > --local > /etc/group', bash ... wait, this is confusing... > > ---------------------------------- > c: > mkdir \cygwin > cd \cygwin > copy \\host\cygwin\setup.exe > setup --download --site http://host/cygwin --no-shortcuts \ > --no-desktop perl rsync cvs ssh cygserv > bash.exe --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd > bash.exe --login -i -c '/usr/bin/mkgroup --local > /etc/group > bash.exe --login -i -c '/usr/bin/ssh-keygen' > bash.exe --login -i -c '/usr/bin/ssh-host-config --yes' > net start sshd > ---------------------------------- > > That's what I've tried so far (from memory). Does someone have > a script that does the above and works? :) > > Mike > > > My script so far is below. On the client/receiving machine run the below script. Mike ----------------------------------------------------------- @rem $Id$ @rem $Log$ @rem install cygwin on the current/local windows computer @host=elo @c: @mkdir \cygwin @cd \cygwin @echo copying cygwin setup.exe @copy \\%host%\cygwin\setup.exe @echo starting the cygwin install @setup.exe --download --site http://elo/cygwin --root c:\cygwin --quiet-mode --no-shortcuts --no-startmenu @cd \cygwin\bin @echo configuring the sshd host @bash --login -i -c "/usr/bin/ssh-host-config --yes --cygwin 'binmode ntsec tty'" @echo creating the local password file @bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd' @echo creating the local group file @bash --login -i -c '/usr/bin/mkgroup --local > /etc/group' @echo starting sshd @net start sshd ----------------------------------------------------------- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/