|
| 1 | +import { normalize as normalizePath } from "path"; |
1 | 2 | import { getContentAsString } from "../../extractor";
|
2 | 3 | import { ExtractAction, ExtractedLayers } from "../../extractor/types";
|
3 | 4 | import { streamToString } from "../../stream-utils";
|
4 | 5 | import { OsReleaseFilePath } from "../../types";
|
5 | 6 |
|
6 | 7 | const getOsReleaseAction: ExtractAction = {
|
7 | 8 | actionName: "os-release",
|
8 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Linux, |
| 9 | + filePathMatches: (filePath) => |
| 10 | + filePath === normalizePath(OsReleaseFilePath.Linux), |
9 | 11 | callback: streamToString,
|
10 | 12 | };
|
11 | 13 |
|
12 | 14 | const getFallbackOsReleaseAction: ExtractAction = {
|
13 | 15 | actionName: "os-release-fallback",
|
14 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.LinuxFallback, |
| 16 | + filePathMatches: (filePath) => |
| 17 | + filePath === normalizePath(OsReleaseFilePath.LinuxFallback), |
15 | 18 | callback: streamToString,
|
16 | 19 | };
|
17 | 20 |
|
18 | 21 | const getLsbReleaseAction: ExtractAction = {
|
19 | 22 | actionName: "lsb-release",
|
20 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Lsb, |
| 23 | + filePathMatches: (filePath) => |
| 24 | + filePath === normalizePath(OsReleaseFilePath.Lsb), |
21 | 25 | callback: streamToString,
|
22 | 26 | };
|
23 | 27 |
|
24 | 28 | const getDebianVersionAction: ExtractAction = {
|
25 | 29 | actionName: "debian-version",
|
26 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Debian, |
| 30 | + filePathMatches: (filePath) => |
| 31 | + filePath === normalizePath(OsReleaseFilePath.Debian), |
27 | 32 | callback: streamToString,
|
28 | 33 | };
|
29 | 34 |
|
30 | 35 | const getAlpineReleaseAction: ExtractAction = {
|
31 | 36 | actionName: "alpine-release",
|
32 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Alpine, |
| 37 | + filePathMatches: (filePath) => |
| 38 | + filePath === normalizePath(OsReleaseFilePath.Alpine), |
33 | 39 | callback: streamToString,
|
34 | 40 | };
|
35 | 41 |
|
36 | 42 | const getRedHatReleaseAction: ExtractAction = {
|
37 | 43 | actionName: "redhat-release",
|
38 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.RedHat, |
| 44 | + filePathMatches: (filePath) => |
| 45 | + filePath === normalizePath(OsReleaseFilePath.RedHat), |
39 | 46 | callback: streamToString,
|
40 | 47 | };
|
41 | 48 |
|
42 | 49 | const getCentosReleaseAction: ExtractAction = {
|
43 | 50 | actionName: "centos-release",
|
44 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Centos, |
| 51 | + filePathMatches: (filePath) => |
| 52 | + filePath === normalizePath(OsReleaseFilePath.Centos), |
45 | 53 | callback: streamToString,
|
46 | 54 | };
|
47 | 55 |
|
48 | 56 | const getOracleReleaseAction: ExtractAction = {
|
49 | 57 | actionName: "oracle-release",
|
50 |
| - filePathMatches: (filePath) => filePath === OsReleaseFilePath.Oracle, |
| 58 | + filePathMatches: (filePath) => |
| 59 | + filePath === normalizePath(OsReleaseFilePath.Oracle), |
51 | 60 | callback: streamToString,
|
52 | 61 | };
|
53 | 62 |
|
|
0 commit comments