1 |
cardoe 08/02/22 14:44:41 |
2 |
|
3 |
Added: eselect-xvmc-0.1.eselect |
4 |
Removed: xvmc-0.1.eselect |
5 |
Log: |
6 |
rename file correctly |
7 |
(Portage version: 2.1.4.4) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-admin/eselect-xvmc/files/eselect-xvmc-0.1.eselect |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-xvmc/files/eselect-xvmc-0.1.eselect?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-xvmc/files/eselect-xvmc-0.1.eselect?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: eselect-xvmc-0.1.eselect |
16 |
=================================================================== |
17 |
# Copyright 1999-2008 Gentoo Foundation |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
# $Id: eselect-xvmc-0.1.eselect,v 1.1 2008/02/22 14:44:40 cardoe Exp $ |
20 |
|
21 |
DESCRIPTION="Manage the XvMC implementation used by your system" |
22 |
MAINTAINER="cardoe@g.o" |
23 |
SVN_DATE='$Date: 2008/02/22 14:44:40 $' |
24 |
VERSION=$(svn_date_to_version "${SVN_DATE}" ) |
25 |
|
26 |
XVMCLIBS=( |
27 |
"libXvMCNVIDIA_dynamic.so.1" |
28 |
"libXvMC.so.1" |
29 |
"libviaXvMC.so.1" |
30 |
"libchromeXvMC.so.1" |
31 |
"libviaXvMCPro.so.1" |
32 |
"libchromeXvMCPro.so.1" |
33 |
"libI810XvMC.so.1" ) |
34 |
XVMCPRETTY=( |
35 |
"nvidia" |
36 |
"xorg-x11" |
37 |
"via" |
38 |
"openchrome" |
39 |
"via-pro" |
40 |
"openchrome-pro" |
41 |
"intel" ) |
42 |
|
43 |
get_implementation_indices() { |
44 |
local ret n |
45 |
for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do |
46 |
[[ -e "${ROOT}/usr/lib/${XVMCLIBS[n]}" ]] && ret+=($n) |
47 |
done |
48 |
|
49 |
echo ${ret[@]} |
50 |
} |
51 |
|
52 |
get_current_implementation_index() { |
53 |
local n |
54 |
if [[ -f "${ROOT}/etc/X11/XvMCConfig" ]]; then |
55 |
local current=$(< "${ROOT}/etc/X11/XvMCConfig") |
56 |
for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do |
57 |
if [[ "${XVMCLIBS[n]}" = "${current}" ]]; then |
58 |
echo "${n}" |
59 |
return |
60 |
fi |
61 |
done |
62 |
fi |
63 |
|
64 |
echo "-1" |
65 |
} |
66 |
|
67 |
set_new_implementation() { |
68 |
echo -n "Switching to ${XVMCPRETTY[$1]} XvMC implementation..." |
69 |
touch "${ROOT}/etc/X11/XvMCConfig" 2&>1 > /dev/null |
70 |
if [[ $? -eq 0 ]]; then |
71 |
echo "${XVMCLIBS[$1]}" > "${ROOT}/etc/X11/XvMCConfig" |
72 |
chmod 644 "${ROOT}/etc/X11/XvMCConfig" |
73 |
chown 0:0 "${ROOT}/etc/X11/XvMCConfig" |
74 |
echo " done" |
75 |
else |
76 |
echo " failed!" |
77 |
echo "Insufficient privileges" |
78 |
fi |
79 |
} |
80 |
|
81 |
### list action |
82 |
|
83 |
## {{{ list stuff |
84 |
describe_list() { |
85 |
echo "List Available XvMC implementations" |
86 |
} |
87 |
|
88 |
do_list() { |
89 |
local output n |
90 |
local avail=( $(get_implementation_indices) ) |
91 |
local current=$(get_current_implementation_index) |
92 |
write_list_start "Available XvMC implementations ( $(highlight '*') is current ):" |
93 |
|
94 |
if (( ${#avail[@]} )) ; then |
95 |
for n in "${avail[@]}" ; do |
96 |
output[n]="${XVMCPRETTY[n]}" |
97 |
[[ ${current} -eq ${n} ]] && \ |
98 |
output[n]+=" $(highlight '*')" |
99 |
done |
100 |
write_numbered_list "${output[@]}" |
101 |
else |
102 |
write_kv_list_entry "(none found)" "" |
103 |
fi |
104 |
|
105 |
return 0 |
106 |
} |
107 |
## }}} |
108 |
|
109 |
### show action |
110 |
|
111 |
## {{{ show stuff |
112 |
describe_show() { |
113 |
echo "Print the current XvMC implementation." |
114 |
} |
115 |
|
116 |
do_show() { |
117 |
local current=$(get_current_implementation_index) |
118 |
write_list_start "Current XvMC implementation:" |
119 |
|
120 |
if [[ ${current} -ne -1 ]]; then |
121 |
echo "${XVMCPRETTY[current]}" |
122 |
return 0 |
123 |
else |
124 |
echo "(none)" |
125 |
return 2 |
126 |
fi |
127 |
} |
128 |
## }}} |
129 |
|
130 |
### set action |
131 |
|
132 |
## {{{ set stuff |
133 |
describe_set() { |
134 |
echo "Select the XvMC implementation" |
135 |
} |
136 |
|
137 |
describe_set_parameters() { |
138 |
echo "<target>" |
139 |
} |
140 |
|
141 |
describe_set_options() { |
142 |
echo "<target> : XvMC implementation to activate" |
143 |
echo "--use-old : If an implementation is already set, use that one instead" |
144 |
} |
145 |
|
146 |
do_set() { |
147 |
local current=$(get_current_implementation_index) |
148 |
local avail=( $(get_implementation_indices) ) |
149 |
local n new action |
150 |
|
151 |
while [[ ${#@} -gt 0 ]]; do |
152 |
local opt=${1} |
153 |
shift |
154 |
case ${opt} in |
155 |
--use-old) |
156 |
if [[ ${current} -gt -1 ]]; then |
157 |
(( ${current} < ${#XVMCPRETTY[@]} )) && action="old-implementation" |
158 |
fi |
159 |
;; |
160 |
*) |
161 |
[[ -z ${action} ]] && action="set-implementation" |
162 |
|
163 |
if is_number ${opt} ; then |
164 |
new=${avail[opt - 1]} |
165 |
if [[ -z ${new} ]]; then |
166 |
die -q "Unrecognized option: ${opt}" |
167 |
fi |
168 |
elif has ${opt} ${XVMCPRETTY[@]}; then |
169 |
for (( n = 0; n < ${#XVMCPRETTY[@]}; ++n )); do |
170 |
[[ "${XVMCPRETTY[n]}" = "${opt}" ]] && new=${n} |
171 |
done |
172 |
else |
173 |
die -q "Unrecognized option: ${opt}" |
174 |
fi |
175 |
;; |
176 |
esac |
177 |
done |
178 |
|
179 |
case ${action} in |
180 |
old-implementation) |
181 |
set_new_implementation ${current} |
182 |
return $? |
183 |
;; |
184 |
set-implementation) |
185 |
if [[ -n ${new} ]]; then |
186 |
set_new_implementation ${new} |
187 |
return $? |
188 |
else |
189 |
die -q "Please specify an implementation to set" |
190 |
fi |
191 |
;; |
192 |
*) |
193 |
die -q "Invalid usage of set action." |
194 |
esac |
195 |
} |
196 |
|
197 |
# vim: ts=4 sw=4 noet fdm=marker |
198 |
|
199 |
|
200 |
|
201 |
-- |
202 |
gentoo-commits@l.g.o mailing list |