//go:build linux package main import ( "fmt" "os" "path/filepath" ) func platformInstallIntegration(installDir string) error { binaryPath := filepath.Join( installDir, "Logof Client", ) linkPath := "/usr/local/bin/logofclient" fmt.Println("Creating command symlink...") if err := removeIfExists(linkPath); err != nil { return fmt.Errorf( "alter Symlink konnte nicht entfernt werden: %w", err, ) } if err := os.Symlink(binaryPath, linkPath); err != nil { return fmt.Errorf( "Symlink konnte nicht erstellt werden: %w", err, ) } desktopDir := "/usr/share/applications" desktopFile := filepath.Join( desktopDir, "logofclient.desktop", ) if err := os.MkdirAll( desktopDir, 0755, ); err != nil { return fmt.Errorf( "Desktop-Verzeichnis konnte nicht erstellt werden: %w", err, ) } iconPath := filepath.Join( installDir, "assets", "icon.png", ) desktopEntry := fmt.Sprintf(`[Desktop Entry] Name=Logof Client Comment=Logof Client Exec=%s Terminal=false Type=Application Icon=%s Categories=Office; `, linkPath, iconPath) if err := os.WriteFile( desktopFile, []byte(desktopEntry), 0644, ); err != nil { return fmt.Errorf( "Desktop-Datei konnte nicht geschrieben werden: %w", err, ) } return nil } func platformRemoveIntegration() error { linkPath := "/usr/local/bin/logofclient" desktopFile := filepath.Join( "/usr/share/applications", "logofclient.desktop", ) if err := removeIfExists(linkPath); err != nil { return fmt.Errorf( "Symlink konnte nicht entfernt werden: %w", err, ) } if err := removeIfExists(desktopFile); err != nil { return fmt.Errorf( "Desktop-Datei konnte nicht entfernt werden: %w", err, ) } return nil }