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

Back to archive index

long-long-float null+****@clear*****
Thu Sep 4 01:32:12 JST 2014


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
-------------- next part --------------
HTML����������������������������...
다운로드 



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