daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 68 in 25 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. INSTALLER_BIT="64"
  4. ORI_FILE_md5sum="8a191cd8a58c73edf2156879687a963c"
  5. ORI_FILE_LEN="187"
  6.  
  7. TPUT="`which tput`"
  8. if test -t 0 -a -t 1 -a -n "$TPUT"; then
  9.         CI="`$TPUT setf 6 || true`"; CE="`$TPUT setf 4 || true`"
  10.         CX="`$TPUT setf 2 || true`"; CN="`$TPUT sgr0 || true`"
  11. else    CI=''; CE=''; CX=''; CN=''
  12. fi
  13.  
  14. ###### Get system information ######
  15. AVAIL_SPACE=`df -k . | tail -n -1 |  awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
  16. DISPLAY_MODE=$DISPLAY
  17.  
  18. OS_BLOCKSIZE=`df -k . |head -n 1 | awk '{if ( $4 ~ /%/) { print $1 } else { print $2 } }'`
  19. OS_BIT=`getconf LONG_BIT`
  20. if [ -e /etc/os-release ]; then
  21.     OS_NAME=`cat /etc/os-release | grep ID | head -n 1 | awk -F= '{print $2}'`
  22.     OS_VERSION=`cat /etc/os-release | grep VERSION_ID | sed 's/\"//g' | awk -F= '{print $2}'`
  23. elif [ -e /etc/lsb-release ]; then
  24.     OS_NAME=`cat /etc/lsb-release | grep DISTRIB_ID | head -n 1 | awk -F= '{print $2}'`
  25.     OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | sed 's/\"//g' | awk -F= '{print $2}'`
  26. else
  27.     echo "${CE} Cannot find system information(No /etc/os-release, /etc/lsb-release). ${CN}"
  28.     exit 1
  29. fi
  30.  
  31. ###### Set SDK Installer bit ######
  32. INSTALLER_BIT_FLAG=`echo ${INSTALLER_BIT} 2>&1 | egrep -e 64`
  33. if [ -z "${INSTALLER_BIT_FLAG}" ]; then
  34.     INSTALLER_BIT=32
  35. else
  36.     INSTALLER_BIT=64
  37. fi
  38.  
  39. ###### Check SDK Installer bit ######
  40. if [ ${INSTALLER_BIT} != ${OS_BIT} ]; then
  41.     echo "${CE} Cannot execute the SDK Installer because of bit difference. ${CN}"
  42.     echo "${CE} You must use SDK Installer which is same as OS bit. ${CN}"
  43.     echo "${CE} Current OS bit : ${OS_BIT} ${CN}"
  44.     echo "${CE} Current SDK Installer bit : ${INSTALLER_BIT} ${CN}"
  45.     exit 1
  46. fi
  47.  
  48. ###### Set java bit ######
  49. JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
  50. JAVA_BIT_FLAG=$(java -version 2>&1 | egrep -e 64-Bit)
  51. if [ -z "${JAVA_BIT_FLAG}" ]; then
  52.     JAVA_BIT=32
  53. else
  54.     JAVA_BIT=64
  55. fi
  56. ####################################
  57.  
  58. #### Init Environment Variables ####
  59. CUR_DIR=`pwd`
  60. MYTIMESTAMP=`date +"%Y%m%d%H%M%S"`
  61. #OUT_PATH="/tmp/tizensdk_${MYTIMESTAMP}"
  62. OUT_PATH="$HOME/.package-manager/run/tizensdk_${MYTIMESTAMP}"
  63.  
  64. # list for pre installation check. Write including 'space'
  65. if [ "Ubuntu" = "${OS_NAME}" ] ; then
  66.     OS_NAME="ubuntu"
  67. fi
  68. if [ "ubuntu" = "${OS_NAME}" ] ; then
  69.     INSTALLATION_CHECK="grep zip"
  70. elif [ "fedora" = "${OS_NAME}" ]; then
  71.     INSTALLATION_CHECK="procps-ng gettext dbus-libs libcurl expect gtk2 grep zip make libgnome qemu-user webkitgtk libpng12"
  72. elif [ "tizen" = "${OS_NAME}" ] ; then
  73.     INSTALLATION_CHECK="procps-ng gettext-tools libdbus libcurl expect libgtk2 grep zip make libgnome2 qemu-linux-user libwebkitgtk2"
  74. fi
  75. pkg_list=""
  76.  
  77. # ubuntu version 10.x and 11.x and 12.x and 32bit
  78. if [ "ubuntu" = "${OS_NAME}" ] ; then  
  79.     NVIDIA_CHECK=`lspci | grep nVidia`
  80.     MESA_CHECK=`dpkg -l | egrep -e libgl1-mesa-glx' '`
  81. fi
  82. ####################################
  83.  
  84. ## check the available space ##
  85. ## kmk - 2015-02-09 : remove check the avaliable space.
  86. #if [ $AVAIL_SPACE -lt 5452596 ]; then
  87. #   echo "${CE} Available blocks: $AVAIL_SPACE($OS_BLOCKSIZE)    Needed blocks: about 5.2GB "
  88. #   echo " Please free up the required Disk Space and try again. $CN"
  89. #   exit 1
  90. #fi
  91.  
  92. ## check the root user ##
  93. if [ `whoami` = "root" ] ; then
  94.     echo "${CE} Do not install as 'root' user or 'su' commands. ${CN}"
  95.     exit 1
  96. fi
  97.  
  98. ## check the java installation ##
  99. if [ -z "${JAVA_VERSION}" ] ; then
  100.     echo "Java Development Kit (JDK) was not found on your computer."
  101.         echo "To use the Tizen SDK, you need to install the JDK 7 or later."
  102.     echo "Please go to http://www.oracle.com/technetwork/java/javase/downloads and download a JDK."
  103.     exit 1
  104. fi
  105.  
  106.  
  107. ## check the default java as OpenJDK ##
  108. #if [ "ubuntu" = "${OS_NAME}" ] ; then
  109. #   CHECK_OPENJDK=`java -version 2>&1 | egrep -e OpenJDK`
  110. #   if [ -n "${CHECK_OPENJDK}" ] ; then
  111. #       echo "${CE} OpenJDK is not supported. Try again with Oracle JDK. ${CN}"
  112. #       exit 1
  113. #   fi
  114. #fi
  115.  
  116. ## check the pre installation packages ##
  117. for INPUT_PKG_NAME in ${INSTALLATION_CHECK}
  118. do
  119.         if [ "ubuntu" = "${OS_NAME}" ] ; then
  120.                 CHECK_FLAG=`dpkg -l ${INPUT_PKG_NAME} 2>/dev/null | grep -e "^ii"`
  121.         elif [ "fedora" = "${OS_NAME}" ] || [ "tizen" = "${OS_NAME}" ] ; then
  122.                 CHECK_FLAG=`rpm -qi ${INPUT_PKG_NAME} 2>/dev/null | grep Name`
  123.         fi
  124.         if [ -z "${CHECK_FLAG}" ] ; then
  125.                 pkg_list="${pkg_list}\"${INPUT_PKG_NAME}\" "
  126.         fi
  127. done
  128. if [ -n "$pkg_list" ] ; then
  129.     echo "${CN} If you want to install TIZEN-SDK, you must install${CE} ${pkg_list} ${CN}package(s)."
  130.     exit 1
  131. fi
  132.  
  133. # platform bit and jdk bit equality is checked.
  134. if [ ${OS_BIT} != ${JAVA_BIT} ]; then
  135.     echo "The bit of java is different from the bit of your OS."
  136.     exit 1
  137. fi
  138.  
  139. ## check the mesa driver for emulator ##
  140. if [ "ubuntu" = "${OS_NAME}" ] ; then
  141.     if [ "10.10" = ${OS_VERSION} ] && [ -n "${NVIDIA_CHECK}" ] && [ -z "${MESA_CHECK}" ] ; then
  142.         echo "We recommend that you use the Mesa OpenGL implementation in Ubuntu 10.10 and nVidia enviroment."
  143.         echo "Please install${CE} libgl1-mesa-glx ${CN}package."
  144.         exit 1
  145.     fi
  146. fi
  147.  
  148. if [ -z "$DISPLAY" ]; then
  149.         echo "$CE If you want to install Tizen Studio, you must execute installer in GUI Environment. $CN"
  150.         exit 1
  151. fi
  152.  
  153. mkdir -p ${OUT_PATH}
  154. cd ${CUR_DIR}
  155. tail -n +"${ORI_FILE_LEN}" "$0" | tee >(md5sum>${OUT_PATH}/checksum) | tar xmz -C ${OUT_PATH}/
  156.  
  157. OUT_FILE_md5sum=`cat "$OUT_PATH/checksum" | awk '{ print $1 }'`
  158. if [ "${OUT_FILE_md5sum}" != "${ORI_FILE_md5sum}" ]; then
  159.     echo "$CE The download file appears to be corrupted. "
  160.     echo " Please do not attempt to install this archive file. $CN"
  161.     rm -rf ${OUT_PATH}
  162.     exit 1
  163. fi
  164. ## Get Script Path
  165.  
  166. ##Excute InstallManager
  167. pushd . > /dev/null
  168. SCRIPT_PATH="${BASH_SOURCE[0]}";
  169.   while([ -h "${SCRIPT_PATH}" ]) do
  170.     cd "`dirname "${SCRIPT_PATH}"`"
  171.     SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
  172.   done
  173. cd "`dirname "${SCRIPT_PATH}"`" > /dev/null
  174. SCRIPT_PATH="`pwd`";
  175. popd  > /dev/null
  176.  
  177. ##Set environment using GTK3
  178. export SWT_GTK3=1
  179.  
  180. cd $OUT_PATH
  181. ./installer.sh -path "$SCRIPT_PATH" "${@}"
  182.  
  183. ##source bashrc
  184. source ${HOME}/.bashrc
  185.  
  186. exit 0
RAW Paste Data
Top