Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-PSGraph does not find graphviz on Ubuntu in default location #78

Closed
tigerfansga opened this issue Oct 6, 2018 · 7 comments
Closed

Comments

@tigerfansga
Copy link
Contributor

On Ubuntu, the default install location is /usr/bin/dot I feel this should be added to the default search list

        $GraphVizPath = (
            'C:\Program Files\NuGet\Packages\Graphviz*\dot.exe',
            'C:\program files*\GraphViz*\bin\dot.exe',
            '/usr/local/bin/dot'
        ),

If you agree, I can do a PR if you like.

@KevinMarquette
Copy link
Owner

Absolutely. That looks like a good path to add to the list.

@tigerfansga
Copy link
Contributor Author

PR submitted. I know you have login in Install-GraphViz for Windows and MacOS. For Linux, because of the variability in distos and package managers, I'm not sure of the best options for this command.

For ubuntu (and other debian distros), you would use sudo apt install graphviz for REHL and other similar distros, it would probably be a yum command.

KevinMarquette added a commit that referenced this issue Oct 10, 2018
Add '/usr/bin/dot' as a default location for GraphVizPath. To support Ubuntu. Issue #78
@KevinMarquette
Copy link
Owner

I wasn't sure how to handle all those possibilities either and I'm not sure that command belongs in this module.

@tigerfansga
Copy link
Contributor Author

I was thinking more displaying the command but not executing it

@KevinMarquette
Copy link
Owner

I would be good with that solution. That lets the user make the call.

I guess I we should also include a link to the graphviz documentation on how to download it. https://www.graphviz.org/download

@Stephanevg
Copy link
Contributor

hi, guys,

I think it would be too bad to have the user usability be diffferent for linux then for macosx and windows.
I perhaps have a small suggestion. Please let me know if this is something that could be acceptable:

    <#
        .Description
        Installs GraphViz package using online provider
        .Example
        Install-GraphViz
    #>
    [cmdletbinding( SupportsShouldProcess = $true, ConfirmImpact = "High" )]
    param()

    process
    {
        try
        {
            if ( $IsOSX )
            {
                if ( $PSCmdlet.ShouldProcess( 'Install graphviz' ) )
                {
                    brew install graphviz
                }
            }Elseif($IsLinux){
                #Get the version, with something like this:
                #https://www.cyberciti.biz/faq/how-to-check-os-version-in-linux-command-line/
                $LinuxOs = ""

                switch($LinuxOs){
                    "RHEL" {yum graphviz;break}
                    "Ubuntu"{sudo apt install graphviz;break}
                    "Default"{throw "Os not supported yet. please open an issue here: https://github.com/KevinMarquette/PSGraph/issues"}

                }

            }
            else
            {
                if ( $PSCmdlet.ShouldProcess('Register Chocolatey provider and install graphviz' ) )
                {
                    if ( -Not ( Get-PackageProvider | Where-Object ProviderName -eq 'Chocolatey' ) )
                    {
                        Register-PackageSource -Name Chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/
                    }

                    Find-Package graphviz | Install-Package -Verbose -ForceBootstrap
                }
            }
        }
        catch
        {
            $PSCmdlet.ThrowTerminatingError( $PSitem )
        }
    }

I have no linux machine to test this one unfortunatley. perhaps @tigerfansga could give it a shot?

@tigerfansga
Copy link
Contributor Author

One option to look at these is WSL on Windows 10.

I can do some checking on a few different distributions, but the variability in the Linux world will create gaps.

I can't confirm, but you will most likely need to use sudo for REHL with yum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants