diff options
Diffstat (limited to 'meta-openstack/recipes-support/deploychef/files/run-postinsts')
| -rw-r--r-- | meta-openstack/recipes-support/deploychef/files/run-postinsts | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/deploychef/files/run-postinsts b/meta-openstack/recipes-support/deploychef/files/run-postinsts new file mode 100644 index 0000000..35d46f0 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/run-postinsts | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # run-postinsts | ||
| 3 | # | ||
| 4 | # Copyright (c) 2014 Wind River Systems, Inc. | ||
| 5 | # | ||
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 7 | # of this software and associated documentation files (the "Software"), to deal | ||
| 8 | # in the Software without restriction, including without limitation the rights | ||
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 10 | # copies of the Software, and to permit persons to whom the Software is | ||
| 11 | # furnished to do so, subject to the following conditions: | ||
| 12 | # | ||
| 13 | # The above copyright notice and this permission notice shall be included in | ||
| 14 | # all copies or substantial portions of the Software. | ||
| 15 | |||
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 22 | # THE SOFTWARE. | ||
| 23 | # | ||
| 24 | # After chefsolo generates our config and scripts, we call this script | ||
| 25 | # to run the posinstall script and start the services | ||
| 26 | # | ||
| 27 | # | ||
| 28 | RPM_POSTINSTS_DIR=$1 | ||
| 29 | LOG_DIR='/var/log/%PACKAGE_NAME%/' | ||
| 30 | mkdir -p $LOG_DIR | ||
| 31 | if [ ! -d $RPM_POSTINSTS_DIR ]; then | ||
| 32 | echo "Post Install script dir not set" | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | cd / #work-around for cinder-volume config file location | ||
| 36 | echo "x$RPM_POSTINSTS_DIR" > "$LOD_DIR"log.run-postinsts | ||
| 37 | for i in `ls $RPM_POSTINSTS_DIR 2> /dev/null`; do | ||
| 38 | i=$RPM_POSTINSTS_DIR$i | ||
| 39 | echo "Running postinst $i..." | ||
| 40 | if [ -f $i ] && $i; then | ||
| 41 | rm $i | ||
| 42 | else | ||
| 43 | echo "ERROR: postinst $i failed. $? " >> "$LOG_DIR"log.run-postinsts | ||
| 44 | fi | ||
| 45 | done | ||
| 46 | |||
| 47 | |||
| 48 | #Start all the modules specified in startup-list | ||
| 49 | INITD_DIR=/etc/init.d/ | ||
| 50 | services=$(cat %DEPLOYCHEF_ROOT_DIR%/startup-list) | ||
| 51 | for service in $services; do | ||
| 52 | service=$(echo $service | awk -F'S..' '{print $2}') | ||
| 53 | if [ -e $INITD_DIR$service ]; then | ||
| 54 | if [ $service = 'cinder-volume' ]; then | ||
| 55 | $INITD_DIR$service reload | ||
| 56 | else | ||
| 57 | $INITD_DIR$service start | ||
| 58 | fi | ||
| 59 | sleep 1 | ||
| 60 | fi | ||
| 61 | done | ||
| 62 | |||
| 63 | #Restart cloud service cloud-init | ||
| 64 | /etc/init.d/cloud-init start | ||
