diff --git a/default.nix b/default.nix index f856303f1c..adcc944396 100644 --- a/default.nix +++ b/default.nix @@ -66,7 +66,11 @@ let categories = "Application;Network;"; icon = "INSERT_ICON_PATH_HERE"; }; - iconPath = ./installers/icons/1024x1024.png; + iconPath = { + mainnet = ./installers/icons/mainnet/1024x1024.png; + staging = ./installers/icons/staging/1024x1024.png; + testnet = ./installers/icons/testnet/1024x1024.png; + }; namespaceHelper = pkgs.writeScriptBin "namespaceHelper" '' #!/usr/bin/env bash @@ -94,7 +98,7 @@ let echo "in post-install hook" - cp -f ${self.iconPath} $DAEDALUS_DIR/icon.png + cp -f ${self.iconPath.${cluster}} $DAEDALUS_DIR/icon.png cp -Lf ${self.namespaceHelper}/bin/namespaceHelper $DAEDALUS_DIR/namespaceHelper mkdir -pv ~/.local/bin ''${XDG_DATA_HOME}/applications cp -Lf ${self.namespaceHelper}/bin/namespaceHelper ~/.local/bin/daedalus diff --git a/installers/common/MacInstaller.hs b/installers/common/MacInstaller.hs index eb0f14f97c..72011fb6ab 100644 --- a/installers/common/MacInstaller.hs +++ b/installers/common/MacInstaller.hs @@ -67,6 +67,7 @@ main opts@Options{..} = do ver <- getBackendVersion oBackend exportBuildVars opts installerConfig ver + buildIcons oCluster appRoot <- buildElectronApp darwinConfig makeComponentRoot opts appRoot darwinConfig daedalusVer <- getDaedalusVersion "../package.json" @@ -105,16 +106,19 @@ makeScriptsDir Options{..} DarwinConfig{..} = case oBackend of pure $ tt tempdir Mantis -> pure "[DEVOPS-533]" +buildIcons :: Cluster -> IO () +buildIcons cluster = do + let iconset = format ("icons/"%s%".iconset") (lshowText cluster) + echo "Creating icons ..." + procs "iconutil" ["--convert", "icns", "--output", "icons/electron.icns" + , iconset] mempty + -- | Builds the electron app with "npm package" and returns its -- component root path. -- NB: If webpack scripts are changed then this function may need to -- be updated. buildElectronApp :: DarwinConfig -> IO FilePath buildElectronApp darwinConfig@DarwinConfig{..} = do - echo "Creating icons ..." - procs "iconutil" ["--convert", "icns", "--output", "icons/electron.icns" - , "icons/electron.iconset"] mempty - withDir ".." . sh $ npmPackage darwinConfig let diff --git a/installers/common/WindowsInstaller.hs b/installers/common/WindowsInstaller.hs index 73f394b981..8739efec79 100644 --- a/installers/common/WindowsInstaller.hs +++ b/installers/common/WindowsInstaller.hs @@ -23,7 +23,7 @@ import Prelude ((!!)) import qualified System.IO as IO import Filesystem.Path (FilePath, ()) import Filesystem.Path.CurrentOS (encodeString, fromText) -import Turtle (Shell, Line, ExitCode (..), echo, proc, procs, inproc, shells, testfile, stdout, input, export, sed, strict, format, printf, fp, w, (%), need, writeTextFile, die) +import Turtle (Shell, Line, ExitCode (..), echo, proc, procs, inproc, shells, testfile, stdout, input, export, sed, strict, format, printf, fp, w, s, (%), need, writeTextFile, die) import Turtle.Pattern (text, plus, noneOf, star, dot) import AppVeyor import qualified Codec.Archive.Zip as Zip @@ -110,11 +110,11 @@ writeInstallerNSIS outName (Version fullVersion') installerConfig clusterName = IO.writeFile "daedalus.nsi" $ nsis $ do _ <- constantStr "Version" (str fullVersion) - _ <- constantStr "Cluster" (str $ unpack $ lshowText clusterName) + _ <- constantStr "Cluster" (str $ lshow clusterName) _ <- constantStr "InstallDir" (str $ unpack $ installDirectory installerConfig) name "$InstallDir ($Version)" -- The name of the installer outFile $ str $ encodeString outName -- Where to produce the installer - unsafeInjectGlobal $ "!define MUI_ICON \"icons\\64x64.ico\"" + unsafeInjectGlobal $ "!define MUI_ICON \"icons\\" ++ lshow clusterName ++ "\\64x64.ico\"" unsafeInjectGlobal $ "!define MUI_HEADERIMAGE" unsafeInjectGlobal $ "!define MUI_HEADERIMAGE_BITMAP \"icons\\installBanner.bmp\"" unsafeInjectGlobal $ "!define MUI_HEADERIMAGE_RIGHT" @@ -187,10 +187,14 @@ writeInstallerNSIS outName (Version fullVersion') installerConfig clusterName = createShortcut "$SMPROGRAMS/$InstallDir/$InstallDir.lnk" daedalusShortcut return () -packageFrontend :: IO () -packageFrontend = do +lshow :: Show a => a -> String +lshow = T.unpack . lshowText + +packageFrontend :: Cluster -> IO () +packageFrontend cluster = do + let icon = format ("installers/icons/"%s%"64x64") (lshowText cluster) export "NODE_ENV" "production" - shells "npm run package -- --icon installers/icons/64x64" empty + shells ("npm run package -- --icon " <> icon) empty main :: Options -> IO () main opts@Options{..} = do @@ -205,7 +209,7 @@ main opts@Options{..} = do echo "Packaging frontend" exportBuildVars opts installerConfig ver - packageFrontend + packageFrontend oCluster let fullName = packageFileName Win64 oCluster fullVersion oBackend ver oBuildJob