7 # Email : hayao@fascode.net
9 # (c) 2019-2020 Fascode Network.
13 # Wfa is a multilingual AUR helper written in bash that is being developed to replace yaourt
17 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
18 # Version 2, December 2004
20 # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
22 # Everyone is permitted to copy and distribute verbatim or modified
23 # copies of this license document, and changing it is allowed as long
24 # as the name is changed.
26 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
27 # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
29 # 0. You just DO WHAT THE FUCK YOU WANT TO.
36 ######################################################################################
40 ["Undefined operation"]="未定義のオペレーションです"
41 ["only one operation may be used at a time"]="一度に使用できるオペレーションは1つだけです"
42 ["Failed to set the argument of %s"]="%sの引数の設定に失敗しました"
43 ["Setting that command is not currently supported"]="そのコマンドの設定は現在サポートされていません"
44 ["Searching in AUR ..."]="AUR内を検索しています..."
45 ["No package with an exact name match was found"]="完全に一致する名前のパッケージが見つかりませんでした"
46 ["Select a package %s with an exact name match"]="名前が完全に一致するパッケージ %s を選択します"
47 ["Download PKGBUILD of %s"]="%s のPKGBUILDをダウンロード"
48 ["Get PKGBUILD from %s"]="%sからPKGBUILDを取得します"
49 ["PKGBUILD has already been downloaded"]="PKGBUILDは既にダウンロードされています"
50 ["Do you want to overwrite and download? [n] :"]="上書きダウンロードしますか? [n] :"
51 ["Unpacking the tarball of PKGBUILD ..."]="PKGBUILDを展開しています ..."
52 [".SRCINFO was not found.\nGenerating it using makepkg"]=".SCRINFOが見つかりませんでした。makepkgを使用して生成しています"
53 ["Conflict(s) was found"]="衝突が見つかりました"
54 ["Install dependent packages..."]="依存パッケージをインストールします..."
55 ["Packages to cleanBuild? [n] :"]="パッケージをクリーンビルドしますか? [n] :"
56 ["Could not find all required packages:\n %s"]="必要なすべてのパッケージが見つかりませんでした %s"
57 ["This is a feature that has not been implemented yet"]="まだ実装されていない機能です"
60 ["This is a feature that has not been implemented yet"]="まだ実装されていない機能です"
62 ######################################################################################
74 aururl="https://aur.archlinux.org/"
77 #-- options (bool) --#
91 makepkg_command="/usr/bin/makepkg"
93 makepkg_config="/etc/makepkg.conf"
99 pacman_command="/usr/bin/pacman"
101 pacman_config="/etc/pacman.conf"
107 git_command="/usr/bin/git"
113 gpg_command="/usr/bin/gpg"
119 sudo_command="/usr/bin/sudo"
125 ######################################################################################
130 # https://github.com/FascodeNet/alterlinux/blob/dev/tools/msg.sh の変数名にアンダーバーを追加し関数化
132 local OPTIND OPTARG arg
134 local _appname="msg.sh"
135 local _bash_debug=false
139 local _msg_type="info"
141 local _label_space="7"
142 local _adjust_chr=" "
143 local _customized_label=false
144 local _customized_label_color=false
146 local _noappname=false
147 local _noadjust=false
148 local _output="stdout"
151 echo "usage ${0} [option] [type] [message]"
153 echo "Display a message with a colored app name and message type label"
155 echo " General type:"
156 echo " info General message"
157 echo " warn Warning message"
158 echo " error Error message"
159 echo " debug Debug message"
161 echo " General options:"
162 echo " -a [name] Specify the app name"
163 echo " -c [character] Specify the character to adjust the label"
164 echo " -l [label] Specify the label."
165 echo " -n | --nocolor No output colored output"
166 echo " -o [option] Specify echo options"
167 echo " -r [color] Specify the color of label"
168 echo " -s [number] Specifies the label space."
169 echo " -x | --bash-debug Enables output bash debugging"
170 echo " -h | --help This help message"
172 echo " --nolabel Do not output label"
173 echo " --noappname Do not output app name"
174 echo " --noadjust Do not adjust the width of the label"
177 while getopts "a:c:l:no:r:s:xh-:" arg; do
183 _adjust_chr="${OPTARG}"
186 _customized_label=true
187 _msg_label="${OPTARG}"
193 _echo_opts="${OPTARG}"
196 _customized_label_color=true
228 _label_space="${OPTARG}"
269 shift $((OPTIND - 1))
294 # You can specify multiple decorations with ;.
295 # 0 => All attributs off (ノーマル)
297 # 4 => Underscore (下線)
299 # 7 => Reverse video on (色反転)
306 [[ "${_customized_label_color}" = false ]] && _labelcolor="32"
307 [[ "${_customized_label}" = false ]] && _msg_label="Info"
313 [[ "${_customized_label_color}" = false ]] && _labelcolor="33"
314 [[ "${_customized_label}" = false ]] && _msg_label="Warning"
320 [[ "${_customized_label_color}" = false ]] && _labelcolor="35"
321 [[ "${_customized_label}" = false ]] && _msg_label="Debug"
327 [[ "${_customized_label_color}" = false ]] && _labelcolor="31"
328 [[ "${_customized_label}" = false ]] && _msg_label="Error"
332 echo "Please specify the message type" >&2
336 echo "Unknown message type" >&2
341 _word_count="${#_msg_label}"
346 if [[ "${_nolabel}" = false ]]; then
347 if [[ "${_noadjust}" = false ]]; then
348 for __time in $( seq 1 $(( ${_label_space} - ${_word_count})) ); do
349 echo -ne "${_adjust_chr}"
352 if [[ "${_nocolor}" = false ]]; then
353 echo -ne "\e[$([[ -v _backcolor ]] && echo -n "${_backcolor}"; [[ -v _labelcolor ]] && echo -n ";${_labelcolor}"; [[ -v _decotypes ]] && echo -n ";${_decotypes}")m${_msg_label}\e[m "
355 echo -ne "${_msg_label} "
361 if [[ "${_noappname}" = false ]]; then
362 if [[ "${_nocolor}" = false ]]; then
363 echo -ne "\e[36m[${_appname}]\e[m "
365 echo -ne "[${_appname}] "
370 for _count in $(seq "1" "$(echo -ne "${_message}\n" | wc -l)"); do
371 _echo_message=$(echo -ne "${_message}\n" |head -n "${_count}" | tail -n 1 )
372 _full_message="$(echo_appname)$(echo_type)${_echo_message}"
375 echo ${_echo_opts} "${_full_message}" >&1
378 echo ${_echo_opts} "${_full_message}" >&2
381 echo ${_echo_opts} "${_full_message}" > ${_output}
393 local _locale="$(echo "${LANG}" | cut -d "." -f 1)"
397 local _translated_text="$(eval echo '$'{${_locale}[\"${*}\"]})"
399 if [[ -z "${_translated_text}" ]]; then
402 echo "${_translated_text}"
406 local _text _fulltext=() _main
408 if declare -p "${_locale}" 2> /dev/null 1>/dev/null; then
409 _main="$(_get_text ${1})"
414 echo "$(printf "${_main}" "${@}")"
416 _msg_translate "${@}"
421 # Show an INFO message
424 if [[ "${msgdebug}" = false ]]; then
427 local _msg_opts="-a ${wfa_name}"
428 if [[ "${1}" = "-n" ]]; then
429 _msg_opts="${_msg_opts} -o -n"
432 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
433 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
434 msg ${_msg_opts} info "$(translate "${@}")"
435 if [[ "${bash_debug}" = true ]]; then
440 # Show an Warning message
443 if [[ "${msgdebug}" = false ]]; then
446 local _msg_opts="-a ${wfa_name}"
447 if [[ "${1}" = "-n" ]]; then
448 _msg_opts="${_msg_opts} -o -n"
451 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
452 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
453 msg ${_msg_opts} warn "$(translate "${@}")"
454 if [[ "${bash_debug}" = true ]]; then
459 # Show an debug message
462 if [[ "${msgdebug}" = false ]]; then
465 if [[ "${debug}" = true ]]; then
466 local _msg_opts="-a ${wfa_name}"
467 if [[ "${1}" = "-n" ]]; then
468 _msg_opts="${_msg_opts} -o -n"
471 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
472 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
473 msg ${_msg_opts} debug "$(translate "${@}")"
475 if [[ "${bash_debug}" = true ]]; then
480 # Show an ERROR message then exit with status
482 # $2: exit code number (with 0 does not exit)
484 if [[ "${msgdebug}" = false ]]; then
487 local _msg_opts="-a ${wfa_name}"
488 if [[ "${1}" = "-n" ]]; then
489 _msg_opts="${_msg_opts} -o -n"
492 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
493 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
494 msg ${_msg_opts} error "$(translate "${@}")"
495 if [[ "${bash_debug}" = true ]]; then
500 ######################################################################################
505 # Delete the file if it exists.
506 # For directories, rm -rf is used.
507 # If the file does not exist, skip it.
508 # remove <file> <file> ...
510 local _list=($(echo "$@")) _file
511 for _file in "${_list[@]}"; do
512 msg_debug "Removing ${_file}"
513 if [[ -f "${_file}" ]]; then
515 elif [[ -d "${_file}" ]]; then
522 local _pacman_help=false
527 echo "${wfa_command}"
528 echo "${wfa_command} <operation> [...]"
531 echo " ${wfa_command} {-h --help}"
532 echo " ${wfa_command} {-V --version}"
533 #echo " ${wfa_command} {-D --database} <options> <package(s)>"
534 #echo " ${wfa_command} {-F --files} [options] [package(s)]"
535 echo " ${wfa_command} {-Q --query} [options] [package(s)]"
536 echo " ${wfa_command} {-R --remove} [options] <package(s)>"
537 echo " ${wfa_command} {-S --sync} [options] [package(s)]"
538 #echo " ${wfa_command} {-T --deptest} [options] [package(s)]"
539 #echo " ${wfa_command} {-U --upgrade} [options] <file(s)>"
541 #echo "New operations:"
542 #echo " ${wfa_command} {-P --show} [options]"
543 #echo " ${wfa_command} {-G --getpkgbuild} [package(s)]"
546 echo " --repo Assume targets are from the repositories"
547 echo " -a --aur Assume targets are from the AUR"
549 echo "Permanent configuration options:"
550 echo " --aururl <url> Set an alternative AUR URL"
551 echo " --makepkg <file> makepkg command to use"
552 echo " --mflags <flags> Pass arguments to makepkg"
553 echo " --pacman <file> pacman command to use"
554 echo " --git <file> git command to use"
555 echo " --gitflags <flags> Pass arguments to git"
556 echo " --gpg <file> gpg command to use"
557 echo " --gpgflags <flags> Pass arguments to gpg"
558 echo " --config <file> pacman.conf file to use"
559 echo " --makepkgconf <file> makepkg.conf file to use"
560 echo " --nomakepkgconf Use the default makepkg.conf"
564 local _wfa_usage_sync
566 echo "usage: ${wfa_command} {-S --sync} [options] [package(s)]"
568 echo " -b, --dbpath <path> set an alternate database location"
569 echo " --config <path> set an alternate configuration file"
570 echo " --noconfirm do not ask for any confirmation"
574 if [[ "${operation}" = "none" ]]; then
576 elif [[ "${_pacman_help}" = true ]]; then
577 "${pacman_command}" -h --${operation}
578 elif [[ "$(type -t "_wfa_usage_${operation}" )" = "function" ]]; then
579 _wfa_usage_${operation}
581 msg_error "Undefined operation"
587 if [[ "${operation}" = "none" ]]; then
589 add_args pacman "--${operation}"
591 msg_error "only one operation may be used at a time"
597 if (( ${UID} == 0 )); then
605 run_sudo "${pacman_command}" ${@}
609 # https://github.com/FascodeNet/aptpac/blob/master/aptpac のADD_OPTION関数を参考
610 # Usage: add_args [pacman/makepkg] <args1> <args2>...
618 _args_array=(${makepkg_args})
620 makepkg_args=${_args_array[@]}
621 msg_debug "makepkg ARGS: ${makepkg_args}"
625 _args_array=(${pacman_args})
627 pacman_args=${_args_array[@]}
628 msg_debug "pacman ARGS: ${pacman_args}"
631 _args_array=(${mpg_args})
633 git_args=${_args_array[@]}
634 msg_debug "git ARGS: ${git_args}"
637 _args_array=(${gpg_args})
639 gpg_args=${_args_array[@]}
640 msg_debug "gpg ARGS: ${gpg_args}"
643 _args_array=(${sudo_args})
645 sudo_args=${_args_array[@]}
646 msg_debug "sudo ARGS: ${sudo_args}"
649 msg_error "Failed to set the argument of %s" "${_target}"
650 msg_error "Setting that command is not currently supported"
656 # 引数で指定されたパッケージがAUR以外の場所に存在しない場合にのみ正常終了します(AURのパッケージの場合に正常終了)
657 check_aur_package() {
658 local _package="${1}"
659 # 参考: https://qiita.com/Hayao0819/items/a8740a17301fafa2fdab
660 if [[ -z "$(pacman -Ssq "${_package}" 2>/dev/null | grep -o ".*${_package}$")" ]]; then
669 # 引数で指定されたパッケージが既にインストールされている場合は正常終了します。
670 check_installed_package() {
671 local _package="${1}"
672 if "${pacman_command}" -Qq "${_package}" > /dev/null 2>&1; then
680 local _user_config_dir _cache_dir
681 if [[ -v XDG_CONFIG_HOME ]]; then
682 _user_config_dir="${XDG_CONFIG_HOME}"
684 _use_config_dir="${HOME}/.config"
686 if [[ -f "${_use_config_dir}/user-dirs.dirs" ]]; then
687 source "${_use_config_dir}/user-dirs.dirs"
689 if [[ -v XDG_CACHE_HOME ]]; then
690 _cache_dir="${XDG_CACHE_HOME}"
692 _cache_dir="${HOME}/.cache"
694 echo -n "${_cache_dir}"
697 # Usage: get_srcinfo_data <path> <var>
698 # 参考: https://qiita.com/withelmo/items/b0e1ffba639dd3ae18c0
700 local _srcinfo="${1}" _ver="${2}"
701 local _srcinfo_json=$(python << EOF
702 from srcinfo.parse import parse_srcinfo; import json
706 parsed, errors = parse_srcinfo(text)
707 print(json.dumps(parsed))
710 echo "${_srcinfo_json}" | jq -rc "${2}" | tr '\n' ' '
714 # AURからパッケージをビルドしてインストールします
715 # 現在1つのパッケージしか指定できません
716 install_aur_package() {
717 local _package="${1}"
720 if [[ ! -v wfa_cache_dir ]]; then
721 wfa_cache_dir="$(get_cache_dir)/wfa"
723 mkdir -p "${wfa_cache_dir}/archive"
724 mkdir -p "${wfa_cache_dir}/build/${_package}"
727 msg_info "Searching in AUR ..."
728 local _aur_json=$(curl -sL "https://aur.archlinux.org/rpc/?v=5&type=search&by=name&arg=${_package}" | jq -r)
729 if (( "$(echo "${_aur_json}" | jq -r ".resultcount")" == 0 )); then
730 msg_error "Could not find all required packages:\n ${_package}"
734 local _found_packages="$(echo "${_aur_json}" | jq -r --tab '.results[].Name')"
735 #msg_debug "Found package: $(echo ${_found_packages} | tr '\n' ' ')"
737 if [[ -n "$(echo "${_found_packages}" | grep -x "${_package}" )" ]]; then
738 msg_debug "Select a package %s with an exact name match" "${_package}"
740 msg_error "No package with an exact name match was found"
745 msg_info "Download PKGBUILD of %s" "${_package}"
746 _aur_json=$(echo "${_aur_json}" | jq -r ".results[] | select(.Name == \"${_package}\")" )
747 local _aur_snapshot_url="${aururl%/}$(echo "${_aur_json}" | jq -r ".URLPath")"
748 local _aur_version="$(echo "${_aur_json}" | jq -r ".Version")"
749 msg_debug "Get PKGBUILD from %s" "${_aur_snapshot_url}"
751 local _pkgbuild_archive_path="${wfa_cache_dir}/archive/${_package}-${_aur_version}"
752 local _download_pkgbuild=true
753 if [[ -f "${_pkgbuild_archive_path}" ]]; then
754 msg_warn "PKGBUILD has already been downloaded"
755 msg_warn -n "Do you want to overwrite and download? [n] :"
757 if [[ "${noconfirm}" = true ]]; then
763 case "${_yes_or_no}" in
764 "y" | "Y" | "yes" | "Yes" | "YES" ) _download_pkgbuild=true ;;
765 * ) _download_pkgbuild=false ;;
768 if [[ "${_download_pkgbuild}" = true ]]; then
769 remove "${_pkgbuild_archive_path}"
770 curl -L -C - -f -o "${_pkgbuild_archive_path}" "${_aur_snapshot_url}"
774 msg_info "Unpacking the tarball of PKGBUILD ..."
775 tar -xv -f "${_pkgbuild_archive_path}" -C "${wfa_cache_dir}/build/" > /dev/null 2>&1
778 local _build_dir="${wfa_cache_dir}/build/${_package}"
779 if [[ ! -f "${_build_dir}/.SRCINFO" ]]; then
780 msg_warn ".SRCINFO was not found.\nGenerating it using makepkg"
783 "${makepkg_command}" --printsrcinfo > "${_build_dir}/.SRCINFO"
787 local _makedepends="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".makedepends[]?")"
788 local _depends="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".depends[]?")"
789 local _conflicts="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".conflicts[]?")"
790 msg_info "makedepends: %s" "${_makedepends}"
791 msg_info "depends: %s" "${_depends}"
792 msg_info "conflicts: %s " "${_conflicts}"
796 local _pkg _conflicts_found=false
797 for _pkg in ${_conflicts[@]}; do
798 if "${pacman_command}" -Qq "${_pkg}" > /dev/null 2>&1 ; then
799 _conflicts_found=true
800 msg_error "${_package} is colliding with ${_pkg}"
803 if "${pacman_command}" -Qq "${_package}" > /dev/null 2>&1 && [[ ! "$("${pacman_command}" -Qq "${_package}" 2> /dev/null)" = "${_package}" ]]; then
804 msg_error "${_package} is colliding with $("${pacman_command}" -Qq "${_package}")"
805 _conflicts_found=true
807 if [[ "${_conflicts_found}" = true ]]; then
808 msg_error "Conflict(s) was found"
814 if [[ "${nodeps}" = false ]]; then
815 msg_info "Install dependent packages..."
816 local _force_aur="${force_aur}"
818 install_package "${_depends}"
819 force_aur="${_force_aur}"
825 if [[ -d "${_build_dir}/src" ]]; then
826 msg_info "Found ${_build_dir}/src"
827 msg_info -n "Packages to cleanBuild? [n] :"
830 if [[ "${noconfirm}" = true ]]; then
836 case "${_yes_or_no}" in
837 "y" | "Y" | "yes" | "Yes" | "YES" ) add_args makepkg "--clean" ;;
843 add_args "makepkg" "-sf"
846 "${makepkg_command}" "${makepkg_args}"
853 "${makepkg_command}" --printsrcinfo > "${_build_dir}/.SRCINFO"
855 local _pkgnames=($(get_srcinfo_data "${_build_dir}/.SRCINFO" ".packages | keys[]" | sed 's/ //g'))
856 local _pkgver="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".pkgver" | sed 's/ //g')"
857 local _pkgrel="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".pkgrel" | sed 's/ //g')"
858 local _arch_array=($(get_srcinfo_data "${_build_dir}/.SRCINFO" ".arch[]"))
860 if [[ "${_arch_array[*]}" = "any" ]]; then
866 source "${makepkg_config}"
869 local _pkgfilelist=()
870 for _pkgname in ${_pkgnames[@]}; do
871 _pkgfilelist+=("${_build_dir}/${_pkgname}-${_pkgver}-${_pkgrel}-${_arch}${_PKGEXT}")
875 run_pacman -U --noconfirm ${_pkgfilelist[@]}
879 search_aur_package() {
880 local _package="${1}"
881 msg_info "Searching in AUR ..."
882 local _aur_json=$(curl -sL "https://aur.archlinux.org/rpc/?v=5&type=search&by=name-desc&arg=${_package}" | jq -r )
883 local _found_result_count="$(echo "${_aur_json}" | jq -r ".resultcount")"
884 if (( "${_found_result_count}" == 0 )); then
885 msg_error "Could not find all required packages:\n %s" "${_package}"
888 _aur_json=$(echo "${_aur_json}" | jq -r ".results[]")
892 local _found_pkgname=($(echo "${_aur_json}" | jq -r ".Name" ))
897 local _found_package __pkgver __popularity __vote __pkgdesc
898 for _found_package in ${_found_pkgname[@]}; do
899 _found_json="$(echo ${_aur_json} | jq "select(.Name == \"${_found_package}\")")"
900 __pkgver="$(echo "${_found_json}" | jq -r ".Version" )"
901 __popularity="$(echo "${_found_json}" | jq -r ".Popularity" )"
902 __vote="$(echo "${_found_json}" | jq -r ".NumVotes" )"
903 __pkgdesc="$(echo "${_found_json}" | jq -r ".Description" )"
905 echo "aur/${_found_package} ${__pkgver} (+${__vote} ${__popularity})"
907 unset __pkgver __popularity __vote __pkgdesc _found_json
912 operation_version() {
913 # Pyalpmからlibalpmの値を取得
914 # 参考: https://pyalpm.readthedocs.io/en/latest/pyalpm/pyalpm.html
915 local _libalpm_version="$(python3 -c 'import pyalpm; print(pyalpm.alpmversion())')"
916 local _pacman_version="$("${pacman_command}" -Q pacman | cut -d ' ' -f 2)"
917 echo "wfa v${wfa_version} - pacman v${_pacman_version} - libalpm v${_libalpm_version}"
921 run_pacman ${pacman_args} "${specified_packages[@]}"
924 # Usage: install_package <package1> <package2>...
927 for _package in ${@}; do
928 if ! check_installed_package "${_package}"; then
929 if ! check_aur_package "${_package}"; then
930 # 公式パッケージなのでpacmanでそのままインストール
931 run_pacman ${pacman_args} "${_package}"
934 install_aur_package "${_package}"
935 #msg_error "Getting the AUR package has not been implemented yet.
942 upgrade_aur_package() {
944 msg_error "This is a feature that has not been implemented yet"
949 if [[ "${sync_search}" = true ]]; then
950 for _package in ${specified_packages[@]}; do
951 search_aur_package "${_package}"
953 "${pacman_command}" ${pacman_args} ${specified_packages[@]}
955 if [[ "${sync_upgrade}" = true ]]; then
957 run_pacman ${pacman_args} --sysupgrade
959 for _package in ${specified_packages[@]}; do
960 if ! check_aur_package "${_package}" && [[ "${force_aur}" = false ]]; then
961 # 公式パッケージなのでpacmanでそのままインストール
962 run_pacman ${pacman_args} "${_package}"
965 install_aur_package "${_package}"
966 #msg_error "Getting the AUR package has not been implemented yet."
976 _opt_short="QRShVdb:aysu"
977 _opt_long="query,remove,sync,help,version,debug,dbpath:,aururl,aur,noconfirm,config:,makepkg:,mflags:,pacman:,git:,gitflags:,gpg:,gpgflags:,makepkgconf:,nomakepkgconf,nodeps,refresh,bash-debug,msg-debug,sysupgrade"
979 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT})
980 [[ ${?} != 0 ]] && exit 1
981 unset _opt_short _opt_long
984 msg_debug "Argument: ${OPT}"
989 set_operation "query"
993 set_operation "remove"
1001 set_operation "version"
1014 eval set -- "${OPT}"
1020 msg_debug "Assume targets are from the AUR"
1025 add_args pacman "--debug"
1030 add_args pacman "--nodeps"
1034 add_args pacman "--dbpath '${2}'"
1038 option_y_count=$(( option_y_count + 1 ))
1042 add_args pacman "--search"
1055 add_args pacman "--noconfirm"
1060 pacman_config="${2}"
1061 add_args pacman "--config \"${2}\""
1065 makepkg_command="${2}"
1073 pacman_command="${2}"
1085 if [[ "${nomakepkgconf}" = false ]]; then
1086 makepkg_config="${2}"
1088 msg_warn "--nomakepkgconf is specified.\n--makepkgconf has been ignored."
1093 makepkg_config="/etc/makepkg.conf"
1121 specified_packages=(${@})
1123 # Run database update
1124 if (( "${option_y_count}" == 1 )); then
1126 elif (( "${option_y_count}" >= 2 )); then
1130 case "${operation}" in
1144 msg_error "Undefined operation"