[Groonga-commit] long-long-float/droonga-engine at 87c2607 [master] Add check on whether user has already existed.

Zurück zum Archiv-Index

YUKI Hiroshi yuki****@clear*****
Fri Sep 5 11:07:56 JST 2014


ありがとうございます。idコマンドを使う方法に改めました!

https://github.com/droonga/droonga-engine/commit/9500b1778c0a4b14e7d83faa1f1e93ffc9db4813

Kouhei Sutou wrote:
>> +exist_user() {
>> +  grep "^$1:" /etc/passwd > /dev/null
>> +}
> 
> /etc/passwdをgrepするより
> 
>   getent passwd "$USER"
> 
> とか
> 
>   id "$USER"
> 
> とした方がポータブルですよ。
> 
> に存在するユーザーもチェックしてくれるので、/etc/passwdでは
> 存在しないと思ったけどuseraddしたらすでに存在した、というこ
> とがおきないと思います。
> 
> In <87c2607b725912da7179fe4efc259c598ecabd72 �� jenkins.clear-code.com>
>   "[Groonga-commit] long-long-float/droonga-engine �� 87c2607 [master] Add check on whether user has already existed." on Thu, 04 Sep 2014 01:32:12 +0900,
>   long-long-float <null+groonga �� clear-code.com> wrote:
> 
>> long-long-float	2014-09-04 01:32:12 +0900 (Thu, 04 Sep 2014)
>>
>>   New Revision: 87c2607b725912da7179fe4efc259c598ecabd72
>>   https://github.com/long-long-float/droonga-engine/commit/87c2607b725912da7179fe4efc259c598ecabd72
>>
>>   Merged e1158cd: Merge pull request #23 from long-long-float/safer-install-script
>>
>>   Message:
>>     Add check on whether user has already existed.
>>
>>   Modified files:
>>     script/install.sh
>>
>>   Modified: script/install.sh (+5 -1)
>> ===================================================================
>> --- script/install.sh    2014-09-03 18:03:42 +0900 (674073e)
>> +++ script/install.sh    2014-09-04 01:32:12 +0900 (d9584ed)
>> @@ -8,13 +8,17 @@ apt-get -y upgrade
>>  apt-get install -y ruby ruby-dev build-essential
>>  gem install droonga-engine
>>  
>> +exist_user() {
>> +  grep "^$1:" /etc/passwd > /dev/null
>> +}
>> +
>>  # fetch files
>>  SCRIPT_URL=https://raw.githubusercontent.com/droonga/droonga-engine/master/script
>>  curl -O $SCRIPT_URL/droonga-engine -O $SCRIPT_URL/droonga-engine.yaml
>>  
>>  # add droonga-engine user and create files
>>  USER=droonga-engine
>> -useradd -m $USER
>> +exist_user $USER || useradd -m $USER
>>  
>>  DROONGA_BASE_DIR=/home/$USER/droonga
>>  droonga-engine-catalog-generate --output=./catalog.json
> 
> _______________________________________________
> Groonga-commit mailing list
> Groonga-commit �� lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
> 

-- 
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com

株式会社クリアコード
〒170-0005 東京都豊島区南大塚3-29-9
           中野ビル3階
TEL : 03-5927-9440
FAX : 03-5927-9441
WWW : http://www.clear-code.com/




More information about the Groonga-commit mailing list
Zurück zum Archiv-Index