fixup various shell usage
This commit is contained in:
10
src/sftp.js
10
src/sftp.js
@@ -34,7 +34,7 @@ async function ensureKeys() {
|
||||
debug(`ensureSecrets: generating new sftp keys of type ${keyType}`);
|
||||
safe.fs.unlinkSync(publicKeyFile);
|
||||
safe.fs.unlinkSync(privateKeyFile);
|
||||
const [error] = await safe(shell.exec('ensureKeys', `ssh-keygen -m PEM -t ${keyType} -f "${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key" -q -N ""`, {}));
|
||||
const [error] = await safe(shell.exec('ensureKeys', `ssh-keygen -m PEM -t ${keyType} -f ${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key -q -N ""`, { shell: '/bin/bash' }));
|
||||
if (error) throw new BoxError(BoxError.OPENSSL_ERROR, `Could not generate sftp ${keyType} keys: ${error.message}`);
|
||||
const newPublicKey = safe.fs.readFileSync(publicKeyFile);
|
||||
await blobs.set(`sftp_${keyType}_public_key`, newPublicKey);
|
||||
@@ -122,9 +122,11 @@ async function start(existingInfra) {
|
||||
--label isCloudronManaged=true \
|
||||
${readOnly} -v /tmp -v /run ${image} ${cmd}`;
|
||||
|
||||
// ignore error if container not found (and fail later) so that this code works across restarts
|
||||
await safe(shell.exec('stopSftp', 'docker stop sftp', {})); // ignore error
|
||||
await safe(shell.exec('removeSftp', 'docker rm -f sftp', {})); // ignore error
|
||||
debug('startSftp: stopping and deleting previous sftp container');
|
||||
await docker.stopContainer('sftp');
|
||||
await docker.deleteContainer('sftp');
|
||||
|
||||
debug('startSftp: starting sftp container');
|
||||
await shell.exec('startSftp', runCmd, { shell: '/bin/bash' });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user