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 ["Found %s"]="%s を見つけました"
56 ["Packages to cleanBuild? [n] :"]="パッケージをクリーンビルドしますか? [n] :"
57 ["Could not find all required packages:\n %s"]="必要なすべてのパッケージが見つかりませんでした %s"
58 ["This is a feature that has not been implemented yet"]="まだ実装されていない機能です"
60 ["(Orphaned)"]="(メンテナ不在)"
61 ["[Installed]"]="[インストール済み]"
62 ["This is a feature that has not been implemented yet"]="まだ実装されていない機能です"
64 ######################################################################################
77 aururl="https://aur.archlinux.org/"
80 #-- options (bool) --#
94 makepkg_command="/usr/bin/makepkg"
96 makepkg_config="/etc/makepkg.conf"
102 pacman_command="/usr/bin/pacman"
104 pacman_config="/etc/pacman.conf"
110 git_command="/usr/bin/git"
116 gpg_command="/usr/bin/gpg"
122 sudo_command="/usr/bin/sudo"
128 ######################################################################################
133 # https://github.com/FascodeNet/alterlinux/blob/dev/tools/msg.sh の変数名にアンダーバーを追加し関数化
135 local OPTIND OPTARG arg
137 local _appname="msg.sh"
138 local _bash_debug=false
142 local _msg_type="info"
144 local _label_space="7"
145 local _adjust_chr=" "
146 local _customized_label=false
147 local _customized_label_color=false
149 local _noappname=false
150 local _noadjust=false
151 local _output="stdout"
154 echo "usage msg [option] [type] [message]"
156 echo "Display a message with a colored app name and message type label"
158 echo " General type:"
159 echo " info General message"
160 echo " warn Warning message"
161 echo " error Error message"
162 echo " debug Debug message"
164 echo " General options:"
165 echo " -a [name] Specify the app name"
166 echo " -c [character] Specify the character to adjust the label"
167 echo " -l [label] Specify the label."
168 echo " -n | --nocolor No output colored output"
169 echo " -o [option] Specify echo options"
170 echo " -r [color] Specify the color of label"
171 echo " -s [number] Specifies the label space."
172 echo " -x | --bash-debug Enables output bash debugging"
173 echo " -h | --help This help message"
175 echo " --nolabel Do not output label"
176 echo " --noappname Do not output app name"
177 echo " --noadjust Do not adjust the width of the label"
180 while getopts "a:c:l:no:r:s:xh-:" arg; do
186 _adjust_chr="${OPTARG}"
189 _customized_label=true
190 _msg_label="${OPTARG}"
196 _echo_opts="${OPTARG}"
199 _customized_label_color=true
231 _label_space="${OPTARG}"
272 shift $((OPTIND - 1))
297 # You can specify multiple decorations with ;.
298 # 0 => All attributs off (ノーマル)
300 # 4 => Underscore (下線)
302 # 7 => Reverse video on (色反転)
309 [[ "${_customized_label_color}" = false ]] && _labelcolor="32"
310 [[ "${_customized_label}" = false ]] && _msg_label="Info"
316 [[ "${_customized_label_color}" = false ]] && _labelcolor="33"
317 [[ "${_customized_label}" = false ]] && _msg_label="Warning"
323 [[ "${_customized_label_color}" = false ]] && _labelcolor="35"
324 [[ "${_customized_label}" = false ]] && _msg_label="Debug"
330 [[ "${_customized_label_color}" = false ]] && _labelcolor="31"
331 [[ "${_customized_label}" = false ]] && _msg_label="Error"
335 echo "Please specify the message type" >&2
339 echo "Unknown message type" >&2
344 _word_count="${#_msg_label}"
349 if [[ "${_nolabel}" = false ]]; then
350 if [[ "${_noadjust}" = false ]]; then
351 for __time in $( seq 1 $(( ${_label_space} - ${_word_count})) ); do
352 echo -ne "${_adjust_chr}"
355 if [[ "${_nocolor}" = false ]]; then
356 echo -ne "\e[$([[ -v _backcolor ]] && echo -n "${_backcolor}"; [[ -v _labelcolor ]] && echo -n ";${_labelcolor}"; [[ -v _decotypes ]] && echo -n ";${_decotypes}")m${_msg_label}\e[m "
358 echo -ne "${_msg_label} "
364 if [[ "${_noappname}" = false ]]; then
365 if [[ "${_nocolor}" = false ]]; then
366 echo -ne "\e[36m[${_appname}]\e[m "
368 echo -ne "[${_appname}] "
373 for _count in $(seq "1" "$(echo -ne "${_message}\n" | wc -l)"); do
374 _echo_message=$(echo -ne "${_message}\n" |head -n "${_count}" | tail -n 1 )
375 _full_message="$(echo_appname)$(echo_type)${_echo_message}"
378 echo ${_echo_opts} "${_full_message}" >&1
381 echo ${_echo_opts} "${_full_message}" >&2
384 echo ${_echo_opts} "${_full_message}" > ${_output}
396 local _locale="$(echo "${LANG}" | cut -d "." -f 1)"
400 local _translated_text="$(eval echo '$'{${_locale}[\"${*}\"]})"
402 if [[ -z "${_translated_text}" ]]; then
405 echo "${_translated_text}"
409 local _text _fulltext=() _main
411 if declare -p "${_locale}" 2> /dev/null 1>/dev/null; then
412 _main="$(_get_text ${1})"
417 echo "$(printf "${_main}" "${@}")"
419 _msg_translate "${@}"
424 # Show an INFO message
427 if [[ "${msgdebug}" = false ]]; then
430 local _msg_opts="-a ${wfa_name}"
431 if [[ "${1}" = "-n" ]]; then
432 _msg_opts="${_msg_opts} -o -n"
435 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
436 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
437 msg ${_msg_opts} info "$(translate "${@}")"
438 if [[ "${bash_debug}" = true ]]; then
443 # Show an Warning message
446 if [[ "${msgdebug}" = false ]]; then
449 local _msg_opts="-a ${wfa_name}"
450 if [[ "${1}" = "-n" ]]; then
451 _msg_opts="${_msg_opts} -o -n"
454 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
455 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
456 msg ${_msg_opts} warn "$(translate "${@}")"
457 if [[ "${bash_debug}" = true ]]; then
462 # Show an debug message
465 if [[ "${msgdebug}" = false ]]; then
468 if [[ "${debug}" = true ]]; then
469 local _msg_opts="-a ${wfa_name}"
470 if [[ "${1}" = "-n" ]]; then
471 _msg_opts="${_msg_opts} -o -n"
474 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
475 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
476 msg ${_msg_opts} debug "$(translate "${@}")"
478 if [[ "${bash_debug}" = true ]]; then
483 # Show an ERROR message then exit with status
485 # $2: exit code number (with 0 does not exit)
487 if [[ "${msgdebug}" = false ]]; then
490 local _msg_opts="-a ${wfa_name}"
491 if [[ "${1}" = "-n" ]]; then
492 _msg_opts="${_msg_opts} -o -n"
495 [[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
496 [[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
497 msg ${_msg_opts} error "$(translate "${@}")"
498 if [[ "${bash_debug}" = true ]]; then
504 local OPTIND OPTARG arg _textcolor _decotypes=() _message
505 while getopts "c:b" arg; do
543 shift $((OPTIND - 1))
546 _message="$(translate "${@}")"
547 if [[ "${nocolor}" = true ]]; then
550 echo -ne "\e[$([[ -v _textcolor ]] && echo -n ";${_textcolor}"; [[ -v _decotypes ]] && echo -n ";${_decotypes}")m${_message}\e[m"
554 ######################################################################################
559 # Delete the file if it exists.
560 # For directories, rm -rf is used.
561 # If the file does not exist, skip it.
562 # remove <file> <file> ...
564 local _list=($(echo "$@")) _file
565 for _file in "${_list[@]}"; do
566 msg_debug "Removing ${_file}"
567 if [[ -f "${_file}" ]]; then
569 elif [[ -d "${_file}" ]]; then
576 local _pacman_help=false
581 echo "${wfa_command}"
582 echo "${wfa_command} <operation> [...]"
585 echo " ${wfa_command} {-h --help}"
586 echo " ${wfa_command} {-V --version}"
587 #echo " ${wfa_command} {-D --database} <options> <package(s)>"
588 #echo " ${wfa_command} {-F --files} [options] [package(s)]"
589 echo " ${wfa_command} {-Q --query} [options] [package(s)]"
590 echo " ${wfa_command} {-R --remove} [options] <package(s)>"
591 echo " ${wfa_command} {-S --sync} [options] [package(s)]"
592 #echo " ${wfa_command} {-T --deptest} [options] [package(s)]"
593 #echo " ${wfa_command} {-U --upgrade} [options] <file(s)>"
595 #echo "New operations:"
596 #echo " ${wfa_command} {-P --show} [options]"
597 #echo " ${wfa_command} {-G --getpkgbuild} [package(s)]"
600 echo " --repo Assume targets are from the repositories"
601 echo " -a --aur Assume targets are from the AUR"
603 echo "Permanent configuration options:"
604 echo " --aururl <url> Set an alternative AUR URL"
605 echo " --makepkg <file> makepkg command to use"
606 echo " --mflags <flags> Pass arguments to makepkg"
607 echo " --pacman <file> pacman command to use"
608 echo " --git <file> git command to use"
609 echo " --gitflags <flags> Pass arguments to git"
610 echo " --gpg <file> gpg command to use"
611 echo " --gpgflags <flags> Pass arguments to gpg"
612 echo " --config <file> pacman.conf file to use"
613 echo " --makepkgconf <file> makepkg.conf file to use"
614 echo " --nomakepkgconf Use the default makepkg.conf"
618 local _wfa_usage_sync
620 echo "usage: ${wfa_command} {-S --sync} [options] [package(s)]"
622 echo " -b, --dbpath <path> set an alternate database location"
623 echo " --config <path> set an alternate configuration file"
624 echo " --noconfirm do not ask for any confirmation"
628 if [[ "${operation}" = "none" ]]; then
630 elif [[ "${_pacman_help}" = true ]]; then
631 "${pacman_command}" -h --${operation}
632 elif [[ "$(type -t "_wfa_usage_${operation}" )" = "function" ]]; then
633 _wfa_usage_${operation}
635 msg_error "Undefined operation"
641 if [[ "${operation}" = "none" ]]; then
643 add_args pacman "--${operation}"
645 msg_error "only one operation may be used at a time"
651 if (( ${UID} == 0 )); then
659 run_sudo "${pacman_command}" ${@}
663 # https://github.com/FascodeNet/aptpac/blob/master/aptpac のADD_OPTION関数を参考
664 # Usage: add_args [pacman/makepkg] <args1> <args2>...
672 _args_array=(${makepkg_args})
674 makepkg_args=${_args_array[@]}
675 msg_debug "makepkg ARGS: ${makepkg_args}"
679 _args_array=(${pacman_args})
681 pacman_args=${_args_array[@]}
682 msg_debug "pacman ARGS: ${pacman_args}"
685 _args_array=(${mpg_args})
687 git_args=${_args_array[@]}
688 msg_debug "git ARGS: ${git_args}"
691 _args_array=(${gpg_args})
693 gpg_args=${_args_array[@]}
694 msg_debug "gpg ARGS: ${gpg_args}"
697 _args_array=(${sudo_args})
699 sudo_args=${_args_array[@]}
700 msg_debug "sudo ARGS: ${sudo_args}"
703 msg_error "Failed to set the argument of %s" "${_target}"
704 msg_error "Setting that command is not currently supported"
710 # 引数で指定されたパッケージがAUR以外の場所に存在しない場合にのみ正常終了します(AURのパッケージの場合に正常終了)
711 check_aur_package() {
712 local _package="${1}"
713 # 参考: https://qiita.com/Hayao0819/items/a8740a17301fafa2fdab
714 if [[ -z "$(pacman -Ssq "${_package}" 2>/dev/null | grep -o ".*${_package}$")" ]]; then
723 # 引数で指定されたパッケージが既にインストールされている場合は正常終了します。
724 check_installed_package() {
725 local _package="${1}"
726 if "${pacman_command}" -Qq "${_package}" > /dev/null 2>&1; then
733 # ~/.cacheに相当するディレクトリを返します
735 local _user_config_dir _cache_dir
736 if [[ -v XDG_CONFIG_HOME ]]; then
737 _user_config_dir="${XDG_CONFIG_HOME}"
739 _use_config_dir="${HOME}/.config"
741 if [[ -f "${_use_config_dir}/user-dirs.dirs" ]]; then
742 source "${_use_config_dir}/user-dirs.dirs"
744 if [[ -v XDG_CACHE_HOME ]]; then
745 _cache_dir="${XDG_CACHE_HOME}"
747 _cache_dir="${HOME}/.cache"
749 echo -n "${_cache_dir}"
752 # Usage: get_srcinfo_data <path> <var>
753 # 参考: https://qiita.com/withelmo/items/b0e1ffba639dd3ae18c0
755 local _srcinfo="${1}" _ver="${2}"
756 local _srcinfo_json=$(python << EOF
757 from srcinfo.parse import parse_srcinfo; import json
761 parsed, errors = parse_srcinfo(text)
762 print(json.dumps(parsed))
765 echo "${_srcinfo_json}" | jq -rc "${2}" | tr '\n' ' '
769 # AURからパッケージをビルドしてインストールします
770 # 現在1つのパッケージしか指定できません
771 install_aur_package() {
772 local _package="${1}"
775 if [[ ! -v wfa_cache_dir ]]; then
776 wfa_cache_dir="$(get_cache_dir)/wfa"
778 mkdir -p "${wfa_cache_dir}/archive"
779 mkdir -p "${wfa_cache_dir}/build/${_package}"
782 msg_info "Searching in AUR ..."
783 local _aur_json=$(curl -sL "https://aur.archlinux.org/rpc/?v=5&type=search&by=name&arg=${_package}" | jq -r)
784 if (( "$(echo "${_aur_json}" | jq -r ".resultcount")" == 0 )); then
785 msg_error "Could not find all required packages:\n ${_package}"
789 local _found_packages="$(echo "${_aur_json}" | jq -r --tab '.results[].Name')"
790 #msg_debug "Found package: $(echo ${_found_packages} | tr '\n' ' ')"
792 if [[ -n "$(echo "${_found_packages}" | grep -x "${_package}" )" ]]; then
793 msg_debug "Select a package %s with an exact name match" "${_package}"
795 msg_error "No package with an exact name match was found"
800 msg_info "Download PKGBUILD of %s" "${_package}"
801 _aur_json=$(echo "${_aur_json}" | jq -r ".results[] | select(.Name == \"${_package}\")" )
802 local _aur_snapshot_url="${aururl%/}$(echo "${_aur_json}" | jq -r ".URLPath")"
803 local _aur_version="$(echo "${_aur_json}" | jq -r ".Version")"
804 msg_debug "Get PKGBUILD from %s" "${_aur_snapshot_url}"
806 local _pkgbuild_archive_path="${wfa_cache_dir}/archive/${_package}-${_aur_version}"
807 local _download_pkgbuild=true
808 if [[ -f "${_pkgbuild_archive_path}" ]]; then
809 msg_warn "PKGBUILD has already been downloaded"
810 msg_warn -n "Do you want to overwrite and download? [n] :"
812 if [[ "${noconfirm}" = true ]]; then
818 case "${_yes_or_no}" in
819 "y" | "Y" | "yes" | "Yes" | "YES" ) _download_pkgbuild=true ;;
820 * ) _download_pkgbuild=false ;;
823 if [[ "${_download_pkgbuild}" = true ]]; then
824 remove "${_pkgbuild_archive_path}"
825 curl -L -C - -f -o "${_pkgbuild_archive_path}" "${_aur_snapshot_url}"
829 msg_info "Unpacking the tarball of PKGBUILD ..."
830 tar -xv -f "${_pkgbuild_archive_path}" -C "${wfa_cache_dir}/build/" > /dev/null 2>&1
833 local _build_dir="${wfa_cache_dir}/build/${_package}"
834 if [[ ! -f "${_build_dir}/.SRCINFO" ]]; then
835 msg_warn ".SRCINFO was not found.\nGenerating it using makepkg"
838 "${makepkg_command}" --printsrcinfo > "${_build_dir}/.SRCINFO"
842 local _makedepends="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".makedepends[]?")"
843 local _depends="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".depends[]?")"
844 local _conflicts="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".conflicts[]?")"
845 msg_debug "makedepends: %s" "${_makedepends}"
846 msg_debug "depends: %s" "${_depends}"
847 msg_debug "conflicts: %s " "${_conflicts}"
851 local _pkg _conflicts_found=false
852 for _pkg in ${_conflicts[@]}; do
853 if "${pacman_command}" -Qq "${_pkg}" > /dev/null 2>&1 ; then
854 _conflicts_found=true
855 msg_error "${_package} is colliding with ${_pkg}"
858 if "${pacman_command}" -Qq "${_package}" > /dev/null 2>&1 && [[ ! "$("${pacman_command}" -Qq "${_package}" 2> /dev/null)" = "${_package}" ]]; then
859 msg_error "${_package} is colliding with $("${pacman_command}" -Qq "${_package}")"
860 _conflicts_found=true
862 if [[ "${_conflicts_found}" = true ]]; then
863 msg_error "Conflict(s) was found"
869 if [[ "${nodeps}" = false ]]; then
870 msg_info "Install dependent packages..."
871 local _force_aur="${force_aur}"
873 install_package "${_depends}"
874 force_aur="${_force_aur}"
880 if [[ -d "${_build_dir}/src" ]]; then
881 msg_info "Found %s" "${_build_dir}/src"
882 msg_info -n "Packages to cleanBuild? [n] :"
885 if [[ "${noconfirm}" = true ]]; then
891 case "${_yes_or_no}" in
892 "y" | "Y" | "yes" | "Yes" | "YES" ) add_args makepkg "--clean" ;;
898 add_args "makepkg" "-sf"
901 "${makepkg_command}" "${makepkg_args}"
908 "${makepkg_command}" --printsrcinfo > "${_build_dir}/.SRCINFO"
910 local _pkgnames=($(get_srcinfo_data "${_build_dir}/.SRCINFO" ".packages | keys[]" | sed 's/ //g'))
911 local _pkgver="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".pkgver" | sed 's/ //g')"
912 local _pkgrel="$(get_srcinfo_data "${_build_dir}/.SRCINFO" ".pkgrel" | sed 's/ //g')"
913 local _arch_array=($(get_srcinfo_data "${_build_dir}/.SRCINFO" ".arch[]"))
915 if [[ "${_arch_array[*]}" = "any" ]]; then
921 source "${makepkg_config}"
924 local _pkgfilelist=()
925 for _pkgname in ${_pkgnames[@]}; do
926 _pkgfilelist+=("${_build_dir}/${_pkgname}-${_pkgver}-${_pkgrel}-${_arch}${_PKGEXT}")
930 run_pacman -U --noconfirm ${_pkgfilelist[@]}
934 search_aur_package() {
935 local _package="${1}"
936 #msg_info "Searching in AUR ..."
937 local _aur_json=$(curl -sL "https://aur.archlinux.org/rpc/?v=5&type=search&by=name-desc&arg=${_package}" | jq -r )
938 local _found_result_count="$(echo "${_aur_json}" | jq -r ".resultcount")"
939 if (( "${_found_result_count}" == 0 )); then
940 msg_error "Could not find all required packages:\n %s" "${_package}"
943 _aur_json=$(echo "${_aur_json}" | jq -r ".results[]")
945 local _found_pkgname=($(echo "${_aur_json}" | jq -r ".Name" ))
947 local _found_package __pkgver __popularity __vote __pkgdesc __orphaned __installed __output_text=()
948 for _found_package in ${_found_pkgname[@]}; do
951 _found_json="$(echo ${_aur_json} | jq "select(.Name == \"${_found_package}\")")"
953 #echo "${_found_json}"
954 __pkgver="$(echo "${_found_json}" | jq -r ".Version" )"
955 __popularity="$(echo "${_found_json}" | jq -r ".Popularity" )"
956 __vote="$(echo "${_found_json}" | jq -r ".NumVotes" )"
957 __pkgdesc="$(echo "${_found_json}" | jq -r ".Description" )"
960 # 参考: http://www.rivhiro-weather.com/knowledge/?p=536
961 msg_debug "Row popularity: %s" "${__popularity}"
962 __popularity="$(printf "%g\n" "${__popularity}" | awk '{printf("%4.2f", $1)}')"
965 #参考: https://www.366service.com/jp/qa/7c95f46e5236039134ff5b862ae2cd13
966 if ! echo "${_found_json}" | jq -r --exit-status ".Maintainer" 1> /dev/null 2> /dev/null ; then
971 if check_installed_package "${_found_package}"; then
976 "$(text -c blue -b "aur")/$(text -b "${_found_package}") $(text -c cyan "${__pkgver}") (+$(text -b "${__vote} ${__popularity}"))"
979 if [[ "${__orphaned}" = true ]]; then
980 __output_text+=("$(text -bc red "(Orphaned)")")
983 if [[ "${__installed}" = true ]]; then
984 __output_text+=("$(text -bc cyan "[Installed]")")
986 echo "${__output_text[*]}"
988 unset __pkgver __popularity __vote __pkgdesc _found_json __orphaned __installed __output_text
993 operation_version() {
994 # Pyalpmからlibalpmの値を取得
995 # 参考: https://pyalpm.readthedocs.io/en/latest/pyalpm/pyalpm.html
996 local _libalpm_version="$(python3 -c 'import pyalpm; print(pyalpm.alpmversion())')"
997 local _pacman_version="$("${pacman_command}" -Q pacman | cut -d ' ' -f 2)"
998 echo "wfa v${wfa_version} - pacman v${_pacman_version} - libalpm v${_libalpm_version}"
1001 operation_remove() {
1002 run_pacman ${pacman_args} "${specified_packages[@]}"
1005 # Usage: install_package <package1> <package2>...
1008 for _package in ${@}; do
1009 if ! check_installed_package "${_package}"; then
1010 if ! check_aur_package "${_package}"; then
1011 # 公式パッケージなのでpacmanでそのままインストール
1012 run_pacman ${pacman_args} "${_package}"
1015 install_aur_package "${_package}"
1016 #msg_error "Getting the AUR package has not been implemented yet.
1023 upgrade_aur_package() {
1025 msg_error "This is a feature that has not been implemented yet"
1030 if (( "${sync_clean_count}" >= 1 )); then
1031 remove "$(get_cache_dir)/wfa"
1032 run_pacman ${pacman_args} $(
1034 for _count in $(seq 1 ${sync_clean_count}); do
1041 if [[ "${sync_search}" = true ]]; then
1042 for _package in ${specified_packages[@]}; do
1043 search_aur_package "${_package}"
1045 "${pacman_command}" ${pacman_args} ${specified_packages[@]} || :
1047 if [[ "${sync_upgrade}" = true ]]; then
1049 run_pacman ${pacman_args} --sysupgrade
1051 for _package in ${specified_packages[@]}; do
1052 if ! check_aur_package "${_package}" && [[ "${force_aur}" = false ]]; then
1053 # 公式パッケージなのでpacmanでそのままインストール
1054 run_pacman ${pacman_args} "${_package}"
1057 install_aur_package "${_package}"
1058 #msg_error "Getting the AUR package has not been implemented yet."
1068 _opt_short="QRShVdb:aysuc"
1069 _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,color:,nocolor.clean"
1071 OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- ${ARGUMENT})
1072 [[ ${?} != 0 ]] && exit 1
1073 unset _opt_short _opt_long
1075 eval set -- "${OPT}"
1076 msg_debug "Argument: ${OPT}"
1081 set_operation "query"
1085 set_operation "remove"
1089 set_operation "sync"
1093 set_operation "version"
1106 eval set -- "${OPT}"
1112 msg_debug "Assume targets are from the AUR"
1117 add_args pacman "--debug"
1122 add_args pacman "--nodeps"
1126 add_args pacman "--dbpath '${2}'"
1130 option_y_count=$(( option_y_count + 1 ))
1134 add_args pacman "--search"
1143 sync_clean_count=$(( sync_clean_count + 1 ))
1151 add_args pacman "--noconfirm"
1156 pacman_config="${2}"
1157 add_args pacman "--config ${2}"
1161 makepkg_command="${2}"
1169 pacman_command="${2}"
1181 if [[ "${nomakepkgconf}" = false ]]; then
1182 makepkg_config="${2}"
1184 msg_warn "--nomakepkgconf is specified.\n--makepkgconf has been ignored."
1189 makepkg_config="/etc/makepkg.conf"
1206 add_args pacman "--color never"
1210 add_args pacman "--color always"
1213 msg_error "auto is not currently supported."
1214 add_args pacman "--color auto"
1220 add_args pacman "--color never"
1238 specified_packages=(${@})
1240 # Run database update
1241 if (( "${option_y_count}" == 1 )); then
1243 elif (( "${option_y_count}" >= 2 )); then
1247 case "${operation}" in
1261 msg_error "Undefined operation"