On 10/24/06, Newton Robinson  wrote:
I see your point.  Has anyone created a distribution for a Flash Drive?  Has
anyone created a start script that will remount for any Windows system?  I
have seen a couple older posts talking about compressed executables (upx I
think), but no follow-ups.

I use the following bat files to set up the required Cygwin mounts.
The bat files must exist in a directory which contains a Cygwin
installation under cygwin.  For example, the set up could be:

Flash drive as F:
F:\install.bat - Set up user Cygwin mounts, backing up any existing mounts
F:\uninstall.bat - Remove Cygwin mounts and restore previous mounts
F:\run.bat - Run bash
F:\cygwin - Cygwin installation

The bat files do not assume any specific drive letter.

I have the install script set up to mount the directory containing the
scripts as /home/user, then run.bat sets HOME to /home/user.  The
user's Windows TEMP folder is mounted as /tmp, to reduce writes the
flash drive.

I had to rename the .bat files to .txt to get Gmail to accept them as
attachments.

> Svend Sorensen wrote:
> You can also install Cygwin to a flash
> drive.  Making it portable takes a few extra steps (basically you set
> up a bat file which adds the Cygwin mounts to the new computer).
@echo off
rem Cygwin installation script
rem
rem This script sets up the mount table for a Cygwin installation under
rem .\cygwin.  Existing mounts are backed up to %TEMP%\cygwin-mounts.  If
rem this file exists, it is not overwritten.  To force this script to run,
rem remove any existing cygwin-mounts file.
rem
rem All mounts are user mounts, which override system mounts.
rem
rem To undo the installation, run uninstall.bat.  Uninstalling should return
rem all Cygwin mounts to their previous settings.  However, this script does
rem not back up the previous setting for the cygdrive path.

set WD=%~dp0

set CYGWIN_ROOT=%WD%\cygwin
set CYGWIN_BIN=%CYGWIN_ROOT%\bin

rem If cygwin-mounts exists, installation has already been run
if not exist %TEMP%\cygwin-mounts (
        rem Back up Cygwin mounts to file
        %CYGWIN_BIN%\mount -m > %TEMP%\cygwin-mounts

        rem Remove all user mounts
        %CYGWIN_BIN%\umount -A

        rem Mount standard Cygwin directories (binary, force, user)
        %CYGWIN_BIN%\mount -b -f -u %CYGWIN_ROOT% /
        %CYGWIN_BIN%\mount -b -f -u %CYGWIN_ROOT%\bin /usr/bin
        %CYGWIN_BIN%\mount -b -f -u %CYGWIN_ROOT%\lib /usr/lib

        rem Use user temp directory as /tmp
        %CYGWIN_BIN%\mount -b -f -u %TEMP% /tmp

        rem Use %WD% as home/user
        %CYGWIN_BIN%\mount -b -f -u %WD% /home/user

        rem Change the cygdrive path
        %CYGWIN_BIN%\mount -b -u -c "/cygdrive"
)
@echo off
rem Cygwin uninstallation script
rem
rem This script removes current mounts and restores backed up mounts.  Backed
rem up mounts are restored from the file %TEMP%\cygwin-mounts (if it exists).
rem There must be a working Cygwin installation under %cd%\cygwin.
rem
rem This script is designed to undo the installation done by install.bat.

set WD=%~dp0

set CYGWIN_ROOT=%WD%\cygwin
set CYGWIN_BIN=%CYGWIN_ROOT%\bin

rem Restore backed up mounts (if a mount backup file exist)
if exist %TEMP%\cygwin-mounts (
        rem Remove all user mounts
        %CYGWIN_BIN%\umount -U

        rem Remove the user cygdrive path
        rem The previous setting for the the cygdrive path was not saved, so 
leave the
        rem new setting intact.
        rem %CYGWIN_BIN%\umount -u -c

        rem Get POSIX path for mount command to use in backup script
        for /F %%A in ('%CYGWIN_BIN%\cygpath "%CYGWIN_BIN%\mount"') do set 
MOUNT=%%A

        rem Run backup script, with "mount" replaced with its full path
        %CYGWIN_BIN%\sed "s:mount:%MOUNT%:" %TEMP%\cygwin-mounts | 
%CYGWIN_BIN%\sh

        rem Remove backup script file
        del %TEMP%\cygwin-mounts
)
@echo off
rem Start a bash login shell

set WD=%~dp0

set CYGWIN_ROOT=%WD%\cygwin
set CYGWIN_BIN=%CYGWIN_ROOT%\bin

rem Start a bash shell
rem SHELL defaults to /bin/sh
%CYGWIN_BIN%\env HOME=/home/user SHELL=bin/bash /bin/bash -l -i
--
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/

Reply via email to