From e1d2bcb1b9ba1dc178f753c4b41c4e75ef29b7f8 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 1 Nov 2011 17:32:11 +0100 Subject: [PATCH] Fixes. Fix mounting location at the right place. Fix rerun of the script. Start rsync. Fix permissions. --- stack.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/stack.sh b/stack.sh index 5cb5a18..a449255 100755 --- a/stack.sh +++ b/stack.sh @@ -623,10 +623,18 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]];then sudo mount ${s} fi + for x in {1..4}; do sudo ln -sf $s/$x ${SWIFT_LOCATION}/$x; done + # Create directories - sudo install -g stack -o stack -d /etc/swift /etc/swift/{object,container,account}-server \ - ${SWIFT_LOCATION}/{1..4}/node/sdb1 /var/run/swift ${s}/{1..4} + tmpd="" + for d in /etc/swift /etc/swift/{object,container,account}-server \ + ${SWIFT_LOCATION}/{1..4}/node/sdb1 /var/run/swift ${s}/{1..4};do + [[ -d $d ]] && continue + sudo install -g stack -o stack -d $d + done + sudo chown -R stack: ${SWIFT_LOCATION}/{1..4}/node + # Adjust rc.local to always have a /var/run/swift on reboot # created and chown to our user. # TODO (chmou): We may not have a "exit 0" @@ -638,8 +646,9 @@ exit 0 EOF # Add rsync file - sed -e "s/%SWIFT_LOCATION%/$SWIFT_LOCATION/" $FILES/swift-rsyncd.conf | sudo tee /etc/rsyncd.conf - + sed -e "s,%SWIFT_LOCATION%,$SWIFT_LOCATION," $FILES/swift-rsyncd.conf | sudo tee /etc/rsyncd.conf + sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync + # Copy proxy-server configuration cp $FILES/swift-proxy-server.conf /etc/swift/proxy-server.conf @@ -673,6 +682,9 @@ EOF sudo install -m755 $FILES/swift-startmain /usr/local/bin/ sudo chmod +x /usr/local/bin/swift-* + # Start rsync + sudo /etc/init.d/rsync restart || : + # Create ring /usr/local/bin/swift-remakerings