Skip to content

Commit 7c88cc2

Browse files
committed
JBDS-3862 Platform installer failed to detect Cygwin install with ssh and sftp
Fix adds detection for cygwin, openssh and rsync packages
1 parent 5ab02c0 commit 7c88cc2

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

browser/model/cygwin.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Downloader from './helpers/downloader';
1010
import Logger from '../services/logger';
1111
import Installer from './helpers/installer';
1212
import VirtualBoxInstall from './virtualbox';
13+
import Util from './helpers/util';
1314

1415

1516
class CygwinInstall extends InstallableItem {
@@ -28,11 +29,32 @@ class CygwinInstall extends InstallableItem {
2829
this.addOption('install',this.version,'',true);
2930
}
3031

32+
isSkipped() {
33+
let t = this.selectedOption === 'detected';
34+
return t;
35+
}
36+
3137
static key() {
3238
return 'cygwin';
3339
}
3440

35-
checkForExistingInstall() {
41+
detectExistingInstall(cb = new function(){}) {
42+
let cygwinPackageRegex = /cygwin\s*(\d+\.\d+\.\d+)/,
43+
opensshPackageReqex = /openssh\s*(\d+\.\d+)/,
44+
rsyncPackageRegex = /rsync\s*(\d+\.\d+\.\d+)/;
45+
Util.executeCommand('cygcheck -c cygwin openssh rsync').then((out)=>{
46+
let cygwinVersion = cygwinPackageRegex.exec(out)[1];
47+
let opensshVersion = opensshPackageReqex.exec(out)[1];
48+
let rsyncVersion = rsyncPackageRegex.exec(out)[1];
49+
this.addOption('detected','','',true);
50+
this.option['detected'].version = cygwinVersion;
51+
this.selectedOption = 'detected';
52+
cb();
53+
}).catch((error)=>{
54+
this.addOption('install',this.version,path.join(this.installerDataSvc.installRoot,'cygwin'),true);
55+
this.addOption('different','','',false);
56+
cb(error);
57+
});
3658
}
3759

3860
downloadInstaller(progress, success, failure) {

browser/pages/confirm/confirm.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,20 @@
124124
</div>
125125

126126
<!-- Cygwin -->
127-
<div id="cygwin-panel" class="panel panel-default panel2pxborder" ng-class="{'zero-border':checkboxModel.cygwin.hasOption('detected')}">
127+
<div id="cygwin-panel" class="panel panel-default panel2pxborder" ng-class="{'zero-border': checkboxModel.cygwin.hasOption('detected') && checkboxModel.cygwin.selectedOption === 'detected'}">
128128
<div class="panel-heading panel-normal"
129-
ng-class="{'dotted-panel':checkboxModel.cygwin.hasOption('detected')}">
129+
ng-class="{'dotted-panel':checkboxModel.cygwin.hasOption('detected') && checkboxModel.cygwin.selectedOption === 'detected'}">
130130
<!--ng-click="checkboxModel.cygwin.changeIsCollapsed()">-->
131-
<div class="checkbox-container verticalLine" ng-show="!checkboxModel.cygwin.hasOption('detected')">
132-
<input type="checkbox" ng-disabled="checkboxModel.cdk.selectedOption == 'install'" ng-model="checkboxModel.cygwin.selectedOption" aria-label="Toggle ngHide" class="vallign-middle" ng-true-value="'install'" ng-false-value="'detected'">
131+
<div class="checkbox-container verticalLine">
132+
<input type="checkbox" ng-disabled="!checkboxModel.cygwin.hasOption('detected') && checkboxModel.cdk.selectedOption == 'install'" ng-model="checkboxModel.cygwin.selectedOption" aria-label="Toggle ngHide" class="vallign-middle" ng-true-value="'install'" ng-false-value="'detected'">
133133
</div>
134134
<div class="checkbox-container" ng-show="false">
135135
<div id="arrow-cygwin" class="arrow" ng-class="{'arrow-down':!checkboxModel.cygwin.isCollapsed}" aria-label="Toggle ngHide"></div>
136136
</div>
137137
<div class="product-container">
138-
<span class="installed-note" ng-show="checkboxModel.cygwin.hasOption('detected')"><i class="fa fa-check"></i> Existing installation found</span>
138+
<span id="cygwin-installed-note" class="installed-note" ng-show="checkboxModel.cygwin.hasOption('detected') && checkboxModel.cygwin.selectedOption === 'detected'">
139+
<i class="fa fa-check"></i> Using detected version {{checkboxModel.cygwin.option['detected'].version}}
140+
</span>
139141
<span id="cygwin-name" class="product-name">{{checkboxModel.cygwin.productName}}</span><span id="cygwin-version" class="product-version">{{checkboxModel.cygwin.version}}</span>
140142
<div id="cygwin-description">{{checkboxModel.cygwin.productDesc}}</div>
141143
</div>

browser/pages/confirm/controller.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ConfirmController {
4949
return $scope.checkboxModel.cdk.selectedOption;
5050
},(nVal,oVal)=>{
5151
if(nVal=='install') {
52-
$scope.checkboxModel.cygwin.selectedOption = 'install';
52+
5353
if($scope.checkboxModel.vagrant.selectedOption == 'detected'
5454
&& !$scope.checkboxModel.vagrant.hasOption('detected')) {
5555
$scope.checkboxModel.vagrant.selectedOption = 'install';
@@ -58,6 +58,11 @@ class ConfirmController {
5858
&& !$scope.checkboxModel.virtualbox.hasOption('detected')) {
5959
$scope.checkboxModel.virtualbox.selectedOption = 'install';
6060
}
61+
if($scope.checkboxModel.cygwin.selectedOption == 'detected'
62+
&& !$scope.checkboxModel.cygwin.hasOption('detected')) {
63+
// force to install included version
64+
$scope.checkboxModel.cygwin.selectedOption = 'install';
65+
}
6166
}
6267
});
6368

@@ -80,7 +85,9 @@ class ConfirmController {
8085
$scope.checkboxModel.virtualbox.detectExistingInstall(()=> {
8186
$scope.checkboxModel.vagrant.detectExistingInstall(()=> {
8287
$scope.checkboxModel.jdk.detectExistingInstall(()=> {
83-
confCtrl.setIsDisabled();
88+
$scope.checkboxModel.cygwin.detectExistingInstall(()=> {
89+
confCtrl.setIsDisabled();
90+
});
8491
});
8592
});
8693
});

0 commit comments

Comments
 (0)