void-packages/srcpkgs/fcitx5/patches/no-which.patch
Đoàn Trần Công Danh 7c63ba7f05 fcitx5: update to 5.0.11.
2022-01-05 22:15:55 +07:00

188 lines
6.3 KiB
Diff

--- a/data/fcitx5-configtool.sh
+++ b/data/fcitx5-configtool.sh
@@ -5,14 +5,14 @@
export TEXTDOMAIN=fcitx5
-if which kdialog > /dev/null 2>&1; then
+if command -v kdialog > /dev/null 2>&1; then
message() {
kdialog --msgbox "$1"
}
error() {
kdialog --error "$1"
}
-elif which zenity > /dev/null 2>&1; then
+elif command -v zenity > /dev/null 2>&1; then
message() {
zenity --info --text="$1"
}
@@ -28,7 +28,7 @@ else
}
fi
-if which gettext > /dev/null 2>&1; then
+if command -v gettext > /dev/null 2>&1; then
_() {
gettext "$@"
}
@@ -108,7 +108,7 @@ detectDE() {
if [ x"$DE" = x"gnome" ]; then
# gnome-default-applications-properties is only available in GNOME 2.x
# but not in GNOME 3.x
- which gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3"
+ command -v gnome-default-applications-properties > /dev/null 2>&1 || DE="gnome3"
fi
}
@@ -119,7 +119,7 @@ run_kde() {
}
run_qt() {
- if which fcitx5-config-qt > /dev/null 2>&1; then
+ if command -v fcitx5-config-qt > /dev/null 2>&1; then
exec fcitx5-config-qt
fi
return 1
@@ -135,13 +135,13 @@ run_xdg() {
;;
esac
- if command="$(which xdg-open 2>/dev/null)"; then
+ if command="$(command -v xdg-open 2>/dev/null)"; then
exec "$command" "$HOME/.config/fcitx5"
fi
}
_which_cmdline() {
- cmd="$(which "$1")" || return 1
+ cmd="$(command -v "$1")" || return 1
shift
echo "$cmd $*"
}
--- a/data/fcitx5-diagnose.sh
+++ b/data/fcitx5-diagnose.sh
@@ -123,7 +123,7 @@ __get_pretty_name() {
fi
}
-fcitx_exe="$(which fcitx5 2> /dev/null)"
+fcitx_exe="$(command -v fcitx5 2> /dev/null)"
__conf_dir_init() {
# Don't do any fancy check here, it's the user's fault, which we should detect
@@ -214,9 +214,9 @@ if type dbus-send &> /dev/null; then
/controller org.fcitx.Fcitx.Controller1.DebugInfo 2> /dev/null) || return 1
echo -n "${debuginfo}"
}
-elif qdbus_exe=$(which qdbus 2> /dev/null) || \
- qdbus_exe=$(which qdbus-qt4 2> /dev/null) || \
- qdbus_exe=$(which qdbus-qt5 2> /dev/null); then
+elif qdbus_exe=$(command -v qdbus 2> /dev/null) || \
+ qdbus_exe=$(command -v qdbus-qt4 2> /dev/null) || \
+ qdbus_exe=$(command -v qdbus-qt5 2> /dev/null); then
dbus_exe=${qdbus_exe}
dbus_get_name_owner() {
"${qdbus_exe}" org.freedesktop.DBus /org/freedesktop/DBus \
@@ -345,15 +345,15 @@ detectDE() {
if [ x"$DE" = x"gnome" ]; then
# gnome-default-applications-properties is only available in GNOME 2.x
# but not in GNOME 3.x
- which gnome-default-applications-properties > /dev/null 2>&1 || \
+ command -v gnome-default-applications-properties > /dev/null 2>&1 || \
DE="gnome3"
- which gnome-shell &> /dev/null && DE="gnome3"
+ command -v gnome-shell &> /dev/null && DE="gnome3"
fi
}
maybe_gnome3() {
[[ $DE = gnome3 ]] && return 0
- [[ $DE = generic ]] && which gnome-shell &> /dev/null && return 0
+ [[ $DE = generic ]] && command -v gnome-shell &> /dev/null && return 0
return 1
}
@@ -362,7 +362,7 @@ detectDE
# user and uid
detect_user() {
- if which id &> /dev/null; then
+ if command -v id &> /dev/null; then
cur_user=$(id -un)
cur_uid=$(id -u)
else
@@ -373,7 +373,7 @@ detect_user() {
else
cur_uid=""
fi
- if which whoami &> /dev/null; then
+ if command -v whoami &> /dev/null; then
cur_user=$(whoami)
elif [[ -d /proc/$$/ ]]; then
cur_user=$(stat -c %U /proc/$$/)
@@ -395,7 +395,7 @@ _check_open_root() {
for f in /proc/1/environ /proc/1/mem /proc/kcore /proc/kmem; do
try_open "$f" && return 0
done
- if which readlink &> /dev/null; then
+ if command -v readlink &> /dev/null; then
for f in /proc/1/exe /proc/1/cwd /proc/1/root; do
readlink "$f" &> /dev/null && return 0
done
@@ -992,7 +992,7 @@ _find_config_gtk() {
return 0
}
local config_gtk
- config_gtk="$(which "fcitx5-config-gtk" 2> /dev/null)" || return 1
+ config_gtk="$(command -v "fcitx5-config-gtk" 2> /dev/null)" || return 1
echo "${config_gtk}"
_config_tool_gtk_exe="${config_gtk}"
}
@@ -1019,7 +1019,7 @@ _check_config_gtk() {
local version=$1
local config_gtk config_gtk_name
write_order_list_eval "$(_ 'Config GUI for gtk${1}:')" "${version}"
- if ! config_gtk="$(which "fcitx5-config-gtk${version}" 2> /dev/null)"; then
+ if ! config_gtk="$(command -v "fcitx5-config-gtk${version}" 2> /dev/null)"; then
if ! _check_config_gtk_version "${version}"; then
write_error_eval \
"$(_ 'Config GUI for gtk${1} not found.')" "${version}"
@@ -1040,7 +1040,7 @@ _check_config_qt() {
local config_qt config_qt_name
config_qt_name="fcitx5-config-qt"
write_order_list_eval "$(_ 'Config GUI for qt:')" "${version}"
- if ! config_qt="$(which "${config_qt_name}" 2> /dev/null)"; then
+ if ! config_qt="$(command -v "${config_qt_name}" 2> /dev/null)"; then
write_error "$(_ 'Config GUI for qt not found.')"
return 1
fi
@@ -1053,7 +1053,7 @@ _check_config_kcm() {
local version=$1
local kcm_shell config_kcm
write_order_list "$(_ 'Config GUI for kde:')"
- if ! kcm_shell="$(which "kcmshell${version}" 2> /dev/null)"; then
+ if ! kcm_shell="$(command -v "kcmshell${version}" 2> /dev/null)"; then
write_error "$(print_not_found "kcmshell${version}")"
return 1
fi
@@ -1069,7 +1069,7 @@ check_config_ui() {
local IFS=$'\n'
write_title 1 "$(_ 'Fcitx Configure UI:')"
write_order_list "$(_ 'Config Tool Wrapper:')"
- if ! fcitx_configtool="$(which fcitx5-configtool 2> /dev/null)"; then
+ if ! fcitx_configtool="$(command -v fcitx5-configtool 2> /dev/null)"; then
write_error_eval "$(_ 'Cannot find ${1} executable!')" fcitx5-configtool
else
write_eval "$(_ 'Found ${1} at ${2}.')" \
--- a/test/xvfb_wrapper.sh
+++ b/test/xvfb_wrapper.sh
@@ -20,7 +20,7 @@ finish()
trap finish EXIT
-if which xprop >/dev/null 2>&1; then
+if command -v xprop >/dev/null 2>&1; then
i=1
while [ "$i" -lt 5 ]; do
if xprop -root >/dev/null 2>&1; then