[Groonga-commit] droonga/droonga-http-server at 6f6f6d9 [master] Disable EPEL by default

Back to archive index

Kouhei Sutou kou****@clear*****
Wed Sep 17 10:03:49 JST 2014


> +  if [ $(yum repolist | grep epel | wc -l) -lt 1 ]; then

grepの終了ステータスを使うのはどうですか?

  if ! yum repolist | grep --quiet epel; then


> +    epel_repo=/etc/yum.repos.d/epel.repo
> +    backup=/tmp/$(basename $file).bak
> +    mv $epel_repo $backup
> +    cat $backup | $sed -e "s/enabled=1/enabled=0/" \
> +      > $epel_repo

sedには-i(in-place)というオプションがあって、それを使うと
一時ファイルを作らずに内容を書き換えることができるんですよ。
それを使うとこんな感じで書けますよ。

  $sed -i.bak -e "s/enabled=1/enabled=0/" $epel_repo


In <6f6f6d9ea67105d5e434d30fb7c90b5c06221201 �� jenkins.clear-code.com>
  "[Groonga-commit] droonga/droonga-http-server �� 6f6f6d9 [master] Disable EPEL by default" on Tue, 16 Sep 2014 19:14:09 +0900,
  YUKI Hiroshi <null+groonga �� clear-code.com> wrote:

> YUKI Hiroshi	2014-09-16 19:14:09 +0900 (Tue, 16 Sep 2014)
> 
>   New Revision: 6f6f6d9ea67105d5e434d30fb7c90b5c06221201
>   https://github.com/droonga/droonga-http-server/commit/6f6f6d9ea67105d5e434d30fb7c90b5c06221201
> 
>   Message:
>     Disable EPEL by default
> 
>   Modified files:
>     install.sh
> 
>   Modified: install.sh (+13 -7)
> ===================================================================
> --- install.sh    2014-09-16 18:54:56 +0900 (6e6f320)
> +++ install.sh    2014-09-16 19:14:09 +0900 (b9653fd)
> @@ -238,13 +238,19 @@ install_in_debian() {
>  }
>  
>  install_in_centos() {
> -  #TODO: We have to take care of a case when EPEL is already activated.
> -  #      If EPEL is not activated, we have to activate it temporally
> -  #      and disable it after installation.
> -  #      Otherwise we should not do anything around EPEL.
> -  yum -y update
> -  yum -y install epel-release
> -  yum -y install npm
> +  if [ $(yum repolist | grep epel | wc -l) -lt 1 ]; then
> +    # epel-release is not installed, so install it.
> +    yum -y install epel-release
> +    # however, we should disable it by default because.
> +    # the system administrator won't expect to use it
> +    # in his daily use.
> +    epel_repo=/etc/yum.repos.d/epel.repo
> +    backup=/tmp/$(basename $file).bak
> +    mv $epel_repo $backup
> +    cat $backup | $sed -e "s/enabled=1/enabled=0/" \
> +      > $epel_repo
> +  fi
> +  yum -y --enablerepo=epel install npm
>  
>    echo ""
>  




More information about the Groonga-commit mailing list
Back to archive index