File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
modules/post/linux/manage Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,22 @@ def search_http_client
82
82
@ssl_option = "--no-check-certificate"
83
83
return
84
84
end
85
+ end
85
86
87
+ def search_shell
88
+ print_status ( "Checking if bash exists in the path..." )
89
+ if exists_exe? ( "bash" )
90
+ print_good ( "bash available, using it" )
91
+ @shell = "bash"
92
+ return
93
+ end
94
+
95
+ print_status ( "Checking if sh exists in the path..." )
96
+ if exists_exe? ( "sh" )
97
+ print_good ( "sh available, using it" )
98
+ @shell = "sh"
99
+ return
100
+ end
86
101
end
87
102
88
103
def run
@@ -93,10 +108,17 @@ def run
93
108
return
94
109
end
95
110
111
+ search_shell
112
+
113
+ if not @shell
114
+ print_warning ( "neither bash nor sh available in the $PATH, aborting..." )
115
+ return
116
+ end
117
+
96
118
if datastore [ 'URL' ] . match ( /https/ )
97
- cmd_exec_vprint ( "`which #{ @http_client } ` #{ @stdout_option } #{ @ssl_option } #{ datastore [ 'URL' ] } 2>/dev/null | `which bash ` " )
119
+ cmd_exec_vprint ( "`which #{ @http_client } ` #{ @stdout_option } #{ @ssl_option } #{ datastore [ 'URL' ] } 2>/dev/null | `which #{ @shell } ` " )
98
120
else
99
- cmd_exec_vprint ( "`which #{ @http_client } ` #{ @stdout_option } #{ datastore [ 'URL' ] } 2>/dev/null | `which bash ` " )
121
+ cmd_exec_vprint ( "`which #{ @http_client } ` #{ @stdout_option } #{ datastore [ 'URL' ] } 2>/dev/null | `which #{ @shell } ` " )
100
122
end
101
123
end
102
124
You can’t perform that action at this time.
0 commit comments