chore: cleanup unused group creation

This commit is contained in:
Nicolas Meienberger 2023-08-31 22:43:30 +02:00
parent 3959fd8a1f
commit 760097f492
2 changed files with 1 additions and 26 deletions

View file

@ -61,30 +61,6 @@ export class SystemExecutors {
private ensureFilePermissions = async (rootFolderHost: string) => {
const logger = new TerminalSpinner('');
// Create group tipi if it does not exist
try {
await execAsync('getent group tipi');
} catch (e) {
try {
await execAsync('sudo groupadd tipi');
logger.done('Created group tipi');
} catch (e2) {
logger.fail('Failed to create group tipi');
fileLogger.error(e2);
}
}
// Add current user to group tipi
if (!(await execAsync(`groups ${process.env.USER}`)).stdout.includes('tipi')) {
try {
await execAsync(`sudo usermod -aG tipi ${process.env.USER}`);
// Reload permissions
await execAsync('newgrp tipi');
} catch (e) {
logger.fail('Failed to add current user to group tipi');
}
}
const filesAndFolders = [
path.join(rootFolderHost, 'apps'),
path.join(rootFolderHost, 'app-data'),

View file

@ -181,9 +181,8 @@ export const generateSystemEnvFile = async () => {
const currentUserGroup = process.getgid ? String(process.getgid()) : '1000';
const currentUserId = process.getuid ? String(process.getuid()) : '1000';
const { stdout: tipiGroupId } = await execAsync('getent group tipi | cut -d: -f3');
envMap.set('TIPI_GID', tipiGroupId.trim() || currentUserGroup);
envMap.set('TIPI_GID', currentUserGroup);
envMap.set('TIPI_UID', currentUserId);
await fs.promises.writeFile(envFilePath, envMapToString(envMap));