LoginSignup
4
4

More than 5 years have passed since last update.

RPMがインストールされていなければyumする関数

Posted at

目的

Vagrantのprovisioningスクリプトで毎回毎回yumを走らせるのは微妙だと思ったのでrpmを挟んで確認することにした。

定義

install_unless_installed() {
  if rpm -qa $1 | grep -q $1; then
    true
  else
    yum install -y $1
  fi
}

使い方

$ install_unless_installed python-setuptools
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4