mirror of
https://github.com/crazy-max/ghaction-import-gpg.git
synced 2024-11-06 05:35:51 -05:00
Fix homedir
This commit is contained in:
parent
95b2df2352
commit
c263b24136
2 changed files with 12 additions and 4 deletions
7
dist/index.js
generated
vendored
7
dist/index.js
generated
vendored
|
@ -1110,7 +1110,7 @@ const fs = __importStar(__webpack_require__(747));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const exec = __importStar(__webpack_require__(807));
|
const exec = __importStar(__webpack_require__(807));
|
||||||
exports.agentConfig = `default-cache-ttl 1
|
exports.agentConfig = `default-cache-ttl 7200
|
||||||
max-cache-ttl 31536000
|
max-cache-ttl 31536000
|
||||||
allow-preset-passphrase`;
|
allow-preset-passphrase`;
|
||||||
exports.getVersion = () => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getVersion = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
@ -1199,7 +1199,10 @@ exports.getKeygrip = (fingerprint) => __awaiter(void 0, void 0, void 0, function
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
exports.configureAgent = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.configureAgent = (config) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const { homedir: homedir } = yield exports.getDirs();
|
let homedir = path.join(process.env.HOME || '', '.gnupg');
|
||||||
|
if (os.platform() == 'win32') {
|
||||||
|
homedir = path.join(process.env.USERPROFILE || '', '.gnupg');
|
||||||
|
}
|
||||||
const gpgAgentConf = path.join(homedir, 'gpg-agent.conf');
|
const gpgAgentConf = path.join(homedir, 'gpg-agent.conf');
|
||||||
yield fs.writeFile(gpgAgentConf, config, function (err) {
|
yield fs.writeFile(gpgAgentConf, config, function (err) {
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as exec from './exec';
|
import * as exec from './exec';
|
||||||
|
|
||||||
export const agentConfig = `default-cache-ttl 1
|
export const agentConfig = `default-cache-ttl 7200
|
||||||
max-cache-ttl 31536000
|
max-cache-ttl 31536000
|
||||||
allow-preset-passphrase`;
|
allow-preset-passphrase`;
|
||||||
|
|
||||||
|
@ -111,11 +111,16 @@ export const getKeygrip = async (fingerprint: string): Promise<string> => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const configureAgent = async (config: string): Promise<void> => {
|
export const configureAgent = async (config: string): Promise<void> => {
|
||||||
const {homedir: homedir} = await getDirs();
|
let homedir: string = path.join(process.env.HOME || '', '.gnupg');
|
||||||
|
if (os.platform() == 'win32') {
|
||||||
|
homedir = path.join(process.env.USERPROFILE || '', '.gnupg');
|
||||||
|
}
|
||||||
|
|
||||||
const gpgAgentConf = path.join(homedir, 'gpg-agent.conf');
|
const gpgAgentConf = path.join(homedir, 'gpg-agent.conf');
|
||||||
await fs.writeFile(gpgAgentConf, config, function (err) {
|
await fs.writeFile(gpgAgentConf, config, function (err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
await exec.exec(`gpg-connect-agent "RELOADAGENT" /bye`, [], true).then(res => {
|
await exec.exec(`gpg-connect-agent "RELOADAGENT" /bye`, [], true).then(res => {
|
||||||
if (res.stderr != '' && !res.success) {
|
if (res.stderr != '' && !res.success) {
|
||||||
throw new Error(res.stderr);
|
throw new Error(res.stderr);
|
||||||
|
|
Loading…
Reference in a new issue