OSDN Git Service

[fix] : FIxed dependnce package installation
authorhayao <shun819.mail@gmail.com>
Sun, 20 Dec 2020 00:57:26 +0000 (09:57 +0900)
committerhayao <shun819.mail@gmail.com>
Sun, 20 Dec 2020 00:57:26 +0000 (09:57 +0900)
wfa

diff --git a/wfa b/wfa
index dc1025e..9c59183 100755 (executable)
--- a/wfa
+++ b/wfa
@@ -432,6 +432,16 @@ check_aur_package() {
 }
 
 
+# 引数で指定されたパッケージが既にインストールされている場合は正常終了します。
+check_installed_package() {
+    local _package="${1}"
+    if pacman -Qq "${_package}" 2> /dev/null 1>&2; then
+        return 0
+    else
+        return 1
+    fi
+}
+
 get_cache_dir() {
     local _user_config_dir
     if [[ -v XDG_CONFIG_HOME ]]; then
@@ -602,6 +612,22 @@ operation_remove() {
 install_package() {
     local _package
     for _package in ${@}; do
+        if ! check_installed_package "${_package}"; then
+            if ! check_aur_package "${_package}"; then
+                # 公式パッケージなのでpacmanでそのままインストール
+                run_pacman "${_package}"
+            else
+                # AUR上のパッケージの場合の処理
+                install_aur_package "${_package}"
+                #msg_error "Getting the AUR package has not been implemented yet." 1
+            fi
+        fi
+    done
+}
+
+operation_sync(){
+    local _package
+    for _package in ${specified_packages[@]}; do
         if ! check_aur_package "${_package}" && [[ "${force_aur}" = false ]]; then
             # 公式パッケージなのでpacmanでそのままインストール
             run_pacman "${_package}"
@@ -613,10 +639,6 @@ install_package() {
     done
 }
 
-operation_sync(){
-    install_package "${specified_packages[@]}"
-}
-
 
 # Parse options
 ARGUMENT="${@}"