Cygwin silent install

サクっと。

追記: 2011/04/29
ダウンロードしたパッケージはキャッシュされるのでインストールディレクトリ\pkgに保存するようにしてみた。\etcにもあるっぽいけどどうなのこれ?
ついでにperlとかrubyはActive*系を使いたいので除去。
さらにバッチファイルにして自動化をしてみた。

追記2: 2011/04/29
変数指定が間違ってたのとicaclsに変更してみた。

@echo off

set PACKAGE=openssh,keychain,zsh,screen

%~dp0setup.exe -q -n -D -L -s "http://ftp.jaist.ac.jp/pub/cygwin" -l "%SystemDrive%\ProgramUser\Cygwin\pkg" -R "%SystemDrive%\ProgramUser\Cygwin" -P "%PACKAGE%"

icacls "%SystemDrive%\ProgramUser\Cygwin\tmp" /grant :(F) Everyone:F /grant Users:(F) /grant "Authenticated Users:(F)"
icacls "%SystemDrive%\ProgramUser\Cygwin\var\tmp" /grant :(F) Everyone:(F) /grant Users:(F) /grant "Authenticated Users:(F)"

setx SHELL "/bin/zsh"

copy %~dp0setup.exe "%SystemDrive%\ProgramUser\Cygwin"
copy %~dp0mintty.exe "%SystemDrive%\ProgramUser\Cygwin\bin"

%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Cygwin     /         ntfs     binary,noacl,override     0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Cygwin/bin /usr/bin  ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Cygwin/lib /usr/lib  ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Perl64     /perl     ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Python     /python   ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Ruby       /ruby     ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Git        /git      ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/MinGW      /mingw    ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%SystemDrive%/ProgramUser/Vim        /vim      ntfs     binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "none                                 /cygdrive cygdrive binary,noacl,posix=0,user 0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "%HOMEDRIVE%/Users                    /home     some_fs  binary,noacl              0 0" >> "%SystemDrive%\ProgramUser\Cygwin\etc\fstab"

%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "" >> "%SystemDrive%\ProgramUser\Cygwin\etc\profile"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "# System wide configuration PATH" >> "%SystemDrive%\ProgramUser\Cygwin\etc\profile"
%SystemDrive%\ProgramUser\Cygwin\bin\echo.exe "export PATH=/perl/bin:/python:/ruby/bin:/vim:${PATH}:/mingw/bin:/git/bin" >> "%SystemDrive%\ProgramUser\Cygwin\etc\profile"

%SystemDrive%\ProgramUser\Cygwin\bin\ash.exe -c "/bin/env TMP=/tmp /bin/env TEMP=/tmp /bin/rebaseall -v"

exit