From 19a66ae2243531a62fce636497bdb136fa845a40 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 1 Nov 2005 16:47:04 +0000 Subject: [PATCH 1/1] slightly better orginization , only updating user/group when installing git-svn-id: svn://svn.open-ils.org/ILS/trunk@1929 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- install.sh | 67 ++++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 50 deletions(-) diff --git a/install.sh b/install.sh index 11b039843c..f4cc6ca092 100755 --- a/install.sh +++ b/install.sh @@ -48,62 +48,29 @@ function fail { # -------------------------------------------------------------------- # Makes sure the install directories exist and are writable # -------------------------------------------------------------------- -function mkInstallDirs { - - if installing; then - - mkdir -p "$PREFIX"; - if [ "$?" != "0" ]; then - fail "Error creating $PREFIX"; - fi - - if [ ! -w "$PREFIX" ]; then - fail "We don't have write access to $PREFIX"; - fi - fi - - if building; then - - mkdir -p "$TMP"; - if [ "$?" != "0" ]; then - fail "Error creating $TMP"; - fi - - if [ ! -w "$TMP" ]; then - fail "We don't have write access to $TMP"; - fi - fi - - if installing; then - mkdir -p "$SOCK"; - if [ "$?" != "0" ]; then - fail "Error creating $SOCK"; - fi - - if [ ! -w "$SOCK" ]; then - fail "We don't have write access to $SOCK"; - fi - fi +function mkDir { + mkdir -p "$1"; + [ "$?" != "0" ] && fail "Error creating $1"; + [ ! -w "$1" ] && fail "We don't have write access to $1"; +} - if installing; then - mkdir -p "$PID"; - if [ "$?" != "0" ]; then - fail "Error creating $PID"; - fi - if [ ! -w "$PID" ]; then - fail "We don't have write access to $PID"; - fi - fi +function mkInstallDirs { + installing && mkDir "$PREFIX"; + building && mkDir "$TMP"; + installing && mkDir "$SOCK"; + installing && mkDir "$PID"; + installing && mkDir "$LOG"; # add the opensrf user and group - if [ ! $(grep "^opensrf:" /etc/group) ]; then groupadd opensrf; fi - if [ ! $(grep "^opensrf:" /etc/passwd) ]; then useradd opensrf; fi - - # add opensrf to the opensrf group - gpasswd -a opensrf opensrf + if installing; then + if [ ! $(grep "^opensrf:" /etc/group) ]; then groupadd opensrf; fi + if [ ! $(grep "^opensrf:" /etc/passwd) ]; then useradd opensrf; fi + # add opensrf to the opensrf group + gpasswd -a opensrf opensrf + fi; } -- 2.43.2