How to find out if the Installed Ubuntu is server or desktop edition

Asked by Ralemy

Good Morning,

For some reason - please don't ask why :) - I need to check the Ubuntu system my program is running on and only proceed if it is a server edition of Ubuntu.

The commands I know of, like lsb_release and uname, only give the architecture and version of the Ubuntu, but the output is the same for Server and Desktop editions. I even tried checking to see if the ubuntu-desktop package is installed, but since that package can be added manually to the Server editions as well, I could not use its presence as an indicator for the edition not being Server.

Does anyone out there know of a command line that would return the edition of the Ubuntu installed?

Cheers and Thanks,
Rex

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Sam_
Solved:
Last query:
Last reply:
Revision history for this message
Best Sam_ (and-sam) said :
#1

Those kernel images aren't on a standard desktop version e.g. linux-image-2.6.32-21-server

Revision history for this message
Ralemy (reza.alemy) said :
#2

may be it is my servers, but I have a karmic, two lucids and one maverick and none of them has linux-image-<generic>-server. they are all using linux-image-<kernel version>-generic. so I need another way, but thanks for the fast reply.

Cheers,
Rex

Revision history for this message
Ralemy (reza.alemy) said :
#3

For anyone who might have the same problem, the way I solved it was to make sure that Ubuntu is not installed on a laptop using the command:

hwinfo | grep formfactor | cut -f 2 -d "'"

which will return 'laptop' if it was installed on a laptop, and then check to make sure the xserver was not installed:

dpkg -l | grep -i " xserver"

I put that in the install of my package, since the client wanted to make sure it won't install on a laptop or a system with GUI on it.

bottom line is that the Server and the Desktop editions only differ on the packages they install and the configurations they make, there is no firm component that can be only present on one of them as far as I can tell.

Cheers and thanks again,
Rex

Revision history for this message
Ralemy (reza.alemy) said :
#4

Thanks Sam, that solved my question.