#!/bin/bash # Copyright (C) 2007-2010 PlayOnLinux Team # Copyright (C) 2007-2011 Pâris Quentin # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # depend.lib # ---------- # # This is an internal lib # It permits playonlinux to check if one's computer has all programs needed installed # Scriptors should not use this lib MISSING="" # Contains missing programs. missing () { # Tells that a program is missing echo "$1$(eval_gettext " is missing. Please install it")" } check_one () { # Checks if a program exist # Usage : check_one [PROGRAM] [PACKAGE] if [ ! "$(which $1)" ] then MISSING+="$(eval_gettext "Program: ")$1$(eval_gettext ", package: ")$2\n" MANQUE=true fi } manque () { # Tells the user if a program is missing # Usage : manque if [ "$MANQUE" = "true" ] then printf "$(eval_gettext "One or more program(s) are missing. Please install them and run the script again.")\n\n$MISSING\n\n" exit $EXIT_MISSING fi } programmes_check () { # Checks if every program needed is installed check_one wget "wget" check_one wine "wine" check_one unzip "unzip" check_one convert "imagemagick" check_one cabextract "cabextract" check_one gpg "gnupg" manque } acceleration_check () { # Checks if 3D acceleration is supported check_one glxinfo "mesa-utils" manque if [ "$(glxinfo | grep "direct rendering" | tail -n 1)" != "direct rendering: Yes" ] && [ "$(which glxinfo)" ] then echo "$(eval_gettext "You don't seem to have 3D acceleration!\nWe advise you to install and to enable it.")" fi if [ ! "$(which glxinfo)" ] then echo "$(eval_gettext "Warning: glxinfo is missing! PlayOnLinux can't detect if 3D acceleration is supported.")" fi } cfg_check () { # Check acceleration and programs programmes_check if [ ! "$TMP_ACC_CHECK" ] then acceleration_check& export TMP_ACC_CHECK="1" fi }