shell: add explicit bash() function

This commit is contained in:
Girish Ramakrishnan
2024-10-16 10:25:07 +02:00
parent d66db8ca40
commit df5ba25010
10 changed files with 46 additions and 63 deletions

View File

@@ -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(`ssh-keygen -m PEM -t ${keyType} -f ${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key -q -N ""`, { shell: '/bin/bash' }));
const [error] = await safe(shell.spawn('ssh-keygen', ['-m', 'PEM', '-t', keyType, '-f', `${paths.SFTP_KEYS_DIR}/ssh_host_${keyType}_key`, '-q', '-N', ''], {}));
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);
@@ -124,7 +124,7 @@ async function start(existingInfra) {
await docker.deleteContainer('sftp');
debug('startSftp: starting sftp container');
await shell.exec(runCmd, { shell: '/bin/bash' });
await shell.bash(runCmd, {});
}
async function status() {