This is the mail archive of the
mailing list for the Cygwin project.
Re: Upload: bash-3.0-4 [test]
- From: ericblake at comcast dot net (Eric Blake)
- To: cygwin-apps at cygwin dot com
- Date: Tue, 05 Jul 2005 19:52:02 +0000
- Subject: Re: Upload: bash-3.0-4 [test]
> > Or, I could first do "cygcheck /bin/sh.exe", and see if "Error: could
> > not find <libname>.dll" appears in the output [...]
> Or even just test -f...
"test -f /bin/sh.exe" checks whether /bin/sh exists. From there,
"cygcheck /bin/sh.exe" and parsing the output for "Error: could not find"
checks whether attempting to run sh would cause a popup box. (Too
bad cygcheck exit status doesn't currently work). So, how about this,
which only runs /bin/sh --version if cygcheck found no missing
# Update /bin/sh to be this version of bash if it is missing, ash,
# older bash, or un-runnable. Leave it alone if it is anything else.
test -x /bin/sh.exe || running=no # missing executable
case `cygcheck /bin/sh.exe` in
*Error:\ could\ not\ find*) running=no;; # missing library
test $running = yes && case `/bin/sh.exe --version 2>&1` in
Illegal\ option\ --*) ;; # ash
GNU\ bash*) ;; # possibly-older version of bash
*) update=no ;; # leave anything else alone
test $update = yes && ln -f /bin/bash.exe /bin/sh.exe
This works even on the upgrade path that Igor originally complained
about, without requiring a separate preremove. Users wanting to
completely uninstall cygwin already have enough other files which
setup.exe won't remove, that leaving a dangling /bin/sh won't be
any worse than the status quo.