diff --git a/src/backend/storeManagers/gog/games.ts b/src/backend/storeManagers/gog/games.ts index 94630881a6..9fde0eeb22 100644 --- a/src/backend/storeManagers/gog/games.ts +++ b/src/backend/storeManagers/gog/games.ts @@ -406,11 +406,12 @@ export async function install( } const sizeOnDisk = await getPathDiskSize(join(path, gameInfo.folder_name)) + const install_path = join(path, gameInfo.folder_name) const installedData: InstalledInfo = { platform: installPlatform, executable: '', - install_path: join(path, gameInfo.folder_name), + install_path, install_size: getFileSize(sizeOnDisk), is_dlc: false, version: additionalInfo ? additionalInfo.version : installInfo.game.version, @@ -441,6 +442,17 @@ export async function install( LogPrefix.Gog ) } + } else if (isLinuxNative) { + const installer = join(install_path, 'support/postinst.sh') + if (existsSync(installer)) { + logInfo(`Running ${installer}`, LogPrefix.Gog) + await spawnAsync(installer, []).catch((err) => + logError( + `Failed to run linux installer: ${installer} - ${err}`, + LogPrefix.Gog + ) + ) + } } addShortcuts(appName) return { status: 'done' } @@ -1155,9 +1167,6 @@ export async function update( gameObject.version = installInfo.game.version gameObject.branch = updateOverwrites?.branch gameObject.language = overwrittenLanguage - if (updateOverwrites?.dlcs) { - gameObject.installedDLCs = updateOverwrites?.dlcs - } gameObject.versionEtag = etag } else { const installerInfo = await getLinuxInstallerInfo(appName) @@ -1166,6 +1175,9 @@ export async function update( } gameObject.version = installerInfo.version } + if (updateOverwrites?.dlcs) { + gameObject.installedDLCs = updateOverwrites?.dlcs + } const sizeOnDisk = await getPathDiskSize(join(gameObject.install_path)) gameObject.install_size = getFileSize(sizeOnDisk) installedGamesStore.set('installed', installedArray) @@ -1178,6 +1190,17 @@ export async function update( (isWindows || existsSync(gameSettings.winePrefix)) ) { await setup(appName, gameObject, false) + } else if (gameObject.platform === 'linux') { + const installer = join(gameObject.install_path, 'support/postinst.sh') + if (existsSync(installer)) { + logInfo(`Running ${installer}`, LogPrefix.Gog) + await spawnAsync(installer, []).catch((err) => + logError( + `Failed to run linux installer: ${installer} - ${err}`, + LogPrefix.Gog + ) + ) + } } sendGameStatusUpdate({ appName: appName, diff --git a/src/frontend/screens/Game/GamePage/components/DotsMenu.tsx b/src/frontend/screens/Game/GamePage/components/DotsMenu.tsx index 75248bdc8c..211338a4fe 100644 --- a/src/frontend/screens/Game/GamePage/components/DotsMenu.tsx +++ b/src/frontend/screens/Game/GamePage/components/DotsMenu.tsx @@ -27,7 +27,7 @@ const DotsMenu = ({ gameInfo, handleUpdate }: Props) => { const [showChangelog, setShowChangelog] = useState(false) const [showModifyInstallModal, setShowModifyInstallModal] = useState(false) - const { is_installed, title, install } = gameInfo + const { is_installed, title } = gameInfo const hasRequirements = (gameExtraInfo?.reqs || []).length > 0 @@ -50,7 +50,6 @@ const DotsMenu = ({ gameInfo, handleUpdate }: Props) => { } changelog={gameExtraInfo?.changelog} runner={gameInfo.runner} - installPlatform={install.platform} handleUpdate={handleUpdate} handleChangeLog={() => setShowChangelog(true)} disableUpdate={is.installing || is.updating} diff --git a/src/frontend/screens/Game/GameSubMenu/index.tsx b/src/frontend/screens/Game/GameSubMenu/index.tsx index 2df50a7d1f..1d784e1b38 100644 --- a/src/frontend/screens/Game/GameSubMenu/index.tsx +++ b/src/frontend/screens/Game/GameSubMenu/index.tsx @@ -20,7 +20,6 @@ interface Props { title: string storeUrl: string changelog?: string - installPlatform?: string runner: Runner handleUpdate: () => void handleChangeLog: () => void @@ -37,7 +36,6 @@ export default function GamesSubmenu({ storeUrl, changelog, runner, - installPlatform, handleUpdate, handleChangeLog, disableUpdate, @@ -235,8 +233,7 @@ export default function GamesSubmenu({ onShowModifyInstall && ['legendary', 'gog'].includes(runner) && isInstalled && - !isThirdPartyManaged && - installPlatform !== 'linux' + !isThirdPartyManaged return ( <> diff --git a/src/frontend/screens/Game/ModifyInstallModal/GOG/index.tsx b/src/frontend/screens/Game/ModifyInstallModal/GOG/index.tsx index 4758e679fb..cd592085a0 100644 --- a/src/frontend/screens/Game/ModifyInstallModal/GOG/index.tsx +++ b/src/frontend/screens/Game/ModifyInstallModal/GOG/index.tsx @@ -31,6 +31,7 @@ export default function GOGModifyInstallModal({ }: GOGModifyInstallModal) { const { t, i18n } = useTranslation('gamepage') const { t: tr } = useTranslation() + const isLinux = gameInfo.install.platform === 'linux' const [gameInstallInfo, setGameInstallInfo] = useState() const [installLanguages, setInstallLanguages] = useState([]) @@ -65,7 +66,7 @@ export default function GOGModifyInstallModal({ const [currentTab, setCurrentTab] = useState('updates') const handleConfirm = () => { - const gameBuild = selectedBuild || builds[0].build_id + const gameBuild = selectedBuild || builds[0]?.build_id const versionPinned = !!selectedBuild const buildModified = gameBuild !== gameInfo.install.buildId const languageModified = installLanguage !== gameInfo.install.language @@ -100,7 +101,9 @@ export default function GOGModifyInstallModal({ } const gameModified = - buildModified || branchModified || languageModified || dlcModified + (!isLinux && (buildModified || branchModified)) || + languageModified || + dlcModified if (gameModified) { // Create update @@ -247,35 +250,39 @@ export default function GOGModifyInstallModal({ )} -
- setSavedBranchPassword(newPasswd)} - /> -
- - {installLanguages.length > 1 && ( -
- + + setSavedBranchPassword(newPasswd) + } />
)} -
- +
+ + {!!builds.length && ( +
+ +
+ )}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/GameLanguageSelector.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/GameLanguageSelector.tsx index 220ea3dcff..b07e6d0db5 100644 --- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/GameLanguageSelector.tsx +++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/GameLanguageSelector.tsx @@ -40,6 +40,7 @@ export default function GameLanguageSelector({ label={`${t('game.language', 'Language')}:`} htmlId="languagePick" value={installLanguage} + disabled={installLanguages?.length === 1} onChange={(e) => setInstallLanguage(e.target.value)} > {installLanguages &&