deboa 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/classes/Deboa.js +6 -9
- package/dist/cjs/types/classes/Deboa.d.ts +46 -44
- package/dist/cjs/types/classes/DeboaFromFile.d.ts +23 -23
- package/dist/cjs/types/index.d.ts +4 -4
- package/dist/cjs/types/types/IAddTarEntriesParams.d.ts +5 -5
- package/dist/cjs/types/types/IControlFileOptions.d.ts +130 -130
- package/dist/cjs/types/types/IDeboa.d.ts +138 -133
- package/dist/cjs/types/types/IDeboaFromFile.d.ts +8 -8
- package/dist/cjs/types/types/INormalizeOptionsLength.d.ts +8 -8
- package/dist/cjs/types/types/IWriteFileFromLinesArgs.d.ts +10 -10
- package/dist/cjs/types/types/IWriteToArchive.d.ts +19 -19
- package/dist/cjs/types/types/MaintainerScript.d.ts +1 -1
- package/dist/cjs/types/types/Priority.d.ts +1 -1
- package/dist/cjs/types/types/Section.d.ts +1 -1
- package/dist/cjs/types/types/index.d.ts +10 -10
- package/dist/cjs/types/utils/addTarEntries.d.ts +5 -5
- package/dist/cjs/types/utils/changeOwnerToRoot.d.ts +6 -0
- package/dist/cjs/types/utils/createFileHeader.d.ts +2 -2
- package/dist/cjs/types/utils/writeFileFromLines.d.ts +5 -5
- package/dist/cjs/types/utils/writeToArchive.d.ts +5 -5
- package/dist/cjs/utils/changeOwnerToRoot.js +15 -0
- package/dist/esm/classes/Deboa.js +6 -9
- package/dist/esm/types/classes/Deboa.d.ts +46 -44
- package/dist/esm/types/classes/DeboaFromFile.d.ts +23 -23
- package/dist/esm/types/index.d.ts +4 -4
- package/dist/esm/types/types/IAddTarEntriesParams.d.ts +5 -5
- package/dist/esm/types/types/IControlFileOptions.d.ts +130 -130
- package/dist/esm/types/types/IDeboa.d.ts +138 -133
- package/dist/esm/types/types/IDeboaFromFile.d.ts +8 -8
- package/dist/esm/types/types/INormalizeOptionsLength.d.ts +8 -8
- package/dist/esm/types/types/IWriteFileFromLinesArgs.d.ts +10 -10
- package/dist/esm/types/types/IWriteToArchive.d.ts +19 -19
- package/dist/esm/types/types/MaintainerScript.d.ts +1 -1
- package/dist/esm/types/types/Priority.d.ts +1 -1
- package/dist/esm/types/types/Section.d.ts +1 -1
- package/dist/esm/types/types/index.d.ts +10 -10
- package/dist/esm/types/utils/addTarEntries.d.ts +5 -5
- package/dist/esm/types/utils/changeOwnerToRoot.d.ts +6 -0
- package/dist/esm/types/utils/createFileHeader.d.ts +2 -2
- package/dist/esm/types/utils/writeFileFromLines.d.ts +5 -5
- package/dist/esm/types/utils/writeToArchive.d.ts +5 -5
- package/dist/esm/utils/changeOwnerToRoot.js +10 -0
- package/package.json +11 -5
|
@@ -1,133 +1,138 @@
|
|
|
1
|
-
import type { Headers as OriginalTarFSHeader } from 'tar-fs';
|
|
2
|
-
import type { Headers as TarStreamHeader } from 'tar-stream';
|
|
3
|
-
import { IControlFileOptions } from './IControlFileOptions';
|
|
4
|
-
declare type TarFSHeader = OriginalTarFSHeader & Pick<TarStreamHeader, 'uname' | 'gname'>;
|
|
5
|
-
/**
|
|
6
|
-
* @property {IDeboa["additionalTarEntries"]} [additionalTarEntries] -
|
|
7
|
-
* Additional entries to be added to the .tar archive. This is useful for
|
|
8
|
-
* creating symlinks on Windows. See the [Headers]{@link TarStreamHeader}
|
|
9
|
-
* interface from tar-stream for more details. Optional.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @property {IDeboa["beforeCreateDesktopEntry"]} [beforeCreateDesktopEntry] -
|
|
13
|
-
* Runs before the desktop entry file is created, allowing you to add more
|
|
14
|
-
* entries or modify the default entries if necessary. This can be a function
|
|
15
|
-
* or a path to a file that has a function as its default export. Check
|
|
16
|
-
* {@link https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html}
|
|
17
|
-
* for more details. Optional.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @property {IDeboa["beforePackage"]} [beforePackage] -
|
|
21
|
-
* Runs after the control file, maintainer scripts and sourceDir contents
|
|
22
|
-
* are copied to the temporary directory and before they're packaged. Receives
|
|
23
|
-
* the temporary directory path as an argument. This can be a function or a
|
|
24
|
-
* path to a file that has a function as its default export. Optional.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @property {IDeboa["controlFileOptions"]} controlFileOptions -
|
|
28
|
-
* Control file fields.
|
|
29
|
-
* {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html}
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @property {IDeboa["icon"]} [icon] -
|
|
33
|
-
* Path to the image you want to use as your app icon. It is copied to
|
|
34
|
-
* /usr/share/pixmaps. Optional.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @property {IDeboa["installationRoot"]} [installationRoot] -
|
|
38
|
-
* Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @property {IDeboa["modifyTarHeader"]} [modifyTarHeader] -
|
|
42
|
-
* This callback makes it possible to modify file headers before they're
|
|
43
|
-
* written to the .tar archive, which is useful for setting permissions.
|
|
44
|
-
* This can be a function or a path to a file that has a function as its
|
|
45
|
-
* default export. See the [Headers]{@link TarFSHeader} interface from tar-fs
|
|
46
|
-
* and {@link https://github.com/mafintosh/tar-fs/blob/7ec11cb27f93948193770f32b4d820e2e7195715/README.md}
|
|
47
|
-
* for more details. Optional.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @property {IDeboa["sourceDir"]} sourceDir -
|
|
51
|
-
* Location of the files you want to package. **This field is mandatory.**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @property {IDeboa["tarballFormat"]} [tarballFormat] -
|
|
55
|
-
* Sets the format used for storing the files. This impacts the build time
|
|
56
|
-
* and .deb output size. Defaults to `tar.gz`.
|
|
57
|
-
*
|
|
58
|
-
* As a rule of thumb, you can expect the following from each format:
|
|
59
|
-
* - `tar` (no compression): lowest resources usage, faster build time, largest .deb size
|
|
60
|
-
* - `tar.gz` (gzip compression using zlib): low resources usage, good build time, good .deb size
|
|
61
|
-
* - `tar.xz` (xz compression using lzma-native): high resources usage, slowest build time, smallest .deb size
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @property {IDeboa["targetDir"]} targetDir -
|
|
65
|
-
* Directory where your .deb file will be copied to.
|
|
66
|
-
* **This field is mandatory.**
|
|
67
|
-
*/
|
|
68
|
-
export interface IDeboa {
|
|
69
|
-
/**
|
|
70
|
-
* Additional entries to be added to the .tar archive. This is useful for
|
|
71
|
-
* creating symlinks on Windows. See the [Headers]{@link TarStreamHeader}
|
|
72
|
-
* interface from tar-stream for more details. Optional.
|
|
73
|
-
*/
|
|
74
|
-
additionalTarEntries?: TarStreamHeader[];
|
|
75
|
-
/**
|
|
76
|
-
* Runs before the desktop entry file is created, allowing you to add more
|
|
77
|
-
* entries or modify the default entries if necessary. This can be a function
|
|
78
|
-
* or a path to a file that has a function as its default export. Check
|
|
79
|
-
* {@link https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html}
|
|
80
|
-
* for more details. Optional.
|
|
81
|
-
*/
|
|
82
|
-
beforeCreateDesktopEntry?: string | (<T extends Record<string, string>>(desktopEntries: T) => Promise<T> | T);
|
|
83
|
-
/**
|
|
84
|
-
* Runs after the control file, maintainer scripts and sourceDir contents
|
|
85
|
-
* are copied to the temporary directory and before they're packaged. Receives
|
|
86
|
-
* the temporary directory path as an argument. This can be a function or a
|
|
87
|
-
* path to a file that has a function as its default export. Optional.
|
|
88
|
-
*/
|
|
89
|
-
beforePackage?: string | ((tempDir: string) => Promise<void> | void);
|
|
90
|
-
/**
|
|
91
|
-
* Control file fields.
|
|
92
|
-
* {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html}
|
|
93
|
-
*/
|
|
94
|
-
controlFileOptions: IControlFileOptions;
|
|
95
|
-
/**
|
|
96
|
-
* Path to the image you want to use as your app icon. It is copied to
|
|
97
|
-
* /usr/share/pixmaps. Optional.
|
|
98
|
-
*/
|
|
99
|
-
icon?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
|
|
102
|
-
*/
|
|
103
|
-
installationRoot?: string;
|
|
104
|
-
/**
|
|
105
|
-
* This callback makes it possible to modify file headers before they're
|
|
106
|
-
* written to the .tar archive, which is useful for setting permissions.
|
|
107
|
-
* This can be a function or a path to a file that has a function as its
|
|
108
|
-
* default export. See the [Headers]{@link TarFSHeader} interface from tar-fs
|
|
109
|
-
* and {@link https://github.com/mafintosh/tar-fs/blob/7ec11cb27f93948193770f32b4d820e2e7195715/README.md}
|
|
110
|
-
* for more details. Optional.
|
|
111
|
-
*/
|
|
112
|
-
modifyTarHeader?: string | ((header: TarFSHeader) => TarFSHeader);
|
|
113
|
-
/**
|
|
114
|
-
* Location of the files you want to package. **This field is mandatory.**
|
|
115
|
-
*/
|
|
116
|
-
sourceDir: string;
|
|
117
|
-
/**
|
|
118
|
-
* Sets the format used for storing the files. This impacts the build time
|
|
119
|
-
* and .deb output size. Defaults to `tar.gz`.
|
|
120
|
-
*
|
|
121
|
-
* As a rule of thumb, you can expect the following from each format:
|
|
122
|
-
* - `tar` (no compression): lowest resources usage, faster build time, largest .deb size
|
|
123
|
-
* - `tar.gz` (gzip compression using zlib): low resources usage, good build time, good .deb size
|
|
124
|
-
* - `tar.xz` (xz compression using lzma-native): high resources usage, slowest build time, smallest .deb size
|
|
125
|
-
*/
|
|
126
|
-
tarballFormat?: 'tar' | 'tar.gz' | 'tar.xz';
|
|
127
|
-
/**
|
|
128
|
-
* Directory where your .deb file will be copied to.
|
|
129
|
-
* **This field is mandatory.**
|
|
130
|
-
*/
|
|
131
|
-
targetDir: string;
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
import type { Headers as OriginalTarFSHeader } from 'tar-fs';
|
|
2
|
+
import type { Headers as TarStreamHeader } from 'tar-stream';
|
|
3
|
+
import { IControlFileOptions } from './IControlFileOptions';
|
|
4
|
+
declare type TarFSHeader = OriginalTarFSHeader & Pick<TarStreamHeader, 'uname' | 'gname'>;
|
|
5
|
+
/**
|
|
6
|
+
* @property {IDeboa["additionalTarEntries"]} [additionalTarEntries] -
|
|
7
|
+
* Additional entries to be added to the .tar archive. This is useful for
|
|
8
|
+
* creating symlinks on Windows. See the [Headers]{@link TarStreamHeader}
|
|
9
|
+
* interface from tar-stream for more details. Optional.
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @property {IDeboa["beforeCreateDesktopEntry"]} [beforeCreateDesktopEntry] -
|
|
13
|
+
* Runs before the desktop entry file is created, allowing you to add more
|
|
14
|
+
* entries or modify the default entries if necessary. This can be a function
|
|
15
|
+
* or a path to a file that has a function as its default export. Check
|
|
16
|
+
* {@link https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html}
|
|
17
|
+
* for more details. Optional.
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @property {IDeboa["beforePackage"]} [beforePackage] -
|
|
21
|
+
* Runs after the control file, maintainer scripts and sourceDir contents
|
|
22
|
+
* are copied to the temporary directory and before they're packaged. Receives
|
|
23
|
+
* the temporary directory path as an argument. This can be a function or a
|
|
24
|
+
* path to a file that has a function as its default export. Optional.
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* @property {IDeboa["controlFileOptions"]} controlFileOptions -
|
|
28
|
+
* Control file fields.
|
|
29
|
+
* {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html}
|
|
30
|
+
*
|
|
31
|
+
*
|
|
32
|
+
* @property {IDeboa["icon"]} [icon] -
|
|
33
|
+
* Path to the image you want to use as your app icon. It is copied to
|
|
34
|
+
* /usr/share/pixmaps. Optional.
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* @property {IDeboa["installationRoot"]} [installationRoot] -
|
|
38
|
+
* Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @property {IDeboa["modifyTarHeader"]} [modifyTarHeader] -
|
|
42
|
+
* This callback makes it possible to modify file headers before they're
|
|
43
|
+
* written to the .tar archive, which is useful for setting permissions.
|
|
44
|
+
* This can be a function or a path to a file that has a function as its
|
|
45
|
+
* default export. See the [Headers]{@link TarFSHeader} interface from tar-fs
|
|
46
|
+
* and {@link https://github.com/mafintosh/tar-fs/blob/7ec11cb27f93948193770f32b4d820e2e7195715/README.md}
|
|
47
|
+
* for more details. Optional.
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
* @property {IDeboa["sourceDir"]} sourceDir -
|
|
51
|
+
* Location of the files you want to package. **This field is mandatory.**
|
|
52
|
+
*
|
|
53
|
+
*
|
|
54
|
+
* @property {IDeboa["tarballFormat"]} [tarballFormat] -
|
|
55
|
+
* Sets the format used for storing the files. This impacts the build time
|
|
56
|
+
* and .deb output size. Defaults to `tar.gz`.
|
|
57
|
+
*
|
|
58
|
+
* As a rule of thumb, you can expect the following from each format:
|
|
59
|
+
* - `tar` (no compression): lowest resources usage, faster build time, largest .deb size
|
|
60
|
+
* - `tar.gz` (gzip compression using zlib): low resources usage, good build time, good .deb size
|
|
61
|
+
* - `tar.xz` (xz compression using lzma-native): high resources usage, slowest build time, smallest .deb size
|
|
62
|
+
*
|
|
63
|
+
*
|
|
64
|
+
* @property {IDeboa["targetDir"]} targetDir -
|
|
65
|
+
* Directory where your .deb file will be copied to.
|
|
66
|
+
* **This field is mandatory.**
|
|
67
|
+
*/
|
|
68
|
+
export interface IDeboa {
|
|
69
|
+
/**
|
|
70
|
+
* Additional entries to be added to the .tar archive. This is useful for
|
|
71
|
+
* creating symlinks on Windows. See the [Headers]{@link TarStreamHeader}
|
|
72
|
+
* interface from tar-stream for more details. Optional.
|
|
73
|
+
*/
|
|
74
|
+
additionalTarEntries?: TarStreamHeader[];
|
|
75
|
+
/**
|
|
76
|
+
* Runs before the desktop entry file is created, allowing you to add more
|
|
77
|
+
* entries or modify the default entries if necessary. This can be a function
|
|
78
|
+
* or a path to a file that has a function as its default export. Check
|
|
79
|
+
* {@link https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html}
|
|
80
|
+
* for more details. Optional.
|
|
81
|
+
*/
|
|
82
|
+
beforeCreateDesktopEntry?: string | (<T extends Record<string, string>>(desktopEntries: T) => Promise<T> | T);
|
|
83
|
+
/**
|
|
84
|
+
* Runs after the control file, maintainer scripts and sourceDir contents
|
|
85
|
+
* are copied to the temporary directory and before they're packaged. Receives
|
|
86
|
+
* the temporary directory path as an argument. This can be a function or a
|
|
87
|
+
* path to a file that has a function as its default export. Optional.
|
|
88
|
+
*/
|
|
89
|
+
beforePackage?: string | ((tempDir: string) => Promise<void> | void);
|
|
90
|
+
/**
|
|
91
|
+
* Control file fields.
|
|
92
|
+
* {@link https://www.debian.org/doc/debian-policy/ch-controlfields.html}
|
|
93
|
+
*/
|
|
94
|
+
controlFileOptions: IControlFileOptions;
|
|
95
|
+
/**
|
|
96
|
+
* Path to the image you want to use as your app icon. It is copied to
|
|
97
|
+
* /usr/share/pixmaps. Optional.
|
|
98
|
+
*/
|
|
99
|
+
icon?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Directory your files will be installed to. Defaults to `/usr/lib/${packageName}`.
|
|
102
|
+
*/
|
|
103
|
+
installationRoot?: string;
|
|
104
|
+
/**
|
|
105
|
+
* This callback makes it possible to modify file headers before they're
|
|
106
|
+
* written to the .tar archive, which is useful for setting permissions.
|
|
107
|
+
* This can be a function or a path to a file that has a function as its
|
|
108
|
+
* default export. See the [Headers]{@link TarFSHeader} interface from tar-fs
|
|
109
|
+
* and {@link https://github.com/mafintosh/tar-fs/blob/7ec11cb27f93948193770f32b4d820e2e7195715/README.md}
|
|
110
|
+
* for more details. Optional.
|
|
111
|
+
*/
|
|
112
|
+
modifyTarHeader?: string | ((header: TarFSHeader) => TarFSHeader);
|
|
113
|
+
/**
|
|
114
|
+
* Location of the files you want to package. **This field is mandatory.**
|
|
115
|
+
*/
|
|
116
|
+
sourceDir: string;
|
|
117
|
+
/**
|
|
118
|
+
* Sets the format used for storing the files. This impacts the build time
|
|
119
|
+
* and .deb output size. Defaults to `tar.gz`.
|
|
120
|
+
*
|
|
121
|
+
* As a rule of thumb, you can expect the following from each format:
|
|
122
|
+
* - `tar` (no compression): lowest resources usage, faster build time, largest .deb size
|
|
123
|
+
* - `tar.gz` (gzip compression using zlib): low resources usage, good build time, good .deb size
|
|
124
|
+
* - `tar.xz` (xz compression using lzma-native): high resources usage, slowest build time, smallest .deb size
|
|
125
|
+
*/
|
|
126
|
+
tarballFormat?: 'tar' | 'tar.gz' | 'tar.xz';
|
|
127
|
+
/**
|
|
128
|
+
* Directory where your .deb file will be copied to.
|
|
129
|
+
* **This field is mandatory.**
|
|
130
|
+
*/
|
|
131
|
+
targetDir: string;
|
|
132
|
+
/**
|
|
133
|
+
* Filename without the `.deb` extension. Defaults to
|
|
134
|
+
* `${packageName}_${version}_${architecture}`.
|
|
135
|
+
*/
|
|
136
|
+
targetFileName?: string;
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWriteToArchive } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* @property {string} outputFile - Path to the output file.
|
|
4
|
-
*/
|
|
5
|
-
export interface IDeboaFromFile extends Pick<IWriteToArchive, 'isARFile'> {
|
|
6
|
-
/** Path to the output file. */
|
|
7
|
-
outputFile: string;
|
|
8
|
-
}
|
|
1
|
+
import { IWriteToArchive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @property {string} outputFile - Path to the output file.
|
|
4
|
+
*/
|
|
5
|
+
export interface IDeboaFromFile extends Pick<IWriteToArchive, 'isARFile'> {
|
|
6
|
+
/** Path to the output file. */
|
|
7
|
+
outputFile: string;
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface INormalizeOptionLength {
|
|
2
|
-
fileMode?: string | number;
|
|
3
|
-
fileName: string;
|
|
4
|
-
fileSize: string | number;
|
|
5
|
-
groupID?: string | number;
|
|
6
|
-
ownerID?: string | number;
|
|
7
|
-
timestamp?: string | number;
|
|
8
|
-
}
|
|
1
|
+
export interface INormalizeOptionLength {
|
|
2
|
+
fileMode?: string | number;
|
|
3
|
+
fileName: string;
|
|
4
|
+
fileSize: string | number;
|
|
5
|
+
groupID?: string | number;
|
|
6
|
+
ownerID?: string | number;
|
|
7
|
+
timestamp?: string | number;
|
|
8
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @property {string} filePath - Path to the output file.
|
|
3
|
-
* @property {string[]} lines - Lines to be written.
|
|
4
|
-
*/
|
|
5
|
-
export interface IWriteFileFromLinesArgs {
|
|
6
|
-
/** Path to the output file. */
|
|
7
|
-
filePath: string;
|
|
8
|
-
/** Lines to be written. */
|
|
9
|
-
lines: string[];
|
|
10
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @property {string} filePath - Path to the output file.
|
|
3
|
+
* @property {string[]} lines - Lines to be written.
|
|
4
|
+
*/
|
|
5
|
+
export interface IWriteFileFromLinesArgs {
|
|
6
|
+
/** Path to the output file. */
|
|
7
|
+
filePath: string;
|
|
8
|
+
/** Lines to be written. */
|
|
9
|
+
lines: string[];
|
|
10
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type { ReadStream, WriteStream } from 'fs';
|
|
4
|
-
/**
|
|
5
|
-
* @property {Buffer} header - AR header.
|
|
6
|
-
* @property {boolean} [isARFile] - If true, the .deb-specific sections won't be added to the file.
|
|
7
|
-
* @property {readStream} readStream - ReadStream from the input file.
|
|
8
|
-
* @property {WriteStream} writeStream - WriteStream to the output file.
|
|
9
|
-
*/
|
|
10
|
-
export interface IWriteToArchive {
|
|
11
|
-
/** AR header. */
|
|
12
|
-
header: Buffer;
|
|
13
|
-
/** If true, the .deb-specific sections won't be added to the file. */
|
|
14
|
-
isARFile?: boolean;
|
|
15
|
-
/** ReadStream from the input file. */
|
|
16
|
-
readStream: ReadStream;
|
|
17
|
-
/** WriteStream to the output file. */
|
|
18
|
-
writeStream: WriteStream;
|
|
19
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { ReadStream, WriteStream } from 'fs';
|
|
4
|
+
/**
|
|
5
|
+
* @property {Buffer} header - AR header.
|
|
6
|
+
* @property {boolean} [isARFile] - If true, the .deb-specific sections won't be added to the file.
|
|
7
|
+
* @property {readStream} readStream - ReadStream from the input file.
|
|
8
|
+
* @property {WriteStream} writeStream - WriteStream to the output file.
|
|
9
|
+
*/
|
|
10
|
+
export interface IWriteToArchive {
|
|
11
|
+
/** AR header. */
|
|
12
|
+
header: Buffer;
|
|
13
|
+
/** If true, the .deb-specific sections won't be added to the file. */
|
|
14
|
+
isARFile?: boolean;
|
|
15
|
+
/** ReadStream from the input file. */
|
|
16
|
+
readStream: ReadStream;
|
|
17
|
+
/** WriteStream to the output file. */
|
|
18
|
+
writeStream: WriteStream;
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type MaintainerScript = 'preinst' | 'postinst' | 'prerm' | 'postrm';
|
|
1
|
+
export declare type MaintainerScript = 'preinst' | 'postinst' | 'prerm' | 'postrm';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type Priority = 'required' | 'important' | 'standard' | 'optional';
|
|
1
|
+
export declare type Priority = 'required' | 'important' | 'standard' | 'optional';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type Section = 'admin' | 'cli-mono' | 'comm' | 'database' | 'debug' | 'devel' | 'doc' | 'editors' | 'education' | 'electronics' | 'embedded' | 'fonts' | 'games' | 'gnome' | 'gnu-r' | 'gnustep' | 'graphics' | 'hamradio' | 'haskell' | 'httpd' | 'interpreters' | 'introspection' | 'java' | 'javascript' | 'kde' | 'kernel' | 'libdevel' | 'libs' | 'lisp' | 'localization' | 'mail' | 'math' | 'metapackages' | 'misc' | 'net' | 'news' | 'ocaml' | 'oldlibs' | 'otherosfs' | 'perl' | 'php' | 'python' | 'ruby' | 'rust' | 'science' | 'shells' | 'sound' | 'tasks' | 'tex' | 'text' | 'utils' | 'vcs' | 'video' | 'web' | 'x11' | 'xfce' | 'zope' | undefined;
|
|
1
|
+
export declare type Section = 'admin' | 'cli-mono' | 'comm' | 'database' | 'debug' | 'devel' | 'doc' | 'editors' | 'education' | 'electronics' | 'embedded' | 'fonts' | 'games' | 'gnome' | 'gnu-r' | 'gnustep' | 'graphics' | 'hamradio' | 'haskell' | 'httpd' | 'interpreters' | 'introspection' | 'java' | 'javascript' | 'kde' | 'kernel' | 'libdevel' | 'libs' | 'lisp' | 'localization' | 'mail' | 'math' | 'metapackages' | 'misc' | 'net' | 'news' | 'ocaml' | 'oldlibs' | 'otherosfs' | 'perl' | 'php' | 'python' | 'ruby' | 'rust' | 'science' | 'shells' | 'sound' | 'tasks' | 'tex' | 'text' | 'utils' | 'vcs' | 'video' | 'web' | 'x11' | 'xfce' | 'zope' | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './IAddTarEntriesParams';
|
|
2
|
-
export * from './IControlFileOptions';
|
|
3
|
-
export * from './IDeboa';
|
|
4
|
-
export * from './IDeboaFromFile';
|
|
5
|
-
export * from './INormalizeOptionsLength';
|
|
6
|
-
export * from './IWriteFileFromLinesArgs';
|
|
7
|
-
export * from './IWriteToArchive';
|
|
8
|
-
export * from './MaintainerScript';
|
|
9
|
-
export * from './Priority';
|
|
10
|
-
export * from './Section';
|
|
1
|
+
export * from './IAddTarEntriesParams';
|
|
2
|
+
export * from './IControlFileOptions';
|
|
3
|
+
export * from './IDeboa';
|
|
4
|
+
export * from './IDeboaFromFile';
|
|
5
|
+
export * from './INormalizeOptionsLength';
|
|
6
|
+
export * from './IWriteFileFromLinesArgs';
|
|
7
|
+
export * from './IWriteToArchive';
|
|
8
|
+
export * from './MaintainerScript';
|
|
9
|
+
export * from './Priority';
|
|
10
|
+
export * from './Section';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAddTarEntriesParams } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Adds entries to the .tar archive after all the files are packed.
|
|
4
|
-
*/
|
|
5
|
-
export declare function addTarEntries({ entries, pack, }: IAddTarEntriesParams): Promise<void>;
|
|
1
|
+
import { IAddTarEntriesParams } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Adds entries to the .tar archive after all the files are packed.
|
|
4
|
+
*/
|
|
5
|
+
export declare function addTarEntries({ entries, pack, }: IAddTarEntriesParams): Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IDeboa } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures all files/directories in the .tar archive are owned by root,
|
|
4
|
+
* not by the current user when running on Unix or by a invalid user on Windows.
|
|
5
|
+
*/
|
|
6
|
+
export declare const changeOwnerToRoot: Exclude<IDeboa['modifyTarHeader'], string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { INormalizeOptionLength } from '../types';
|
|
2
|
-
export declare function createFileHeader(options: INormalizeOptionLength): string;
|
|
1
|
+
import { INormalizeOptionLength } from '../types';
|
|
2
|
+
export declare function createFileHeader(options: INormalizeOptionLength): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWriteFileFromLinesArgs } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a file from a string array.
|
|
4
|
-
*/
|
|
5
|
-
export declare function writeFileFromLines({ filePath, lines, }: IWriteFileFromLinesArgs): Promise<void>;
|
|
1
|
+
import { IWriteFileFromLinesArgs } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a file from a string array.
|
|
4
|
+
*/
|
|
5
|
+
export declare function writeFileFromLines({ filePath, lines, }: IWriteFileFromLinesArgs): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IWriteToArchive } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
export declare function writeToArchive({ header, isARFile, readStream, writeStream, }: IWriteToArchive): Promise<void>;
|
|
1
|
+
import { IWriteToArchive } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export declare function writeToArchive({ header, isARFile, readStream, writeStream, }: IWriteToArchive): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "changeOwnerToRoot", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>changeOwnerToRoot
|
|
8
|
+
});
|
|
9
|
+
const changeOwnerToRoot = (header)=>{
|
|
10
|
+
header.gname = 'root';
|
|
11
|
+
header.uname = 'root';
|
|
12
|
+
header.gid = 0;
|
|
13
|
+
header.uid = 0;
|
|
14
|
+
return header;
|
|
15
|
+
};
|
|
@@ -10,6 +10,7 @@ import { writeFileFromLines } from '../utils/writeFileFromLines';
|
|
|
10
10
|
import { DeboaFromFile } from './DeboaFromFile';
|
|
11
11
|
import { PassThrough as PassThroughStream } from 'stream';
|
|
12
12
|
import { addTarEntries } from '../utils/addTarEntries';
|
|
13
|
+
import { changeOwnerToRoot } from '../utils/changeOwnerToRoot';
|
|
13
14
|
/**
|
|
14
15
|
* @return IDeboa
|
|
15
16
|
*/ class Deboa {
|
|
@@ -46,6 +47,7 @@ import { addTarEntries } from '../utils/addTarEntries';
|
|
|
46
47
|
/** See {@link IDeboa.sourceDir} */ sourceDir = null;
|
|
47
48
|
/** See {@link IDeboa.tarballFormat} */ tarballFormat = null;
|
|
48
49
|
/** See {@link IDeboa.targetDir} */ targetDir = null;
|
|
50
|
+
/** See {@link IDeboa.targetFileName} */ targetFileName = null;
|
|
49
51
|
#appFolderDestination = null;
|
|
50
52
|
#controlFolderDestination = null;
|
|
51
53
|
#dataFolderDestination = null;
|
|
@@ -95,7 +97,7 @@ import { addTarEntries } from '../utils/addTarEntries';
|
|
|
95
97
|
}
|
|
96
98
|
this.#tempDir = path.join(os.tmpdir(), 'deboa_temp');
|
|
97
99
|
const { architecture , packageName , version } = this.controlFileOptions;
|
|
98
|
-
this.#outputFile = path.join(this.targetDir, `${packageName}_${version}_${architecture}.deb`);
|
|
100
|
+
this.#outputFile = path.join(this.targetDir, `${options.targetFileName || `${packageName}_${version}_${architecture}`}.deb`);
|
|
99
101
|
this.#controlFolderDestination = path.join(this.#tempDir, 'control');
|
|
100
102
|
this.#dataFolderDestination = path.join(this.#tempDir, 'data');
|
|
101
103
|
this.#appFolderDestination = path.join(this.#dataFolderDestination, ...options.installationRoot ? [
|
|
@@ -113,7 +115,7 @@ import { addTarEntries } from '../utils/addTarEntries';
|
|
|
113
115
|
console.log('Validating options...\n');
|
|
114
116
|
const { controlFileOptions: { shortDescription , maintainer , packageName , version , } , } = options;
|
|
115
117
|
if (!packageName) {
|
|
116
|
-
throw new Error('The controlFileOptions
|
|
118
|
+
throw new Error('The `controlFileOptions.packageName` field is mandatory');
|
|
117
119
|
}
|
|
118
120
|
if (!version) {
|
|
119
121
|
throw new Error('The `controlFileOptions.version` field is mandatory');
|
|
@@ -220,13 +222,7 @@ import { addTarEntries } from '../utils/addTarEntries';
|
|
|
220
222
|
const controlFileWriteStream = fs.createWriteStream(controlFileLocation);
|
|
221
223
|
tar.pack(this.#dataFolderDestination, {
|
|
222
224
|
map: (header)=>{
|
|
223
|
-
|
|
224
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
225
|
-
// @ts-ignore
|
|
226
|
-
header.gname = 'root';
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
228
|
-
// @ts-ignore
|
|
229
|
-
header.uname = 'root';
|
|
225
|
+
header = changeOwnerToRoot(header);
|
|
230
226
|
// sensible defaults for Windows users
|
|
231
227
|
if (process.platform === 'win32') {
|
|
232
228
|
const defaultFilePermission = parseInt('0644', 8);
|
|
@@ -262,6 +258,7 @@ import { addTarEntries } from '../utils/addTarEntries';
|
|
|
262
258
|
}).pipe(dataFileCompressor).pipe(dataFileWriteStream);
|
|
263
259
|
tar.pack(this.#controlFolderDestination, {
|
|
264
260
|
map: (header)=>{
|
|
261
|
+
header = changeOwnerToRoot(header);
|
|
265
262
|
const maintainerScripts = [
|
|
266
263
|
'postinst',
|
|
267
264
|
'postrm',
|
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Some useful references:
|
|
3
|
-
*
|
|
4
|
-
* https://radagast.ca/linux/anatomy_of_a_deb_file.html
|
|
5
|
-
* https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html
|
|
6
|
-
* https://www.unix.com/man-page/opensolaris/3head/ar.h/
|
|
7
|
-
*/
|
|
8
|
-
import type { IDeboa } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* @return IDeboa
|
|
11
|
-
*/
|
|
12
|
-
declare class Deboa implements IDeboa {
|
|
13
|
-
#private;
|
|
14
|
-
/** See {@link IDeboa.additionalTarEntries} */
|
|
15
|
-
additionalTarEntries: IDeboa['additionalTarEntries'];
|
|
16
|
-
/** See {@link IDeboa.beforeCreateDesktopEntry} */
|
|
17
|
-
beforeCreateDesktopEntry: IDeboa['beforeCreateDesktopEntry'];
|
|
18
|
-
/** See {@link IDeboa.beforePackage} */
|
|
19
|
-
beforePackage: IDeboa['beforePackage'];
|
|
20
|
-
/** See {@link IDeboa.controlFileOptions} */
|
|
21
|
-
controlFileOptions: IDeboa['controlFileOptions'];
|
|
22
|
-
/** See {@link IDeboa.icon} */
|
|
23
|
-
icon: IDeboa['icon'];
|
|
24
|
-
/** See {@link IDeboa.modifyTarHeader} */
|
|
25
|
-
modifyTarHeader: IDeboa['modifyTarHeader'];
|
|
26
|
-
/** See {@link IDeboa.sourceDir} */
|
|
27
|
-
sourceDir: IDeboa['sourceDir'];
|
|
28
|
-
/** See {@link IDeboa.tarballFormat} */
|
|
29
|
-
tarballFormat: IDeboa['tarballFormat'];
|
|
30
|
-
/** See {@link IDeboa.targetDir} */
|
|
31
|
-
targetDir: IDeboa['targetDir'];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Some useful references:
|
|
3
|
+
*
|
|
4
|
+
* https://radagast.ca/linux/anatomy_of_a_deb_file.html
|
|
5
|
+
* https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html
|
|
6
|
+
* https://www.unix.com/man-page/opensolaris/3head/ar.h/
|
|
7
|
+
*/
|
|
8
|
+
import type { IDeboa } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @return IDeboa
|
|
11
|
+
*/
|
|
12
|
+
declare class Deboa implements IDeboa {
|
|
13
|
+
#private;
|
|
14
|
+
/** See {@link IDeboa.additionalTarEntries} */
|
|
15
|
+
additionalTarEntries: IDeboa['additionalTarEntries'];
|
|
16
|
+
/** See {@link IDeboa.beforeCreateDesktopEntry} */
|
|
17
|
+
beforeCreateDesktopEntry: IDeboa['beforeCreateDesktopEntry'];
|
|
18
|
+
/** See {@link IDeboa.beforePackage} */
|
|
19
|
+
beforePackage: IDeboa['beforePackage'];
|
|
20
|
+
/** See {@link IDeboa.controlFileOptions} */
|
|
21
|
+
controlFileOptions: IDeboa['controlFileOptions'];
|
|
22
|
+
/** See {@link IDeboa.icon} */
|
|
23
|
+
icon: IDeboa['icon'];
|
|
24
|
+
/** See {@link IDeboa.modifyTarHeader} */
|
|
25
|
+
modifyTarHeader: IDeboa['modifyTarHeader'];
|
|
26
|
+
/** See {@link IDeboa.sourceDir} */
|
|
27
|
+
sourceDir: IDeboa['sourceDir'];
|
|
28
|
+
/** See {@link IDeboa.tarballFormat} */
|
|
29
|
+
tarballFormat: IDeboa['tarballFormat'];
|
|
30
|
+
/** See {@link IDeboa.targetDir} */
|
|
31
|
+
targetDir: IDeboa['targetDir'];
|
|
32
|
+
/** See {@link IDeboa.targetFileName} */
|
|
33
|
+
targetFileName: IDeboa['targetFileName'];
|
|
34
|
+
constructor(options: IDeboa);
|
|
35
|
+
/**
|
|
36
|
+
* Creates the .deb file.
|
|
37
|
+
* @return {Promise<string>} outputFile - Absolute path to the generated .deb
|
|
38
|
+
*/
|
|
39
|
+
package(): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the values provided to the hook options are file paths
|
|
42
|
+
* and imports the actual functions from them if necessary.
|
|
43
|
+
*/
|
|
44
|
+
loadHooks(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export { Deboa };
|