installAsterisk.sh 954 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. CIDIR=$(dirname $(readlink -fn $0))
  3. UNINSTALL=0
  4. UNINSTALL_ALL=0
  5. source $CIDIR/ci.functions
  6. MAKE=`which make`
  7. if [ x"$DESTDIR" != x ] ; then
  8. mkdir -p "$DESTDIR"
  9. fi
  10. destdir=${DESTDIR:+DESTDIR=$DESTDIR}
  11. [ $UNINSTALL -gt 0 ] && ${MAKE} ${destdir} uninstall
  12. [ $UNINSTALL_ALL -gt 0 ] && ${MAKE} ${destdir} uninstall-all
  13. ${MAKE} ${destdir} install || ${MAKE} ${destdir} NOISY_BUILD=yes install || exit 1
  14. ${MAKE} ${destdir} samples
  15. if [ x"$DESTDIR" != x ] ; then
  16. sed -i -r -e "s@\[directories\]\(!\)@[directories]@g" $DESTDIR/etc/asterisk/asterisk.conf
  17. sed -i -r -e "s@ /(var|etc|usr)/@ $DESTDIR/\1/@g" $DESTDIR/etc/asterisk/asterisk.conf
  18. fi
  19. set +e
  20. if [ x"$USER_GROUP" != x ] ; then
  21. chown -R $USER_GROUP $DESTDIR/var/lib/asterisk
  22. chown -R $USER_GROUP $DESTDIR/var/spool/asterisk
  23. chown -R $USER_GROUP $DESTDIR/var/log/asterisk
  24. chown -R $USER_GROUP $DESTDIR/var/run/asterisk
  25. chown -R $USER_GROUP $DESTDIR/etc/asterisk
  26. fi
  27. ldconfig