Skip to content

Commit

Permalink
feat: install old platforms on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
alkoleft committed Nov 17, 2024
1 parent 4410b4d commit 46a78db
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 23 deletions.
30 changes: 20 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/tools/oneGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OneGet extends OnecTool {
platform = 'darwin'
extension = 'tar.gz'
}
const installerPath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const installerPath = this.getInstallersPath()
await io.rmRF(installerPath)

const archivePath = `${installerPath}/oneget.${extension}`
Expand All @@ -49,7 +49,7 @@ class OneGet extends OnecTool {
} else if (this.isMac()) {
extension = 'tar.gz'
}
const onegetPath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}/oneget.${extension}`
const onegetPath = `${this.getInstallersPath()}/oneget.${extension}`

let oneGetFolder
if (this.isWindows()) {
Expand Down
8 changes: 6 additions & 2 deletions src/tools/onecTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ export abstract class OnecTool implements IOnecTools {
}
}

protected getInstallersPath(): string {
return `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
}

protected async handleLoadedCache(): Promise<void> {
await this.updatePath()
}

async restoreInstallationPackage(): Promise<string | undefined> {
const primaryKey = this.computeInstallerKey()

const restorePath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const restorePath = this.getInstallersPath()
const matchedKey = await restoreCasheByPrimaryKey([restorePath], primaryKey)

await this.handleLoadedCache()
Expand Down Expand Up @@ -93,7 +97,7 @@ export abstract class OnecTool implements IOnecTools {
async saveInstallerCache(): Promise<void> {
try {
await cache.saveCache(
[`/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`],
[this.getInstallersPath()],
this.computeInstallerKey()
)
} catch (error) {
Expand Down
23 changes: 15 additions & 8 deletions src/tools/platform83.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Platform83 extends OnecTool {
architecture: 'x64',
type: installerType
},
`/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`,
this.getInstallersPath(),
true
)

Expand All @@ -54,7 +54,7 @@ export class Platform83 extends OnecTool {
? 'setup-full'
: '*.deb'

const path = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const path = this.getInstallersPath()
const patterns = [`${path}/**/${installerPattern}*`]
const globber = await glob.create(patterns.join('\n'))
const files = await globber.glob()
Expand All @@ -71,12 +71,19 @@ export class Platform83 extends OnecTool {
'client_thin,client_thin_fib,ws'
])
} else if (this.isLinux()) {
await exec('sudo', [
'dpkg',
'-i',
'--force-all',
`${path}/1c-enterprise83*-{common,server,thin-client,client}_*.deb`
])
for await (const mask of [
'-common_',
'-server_',
'-thin-client_',
'-client_'
]) {
await exec('sudo', [
'dpkg',
'-i',
'--force-all',
`'${path}/1c-enterprise83*-${mask}_*.deb'`
])
}
} else if (this.isWindows()) {
await exec(files[0], [
'/l',
Expand Down

0 comments on commit 46a78db

Please sign in to comment.