Skip to content

Commit 3a0eefe

Browse files
committed
feature: use lsb_release to identify distro id
This should make this action usable on any debian-based distros.
1 parent 78abdce commit 3a0eefe

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

dist/main/index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -62353,6 +62353,13 @@ async function lsb_release() {
6235362353
}
6235462354
return _lsb_release;
6235562355
}
62356+
let _lsb_release_id;
62357+
async function lsb_release_id() {
62358+
if (!_lsb_release_id) {
62359+
_lsb_release_id = capture('lsb_release -i -s', { silent: true });
62360+
}
62361+
return _lsb_release_id;
62362+
}
6235662363
let _httpc;
6235762364
async function http_get(url) {
6235862365
if (!_httpc) {
@@ -62425,7 +62432,9 @@ function construct_base_url() {
6242562432
}
6242662433
async function available_versions(version_prefix) {
6242762434
const baseUrl = construct_base_url();
62428-
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release());
62435+
const distro = await lsb_release();
62436+
const distro_id = (await lsb_release_id()).toLowerCase();
62437+
const repo = baseUrl + '/' + distro_id + '/dists/' + distro;
6242962438
// Don't return 1.10.10, when the version prefix is 1.10.1.
6243062439
const prefix = version_prefix ? version_prefix + '.' : '';
6243162440
return http_get(`${repo}/main/binary-amd64/Packages`)
@@ -62465,6 +62474,7 @@ exports.latest_version = latest_version;
6246562474
async function run_linux() {
6246662475
try {
6246762476
const distro = await lsb_release();
62477+
const distro_id = (await lsb_release_id()).toLowerCase();
6246862478
const cache_dir = 'cache-tarantool';
6246962479
const baseUrl = construct_base_url();
6247062480
core.startGroup(`Checking latest tarantool ${tarantool_version} version`);
@@ -62496,7 +62506,7 @@ async function run_linux() {
6249662506
});
6249762507
await core.group('Setting up repository', async () => {
6249862508
await exec.exec('sudo tee /etc/apt/sources.list.d/tarantool.list', [], {
62499-
input: Buffer.from(`deb ${baseUrl}/ubuntu/ ${distro} main\n`)
62509+
input: Buffer.from(`deb ${baseUrl}/${distro_id}/ ${distro} main\n`)
6250062510
});
6250162511
});
6250262512
await core.group('Running apt-get update', async () => {

src/main.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ async function lsb_release(): Promise<string> {
4040
return _lsb_release
4141
}
4242

43+
let _lsb_release_id: Promise<string>
44+
async function lsb_release_id(): Promise<string> {
45+
if (!_lsb_release_id) {
46+
_lsb_release_id = capture('lsb_release -i -s', {silent: true})
47+
}
48+
49+
return _lsb_release_id
50+
}
51+
4352
let _httpc: httpm.HttpClient
4453
async function http_get(url: string): Promise<httpm.HttpClientResponse> {
4554
if (!_httpc) {
@@ -119,7 +128,9 @@ async function available_versions(
119128
version_prefix: string
120129
): Promise<Array<string>> {
121130
const baseUrl = construct_base_url()
122-
const repo = baseUrl + '/ubuntu/dists/' + (await lsb_release())
131+
const distro = await lsb_release()
132+
const distro_id = (await lsb_release_id()).toLowerCase()
133+
const repo = baseUrl + '/' + distro_id + '/dists/' + distro
123134

124135
// Don't return 1.10.10, when the version prefix is 1.10.1.
125136
const prefix = version_prefix ? version_prefix + '.' : ''
@@ -162,6 +173,7 @@ export async function latest_version(version_prefix: string): Promise<string> {
162173
async function run_linux(): Promise<void> {
163174
try {
164175
const distro = await lsb_release()
176+
const distro_id = (await lsb_release_id()).toLowerCase()
165177
const cache_dir = 'cache-tarantool'
166178
const baseUrl = construct_base_url()
167179

@@ -197,7 +209,7 @@ async function run_linux(): Promise<void> {
197209

198210
await core.group('Setting up repository', async () => {
199211
await exec.exec('sudo tee /etc/apt/sources.list.d/tarantool.list', [], {
200-
input: Buffer.from(`deb ${baseUrl}/ubuntu/ ${distro} main\n`)
212+
input: Buffer.from(`deb ${baseUrl}/${distro_id}/ ${distro} main\n`)
201213
})
202214
})
203215

0 commit comments

Comments
 (0)