Skip to content

Commit adbcbfa

Browse files
committed
add copyright file
1 parent 9026caf commit adbcbfa

File tree

1 file changed

+47
-12
lines changed

1 file changed

+47
-12
lines changed

package/src/linux/installer.ts

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,35 @@ async function createNfpmConfig(
4141
"share",
4242
);
4343

44+
const contents: any[] = [
45+
{
46+
src: workingBinPath,
47+
dst: "/opt/quarto/bin",
48+
type: "tree",
49+
},
50+
{
51+
src: workingSharePath,
52+
dst: "/opt/quarto/share",
53+
type: "tree",
54+
},
55+
];
56+
57+
// Add copyright file for DEB packages
58+
if (format === 'deb') {
59+
const copyrightFile = join(
60+
workingDir,
61+
"usr",
62+
"share",
63+
"doc",
64+
configuration.productName.toLowerCase(),
65+
"copyright",
66+
);
67+
contents.push({
68+
src: copyrightFile,
69+
dst: `/usr/share/doc/${configuration.productName.toLowerCase()}/copyright`,
70+
});
71+
}
72+
4473
const config: any = {
4574
name: configuration.productName.toLowerCase(),
4675
version: configuration.version,
@@ -50,18 +79,7 @@ async function createNfpmConfig(
5079
homepage: "https://github.com/quarto-dev/quarto-cli",
5180
license: "MIT",
5281

53-
contents: [
54-
{
55-
src: workingBinPath,
56-
dst: "/opt/quarto/bin",
57-
type: "tree",
58-
},
59-
{
60-
src: workingSharePath,
61-
dst: "/opt/quarto/share",
62-
type: "tree",
63-
},
64-
],
82+
contents: contents,
6583

6684
scripts: {
6785
postinstall: join(configuration.directoryInfo.pkg, "scripts", "linux", format, "postinst"),
@@ -123,6 +141,23 @@ async function buildPackageWithNfpm(
123141
overwrite: true,
124142
});
125143

144+
// Create copyright file for DEB packages
145+
if (format === 'deb') {
146+
info("Creating copyright file");
147+
const url = "https://github.com/quarto-dev/quarto-cli";
148+
const copyrightText = `Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
149+
Upstream-Name: Quarto
150+
Source: ${url}
151+
152+
Files: *
153+
Copyright: Posit, PBC.
154+
License: MIT`;
155+
156+
const copyrightDir = join(workingDir, "usr", "share", "doc", configuration.productName.toLowerCase());
157+
ensureDirSync(copyrightDir);
158+
Deno.writeTextFileSync(join(copyrightDir, "copyright"), copyrightText);
159+
}
160+
126161
// Create nfpm configuration
127162
const nfpmConfig = await createNfpmConfig(configuration, format, workingDir);
128163
const configPath = join(configuration.directoryInfo.out, "nfpm.yaml");

0 commit comments

Comments
 (0)