check_tarball_standalone.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # Licensed to Cloudera, Inc. under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. Cloudera, Inc. licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. # Checks that the tarball at the given path can install without network access
  19. set -e
  20. if [ $# != 1 -o ! -f $1 ]; then
  21. echo usage: $0 path/to/hue.tgz
  22. exit 1
  23. fi
  24. TMP=$(mktemp -d)
  25. cleanup() {
  26. rm -Rf $TMP
  27. }
  28. trap cleanup EXIT
  29. echo "Unpacking tarball in $TMP..."
  30. cat $1 | (cd $TMP && tar xzf -)
  31. echo "Done"
  32. cd $TMP
  33. cd hue*
  34. PREFIX=$TMP/install-prefix \
  35. strace -f "-o|tee $TMP/install-trace" -econnect -e signal= \
  36. make install
  37. echo Checking for network accesses...
  38. if grep sa_family=AF_INET $TMP/install-trace ; then
  39. echo make install talked to the network!
  40. exit 1
  41. fi
  42. echo No network access detected. Hooray!