#!/bin/bash
#
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Let the wrapped binary know that it has been run through the wrapper.
export CHROME_WRAPPER="`readlink -f "$0"`"

HERE="`dirname "$CHROME_WRAPPER"`"

# mkdir client_test
export LD_LIBRARY_PATH=$HERE
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HERE/lib

# ȡаϢ  
distro=$(cat /etc/os-release | grep '^NAME' | awk -F'"' '{print $2}')  
echo $distro

if [[ $distro == "uos" ]]; then  
    # ִUbuntuضĲ  
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HERE/uos
    # ȡЧ״̬
    result=`qdbus com.deepin.wm /com/deepin/wm com.deepin.wm.compositingEnabled` 
    echo $result
    if [ $? -eq 0 ]; then
        echo "success"
    else
        echo "false"
    fi
    # ݷؽж
    if [ "$result" == "false" ]; then
        echo "yes i want"
        #qdbus com.deepin.wm /com/deepin/wm com.deepin.wm.compositingEnabled True
    else
        echo "no i do not want"
    fi  
elif [[ $distro == "Kylin" ]]; then  
    # ִCentOSضĲ  
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HERE/qilin 
else  
    # ִĬϲ  
    echo "Unknown distribution."  
fi

# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/client" "$@"
