@@ -1269,47 +1269,41 @@ const advancedOptions = configOptions.filter((o) => o.category === "advanced");
12691269
12701270 let scriptPath: string;
12711271 let scriptCmd: string;
1272+ const isUser = dockerUser === "username";
12721273
12731274 if (isLocal) {
12741275 scriptPath = `${workDir}/qbt.bash`;
12751276 const baseCmd = isLegacyMode()
1276- ? `${scriptPath} all`
1277- : `${scriptPath} bootstrap_deps all`;
1278- scriptCmd =
1279- dockerUser === "username"
1280- ? `sudo -u username bash -c "${baseCmd}"`
1281- : baseCmd;
1277+ ? `bash ${scriptPath} all`
1278+ : `bash ${scriptPath} bootstrap_deps all`;
1279+ scriptCmd = isUser ? `sudo -E -H -u username ${baseCmd}` : baseCmd;
12821280 } else {
12831281 const baseCmd = getScriptCmd();
1284- scriptCmd =
1285- dockerUser === "username"
1286- ? `sudo -u username bash -c "${baseCmd}"`
1287- : baseCmd;
1282+ scriptCmd = isUser
1283+ ? `sudo -E -H -u username bash -c "${baseCmd}"`
1284+ : baseCmd;
12881285 }
12891286
12901287 const downloadLine = isLocal
1291- ? `curl --create-dirs -sL usrdx.github.io/s/qbt.bash -o ${localDir}/qbt.bash && \\\nchmod +x ${localDir}/qbt.bash && \\\n`
1288+ ? `mkdir -p ${localDir} && chmod 755 ${localDir} && \\\ncurl -sL usrdx.github.io/s/qbt.bash -o ${localDir}/qbt.bash && \\\n`
12921289 : "";
12931290
12941291 const volumeLines = `\t-v ${volumeMapping} \\`;
12951292
12961293 const envBlock = envVars.length
1297- ? envVars.map((v) => `\n\texport ${v} && \\ `).join("")
1294+ ? envVars.map((v) => `\t-e ${v} \\\n `).join("")
12981295 : "";
12991296
1300- const debianEnvLines =
1301- baseImage.includes("ubuntu") || baseImage.includes("debian")
1302- ? `\t-e LANG="C.UTF-8" \\\n\t-e LANGUAGE="C.UTF-8" \\\n\t-e LC_ALL="C.UTF-8" \\\n\t-e DEBIAN_FRONTEND=noninteractive \\\n`
1303- : "";
1297+ const debianEnvLines = "";
13041298
13051299 return (
13061300 `${downloadLine}docker run -it -w ${workDir} \\\n` +
13071301 `\t-p ${portMapping} \\\n` +
13081302 `${volumeLines}\n` +
13091303 `${debianEnvLines}` +
1304+ `${envBlock}` +
13101305 `\t${baseImage} ${shell} -c \\\n` +
1311- `\t'${packageManager}${userSetup} && \\` +
1312- `${envBlock}\n` +
1306+ `\t'${packageManager}${userSetup} && \\\n` +
13131307 `\t${scriptCmd}'`
13141308 );
13151309 }
@@ -1339,10 +1333,7 @@ const advancedOptions = configOptions.filter((o) => o.category === "advanced");
13391333
13401334 const workDir = dockerUser === "username" ? "/home/username" : "/root";
13411335
1342- const debianEnvBlock =
1343- baseImage.includes("ubuntu") || baseImage.includes("debian")
1344- ? `# Set locale\nENV LANG="C.UTF-8" \\\n LANGUAGE="C.UTF-8" \\\n LC_ALL="C.UTF-8" \\\n DEBIAN_FRONTEND=noninteractive\n\n`
1345- : "";
1336+ const debianEnvBlock = "";
13461337
13471338 const setupCmds = getUserSetupCmds(baseImage, dockerUser);
13481339 const userSetupBlock = setupCmds.length
0 commit comments