001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/ http://developer.berlios.de/projects/izpack/
005 * 
006 * Copyright 2004 Marc Eppelmann
007 * 
008 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
009 * in compliance with the License. You may obtain a copy of the License at
010 * 
011 * http://www.apache.org/licenses/LICENSE-2.0
012 * 
013 * Unless required by applicable law or agreed to in writing, software distributed under the License
014 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
015 * or implied. See the License for the specific language governing permissions and limitations under
016 * the License.
017 */
018package com.izforge.izpack.util;
019
020/**
021 * Help Methods for unix-systems and derived.
022 * 
023 * @author marc.eppelmann@reddot.de
024 */
025public class UnixHelper
026{
027
028    /**
029     * Testmain
030     * 
031     * @param args commandline args
032     */
033    public static void main(String[] args)
034    {
035        kdeIsInstalled();
036    }
037
038    /**
039     * Test if KDE is installed.
040     * This is done by $>/usr/bin/env konqueror --version
041     * 
042     * This assumes that the konqueror as a main-app of kde is already installed. 
043     * 
044     * If this returns with 0 konqeror and resp. kde means to be installed, 
045     * 
046     * @return true if kde is installed otherwise false.
047     */
048    public static boolean kdeIsInstalled()
049    {
050        FileExecutor fe = new FileExecutor();
051
052        String[] execOut = new String[2];
053
054        int execResult = fe.executeCommand(
055                new String[] { "/usr/bin/env", "konqueror", "--version"}, execOut);
056
057        return execResult == 0;
058    }
059}