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 / +131 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 40-45 Link Here
40
		else
47
		else
41
		    write_kv_list_entry "${system_name}" ""
48
		    write_kv_list_entry "${system_name}" ""
42
		fi
49
		fi
50
51
		local user_name=$(get_user_plugin_vm)
52
		write_list_start "Current Java browser plugin"
53
		if [[ -z "${user_name}" ]] ; then
54
			write_kv_list_entry "(unset)" ""
55
		else
56
			write_kv_list_entry "${user_name}" ""
57
		fi
43
   	}
58
   	}
44
59
45
## }}}
60
## }}}
Lines 63-68 Link Here
63
		echo "${vm} ${mark}"
78
		echo "${vm} ${mark}"
64
	}
79
	}
65
80
81
	tweak_user_list_item() {
82
		local vm=${1}
83
		local user_name=${2}
84
		local mark=""
85
		if [[ ${vm} == ${user_name} ]]; then
86
			mark="${mark} $(highlight 'current')"
87
		fi
88
		echo "${vm} ${mark}"
89
	}
90
66
	tweak_list() {
91
	tweak_list() {
67
		local targets=( ${@} )
92
		local targets=( ${@} )
68
		system_name=$(get_system_plugin_vm)
93
		system_name=$(get_system_plugin_vm)
Lines 81-87 Link Here
81
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${system_name})
106
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${system_name})
82
			done
107
			done
83
108
84
			write_list_start "Available Java browser plugins"
109
			write_list_start "Available System Java browser plugins"
110
			write_numbered_list "${targets[@]}"
111
			
112
			#"User mode"
113
			local user_name=$(get_user_plugin_vm)
114
			targets=( $(get_targets) )
115
			for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
116
				targets[${i}]=$(tweak_list_item ${targets[${i}]} ${user_name})
117
			done
118
119
			write_list_start "Avaliable User Java browser plugins"
85
			write_numbered_list "${targets[@]}"
120
			write_numbered_list "${targets[@]}"
86
		else
121
		else
87
			MULTILIB_MODE="32"
122
			MULTILIB_MODE="32"
Lines 90-97 Link Here
90
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
125
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
91
				targets_32[${i}]=$(tweak_list_item ${targets_32[${i}]} ${system_name_32})
126
				targets_32[${i}]=$(tweak_list_item ${targets_32[${i}]} ${system_name_32})
92
			done
127
			done
93
			write_list_start "Available 32-bit Java browser plugins"
128
			write_list_start "Available 32-bit System Java browser plugins"
94
			write_numbered_list "${targets_32[@]}" 
129
			write_numbered_list "${targets_32[@]}" 
130
			
131
			#USER MODE
132
			local user_name_32=$(get_user_plugin_vm)
133
			targets_32=( $(get_targets) )
134
			for (( i = 0 ; i < ${#targets_32[@]} ; i = i + 1 )) ; do
135
				targets_32[${i}]=$(tweak_user_list_item ${targets_32[${i}]} ${user_name_32})
136
			done
137
			write_list_start "Available 32-bit User Java Browser plugins"
138
			write_numbered_list "${targets_32[@]}"
95
139
96
			MULTILIB_MODE="64"
140
			MULTILIB_MODE="64"
97
			local system_name_64=$(get_system_plugin_vm)
141
			local system_name_64=$(get_system_plugin_vm)
Lines 101-106 Link Here
101
			done
145
			done
102
			write_list_start "Available 64-bit Java browser plugins"
146
			write_list_start "Available 64-bit Java browser plugins"
103
			write_numbered_list "${targets_64[@]}"
147
			write_numbered_list "${targets_64[@]}"
148
			
149
			#"User MODE"
150
			local user_name_64=$(get_user_plugin_vm)
151
			targets_64=( $(get_targets) )
152
			for (( i = 0 ; i < ${#targets_64[@]} ; i = i +1 )) ; do
153
				targets_64[${i}]=$(tweak_user_list_item ${targets_64[${i}]} ${user_name_64})
154
			done
155
			write_list_start "Available	64-bit User Java Browser plugins"
156
			write_numbered_list	"${targets_64[@]}"
157
104
		fi
158
		fi
105
	}
159
	}
106
## }}}
160
## }}}
Lines 158-170 Link Here
158
			64) system_plugin=${SYSTEM_PLUGIN_64} ;;
212
			64) system_plugin=${SYSTEM_PLUGIN_64} ;;
159
			none) system_plugin=${SYSTEM_PLUGIN} ;;
213
			none) system_plugin=${SYSTEM_PLUGIN} ;;
160
		esac
214
		esac
161
		mkdir -p $(dirname ${system_plugin}) || die -q "Error creating \"$(dirname ${SYSTEM_PLUGIN})\""
215
		mkdir -p $(dirname ${system_plugin}) || die -q "Error creating
216
		\"$(dirname ${US_PLUGIN})\""
162
		if [[ -w $(dirname ${system_plugin}) ]] ; then
217
		if [[ -w $(dirname ${system_plugin}) ]] ; then
163
			ln -sf ${plugin} ${system_plugin} || die -q "Error creating nsplugin symlink"
218
			ln -sf ${plugin} ${system_plugin} || die -q "Error creating nsplugin symlink"
164
		else
219
		else
165
			die -q "Sorry, you don't have enough permission to set nsplugin"
220
			die -q "Sorry, you don't have enough permission to set the system nsplugin"
166
		fi
221
		fi
167
	}
222
	}
223
224
	describe_setuser() {
225
		echo "Set the user nsbrower plugin"
226
	}
227
228
	do_setuser() {
229
		if [[ ${IS_MULTILIB} != "true" ]]; then
230
			if [[ ${#} != 1 ]] ; then
231
				die -q "Usage: set [nsplugin-vm]"
232
			fi
233
			MULTILIB_MODE="none"
234
		else
235
			if [[ ${#} != 2 ]] ; then
236
				die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
237
			fi
238
			case ${1} in
239
				32bit) ;;
240
				64bit) ;;
241
				*)
242
					die -q "Usage: set [32bit or 64bit] [nsplugin-vm]"
243
					;;
244
			esac
245
			MULTILIB_MODE=${1%bit}
246
			shift
247
		fi
248
249
		local vm=${1}
250
251
		if is_number "${vm}" ; then
252
			local targets=( $(get_targets) )
253
			vm=${targets[$(( ${vm} - 1 ))]}
254
		fi
255
256
		if [[ -z ${vm} ]] ; then
257
			die -q "You didn't specify valid plugin number to set"
258
		fi
259
260
		local plugin="${PLUGINS_HOME}/${vm}-javaplugin.so"
261
262
		if [[ ! -f ${plugin} ]]; then
263
			write_error_msg "Expected \"${plugin}\" to exist, but it doesn't"
264
			write_error_msg "Perhaps \"${vm}\" isn't a valid name of VM build with nsplugin?"
265
			return
266
		fi
267
268
		local user_plugin
269
		case ${MULTILIB_MODE} in
270
			32) user_plugin=${USER_PLUGIN_32} ;;
271
			64) user_plugin=${USER_PLUGIN_64} ;;
272
			none) user_plugin="${USER_PLUGIN}" ;;
273
		esac
274
		mkdir -p $(dirname ${user_plugin}) || die -q "Error creating \"$(dirname ${USER_PLUGIN})\""
275
		if [[ -w $(dirname ${user_plugin}) ]] ; then
276
			ln -sf ${plugin} ${user_plugin} || die -q "Error creating nsplugin symlink"
277
		else
278
			die -q "Sorry, you don't have enough permissions to set this users nsplugin"
279
		fi
280
	}
281
168
## }}}
282
## }}}
169
283
170
get_targets() {
284
get_targets() {
Lines 205-208 Link Here
205
	plugin_to_vm ${plugin}
319
	plugin_to_vm ${plugin}
206
}
320
}
207
321
322
get_user_plugin_vm() {
323
	local plugin;
324
325
	if [[ ${MULTILIB_MODE} == "32" ]]; then
326
		plugin=$(readlink ${USER_PLUGIN_32})
327
	elif [[ ${MULTILIB_MODE} == "64" ]]; then
328
		plugin=$(readlink ${USER_PLUGIN_64})
329
	else
330
		plugin=$(readlink ${USER_PLUGIN})
331
	fi
332
	plugin_to_vm ${plugin}
333
}
334
208
# vim: ts=4 sw=4 noet fdm=marker
335
# vim: ts=4 sw=4 noet fdm=marker

Return to bug 148632