Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 148632 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/share/eselect/modules/java-nsplugin-old.eselect (-4 / +123 lines)
Lines 18-23 Link Here
18
SYSTEM_PLUGIN_32="${SYSTEM_PLUGIN_DIR_32}/javaplugin.so"
18
SYSTEM_PLUGIN_32="${SYSTEM_PLUGIN_DIR_32}/javaplugin.so"
19
SYSTEM_PLUGIN_64="${SYSTEM_PLUGIN_DIR_64}/javaplugin.so"
19
SYSTEM_PLUGIN_64="${SYSTEM_PLUGIN_DIR_64}/javaplugin.so"
20
20
21
#alistairs magic
22
USER_MOZILLA_DIR="${HOME}/.mozilla"
23
USER_PLUGIN_DIR="${USER_MOZILLA_DIR}/plugins"
24
USER_PLUGIN="${USER_PLUGIN_DIR}/javaplugin.so"
25
USER_PLUGIN_32="${USER_PLUGIN_DIR}/javaplugin-32.so"
26
USER_PLUGIN_64="${USER_PLUGIN_DIR}/javaplugin-64.so"
27
21
libdirs=$(list_libdirs)
28
libdirs=$(list_libdirs)
22
if has lib32 ${libdirs} && has lib64 ${libdirs}; then
29
if has lib32 ${libdirs} && has lib64 ${libdirs}; then
23
	IS_MULTILIB="true"
30
	IS_MULTILIB="true"
Lines 63-68 Link Here
63
		echo "${vm} ${mark}"
70
		echo "${vm} ${mark}"
64
	}
71
	}
65
72
73
	tweak_user_list_item() {
74
		local vm=${1}
75
		local user_name=${2}
76
		local mark=""
77
		if [[ ${vm} == ${user_name} ]]; then
78
			mark="${mark} $(highlight 'current')"
79
		fi
80
		echo "${vm} ${mark}"
81
	}
82
66
	tweak_list() {
83
	tweak_list() {
67
		local targets=( ${@} )
84
		local targets=( ${@} )
68
		system_name=$(get_system_plugin_vm)
85
		system_name=$(get_system_plugin_vm)
Lines 81-87 Link Here
81
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${system_name})
98
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${system_name})
82
			done
99
			done
83
100
84
			write_list_start "Available Java browser plugins"
101
			write_list_start "Available System Java browser plugins"
102
			write_numbered_list "${targets[@]}"
103
			
104
			#"User mode"
105
			local user_name=$(get_user_plugin_vm)
106
			targets=( $(get_targets) )
107
			for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
108
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${user_name})
109
			done
110
111
			write_list_start "Avaliable User Java browser plugins"
85
			write_numbered_list "${targets[@]}"
112
			write_numbered_list "${targets[@]}"
86
		else
113
		else
87
			MULTILIB_MODE="32"
114
			MULTILIB_MODE="32"
Lines 90-97 Link Here
90
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
117
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
91
				targets_32[${i}]=$(tweak_list_item ${targets_32[${i}]} ${system_name_32})
118
				targets_32[${i}]=$(tweak_list_item ${targets_32[${i}]} ${system_name_32})
92
			done
119
			done
93
			write_list_start "Available 32-bit Java browser plugins"
120
			write_list_start "Available 32-bit System Java browser plugins"
94
			write_numbered_list "${targets_32[@]}" 
121
			write_numbered_list "${targets_32[@]}" 
122
			
123
			#USER MODE
124
			local user_name_32=$(get_user_plugin_vm)
125
			targets_32=( $(get_targets) )
126
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
127
				targets_32[${i}]=$(tweak_user_list_item ${targets_32[${i}]} ${user_name_32})
128
			done
129
			write_list_start "Available 32-bit User Java Browser plugins"
130
			write_numbered_list "${targets_32[@]}"
95
131
96
			MULTILIB_MODE="64"
132
			MULTILIB_MODE="64"
97
			local system_name_64=$(get_system_plugin_vm)
133
			local system_name_64=$(get_system_plugin_vm)
Lines 101-106 Link Here
101
			done
137
			done
102
			write_list_start "Available 64-bit Java browser plugins"
138
			write_list_start "Available 64-bit Java browser plugins"
103
			write_numbered_list "${targets_64[@]}"
139
			write_numbered_list "${targets_64[@]}"
140
			
141
			#"User MODE"
142
			local user_name_64=$(get_user_plugin_vm)
143
			targets_64=( $(get_targets) )
144
			for (( i = 0 ; i < ${#targets_64[@]} ; i = i +1 )) ; do
145
				targets_64[${i}]=$(tweak_user_list_item ${targets_64[${i}]} ${user_name_64})
146
			done
147
			write_list_start "Available	64-bit User Java Browser plugins"
148
			write_numbered_list	"${targets_64[@]}"
149
104
		fi
150
		fi
105
	}
151
	}
106
## }}}
152
## }}}
Lines 158-170 Link Here
158
			64) system_plugin=${SYSTEM_PLUGIN_64} ;;
204
			64) system_plugin=${SYSTEM_PLUGIN_64} ;;
159
			none) system_plugin=${SYSTEM_PLUGIN} ;;
205
			none) system_plugin=${SYSTEM_PLUGIN} ;;
160
		esac
206
		esac
161
		mkdir -p $(dirname ${system_plugin}) || die -q "Error creating \"$(dirname ${SYSTEM_PLUGIN})\""
207
		mkdir -p $(dirname ${system_plugin}) || die -q "Error creating
208
		\"$(dirname ${US_PLUGIN})\""
162
		if [[ -w $(dirname ${system_plugin}) ]] ; then
209
		if [[ -w $(dirname ${system_plugin}) ]] ; then
163
			ln -sf ${plugin} ${system_plugin} || die -q "Error creating nsplugin symlink"
210
			ln -sf ${plugin} ${system_plugin} || die -q "Error creating nsplugin symlink"
164
		else
211
		else
165
			die -q "Sorry, you don't have enough permission to set nsplugin"
212
			die -q "Sorry, you don't have enough permission to set the system nsplugin"
166
		fi
213
		fi
167
	}
214
	}
215
216
	describe_setuser() {
217
		echo "Set the user nsbrower plugin"
218
	}
219
220
	do_setuser() {
221
		if [[ ${IS_MULTILIB} != "true" ]]; then
222
			if [[ ${#} != 1 ]] ; then
223
				die -q "Usage: set [nsplugin-vm]"
224
			fi
225
			MULTILIB_MODE="none"
226
		else
227
			if [[ ${#} != 2 ]] ; then
228
				die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
229
			fi
230
			case ${1} in
231
				32bit) ;;
232
				64bit) ;;
233
				*)
234
					die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
235
					;;
236
			esac
237
			MULTILIB_MODE=${1%bit}
238
			shift
239
		fi
240
241
		local vm=${1}
242
243
		if is_number "${vm}" ; then
244
			local targets=( $(get_targets) )
245
			vm=${targets[$(( ${vm} - 1 ))]}
246
		fi
247
248
		if [[ -z ${vm} ]] ; then
249
			die -q "You didn't specify valid plugin number to set"
250
		fi
251
252
		local plugin="${PLUGINS_HOME}/${vm}-javaplugin.so"
253
254
		if [[ ! -f ${plugin} ]]; then
255
			write_error_msg "Expected \"${plugin}\" to exist, but it doesn't"
256
			write_error_msg "Perhaps \"${vm}\" isn't a valid name of VM build with nsplugin?"
257
			return
258
		fi
259
260
		local user_plugin
261
		case ${MULTILIB_MODE} in
262
			32) user_plugin=${USER_PLUGIN_32} ;;
263
			64) user_plugin=${USER_PLUGIN_64} ;;
264
			none) user_plugin="${USER_PLUGIN}" ;;
265
		esac
266
		mkdir -p $(dirname ${user_plugin}) || die -q "Error creating \"$(dirname ${USER_PLUGIN})\""
267
		if [[ -w $(dirname ${user_plugin}) ]] ; then
268
			ln -sf ${plugin} ${user_plugin} || die -q "Error creating nsplugin symlink"
269
		else
270
			die -q "Sorry, you don't have enough permissions to set this users nsplugin"
271
		fi
272
	}
273
168
## }}}
274
## }}}
169
275
170
get_targets() {
276
get_targets() {
Lines 205-208 Link Here
205
	plugin_to_vm ${plugin}
311
	plugin_to_vm ${plugin}
206
}
312
}
207
313
314
get_user_plugin_vm() {
315
	local plugin;
316
317
	if [[ ${MULTILIB_MODE} == "32" ]]; then
318
		plugin=$(readlink ${USER_PLUGIN_32})
319
	elif [[ ${MULTILIB_MODE} == "64" ]]; then
320
		plugin=$(readlink ${USER_PLUGIN_64})
321
	else
322
		plugin=$(readlink ${USER_PLUGIN})
323
	fi
324
	plugin_to_vm ${plugin}
325
}
326
208
# vim: ts=4 sw=4 noet fdm=marker
327
# vim: ts=4 sw=4 noet fdm=marker

Return to bug 148632