File: depend.lib

package info (click to toggle)
playonlinux 4.1.1-1
  • links: PTS, VCS
  • area: contrib
  • in suites: wheezy
  • size: 11,208 kB
  • sloc: python: 6,173; sh: 5,358; ansic: 72; makefile: 8
file content (89 lines) | stat: -rwxr-xr-x 2,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/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 
}