* Svend Sorensen (2005-10-25 23:59 +0100) > On 10/25/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> I would like to be able to have a portable version of cygwin in my Flash >> Drive. >> I have been able to do it but it requires that I enter some registry entries >> such as: >> >> [HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/] >><snip> > > Here are the batch files I use. In their current state, they must > exist in the parent directory of the cygwin root, which must be named > "cygwin". > > install.bat backs up the current cygwin mount table, then creates a > new table for the removable device. It uses the users Windows %TEMP% > dir for /tmp, because I wanted to minimize writes to the flash disk. > > uninstall.bat removes the new mount table, and restores the backed up copy. > > --begin install.bat-- > [...] > --begin uninstall.bat-- > [...] > --end uninstall.bat--
Wow, that's cute. I recently wrote a python script to do the same thing but that batch solution is much simpler (and better): I tried to "improve" your script a bit. This is the result. (For the record I've included my Python script also)... *** BEWARE: this overwrites all Cygwin settings in the registry *** (it's meant for the average internet cafe user) *** the script *has* to be on the usb drive/stick @ echo off set MOUNT=\cygwin\bin\mount -X -f -u -b REM \cygwin\bin\umount -c REM \cygwin\bin\umount -A reg delete "hklm\software\cygnus solutions" /f > nul 2>&1 reg delete "hkcu\software\cygnus solutions" /f > nul 2>&1 %MOUNT% --change-cygdrive-prefix /cygdrive %MOUNT% %~d0\cygwin/bin /usr/bin %MOUNT% %~d0\cygwin/lib /usr/lib %MOUNT% %~d0\cygwin / %MOUNT% %TEMP% /tmp %MOUNT% %TEMP% /usr/tmp %MOUNT% %TEMP% /var/tmp ********** import codecs, \ os, \ re regfile = r'\data\config\cygwin.reg' # '"native"="E:\\cygwin"' for instance match = r'(?<="native"=")[A-Z]:(?=\\\\cygwin)' newdrive = os.path.splitdrive(os.getcwd())[0] # 'ascii' for non unicode reg files myfile = codecs.open(regfile, 'r', 'utf_16') content = myfile.read() myfile = codecs.open(regfile, 'w', 'utf_16') myfile.write(re.sub(match, newdrive, content)) myfile.close() os.system('regedit /s %s' % regfile) -- 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/