Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. TYPE="beta"
  4.  
  5. if [ "$TYPE" = "beta" ]; then
  6. PKG_URL="https://management-beta.rehivetech.com/client"
  7. SERVER_URL="management-beta.rehivetech.com"
  8. else
  9. PKG_URL="https://www.pixla.online/client"
  10. SERVER_URL="backend.pixla.online"
  11. fi
  12.  
  13. SYSTEM_ARCH=$(uname -m)
  14. TMP=$(basename "$0"| cut -d'-' -f 2-)
  15. TOKEN=$(echo "$TMP"| cut -d'.' -f 1)
  16. WORK_DIR="/tmp/pixla-client-install"
  17.  
  18. if [ "$(id -u)" != "0" ]; then
  19. echo "This script must be launched with root privileges. Running sudo." 1>&2
  20. sudo "$0"
  21. exit 1
  22. fi
  23.  
  24. if [ "$SYSTEM_ARCH" = "aarch64" ]; then
  25. PKG="pixla-client_armhf"
  26. elif [ "$SYSTEM_ARCH" = "armv7l" ]; then
  27. PKG="pixla-client_armhf"
  28. elif [ "$SYSTEM_ARCH" = "armv6l" ]; then
  29. PKG="pixla-client_armhf"
  30. elif [ "$SYSTEM_ARCH" = "x86_64" ]; then
  31. PKG="pixla-client_amd64"
  32. elif [ "$SYSTEM_ARCH" = "amd64" ]; then
  33. PKG="pixla-client_amd64"
  34. else
  35. echo "Your hardware is not supported. For more information contact us at info@rehivetech.com" 1>&2
  36. exit 1
  37. fi
  38.  
  39. if ! [ -x "$(command -v wget)" ]; then
  40. echo "Error: wget is not installed." 1>&2
  41. exit 1
  42. fi
  43.  
  44. mkdir -p /etc/pixla-client
  45. echo "$TOKEN" > /etc/pixla-client/token
  46.  
  47. PKG_URL=$PKG_URL/$PKG
  48.  
  49. rm -rf $WORK_DIR
  50. mkdir $WORK_DIR
  51. wget $PKG_URL -O $WORK_DIR/$PKG
  52. if [ $? -ne 0 ]; then
  53. echo "Pixla client could not be downloaded"
  54. exit 1
  55. fi
  56.  
  57. chmod +x $WORK_DIR/$PKG
  58.  
  59. cd $WORK_DIR && $WORK_DIR/$PKG
  60. if [ $? -ne 0 ]; then
  61. echo "Archive counld not be extracted"
  62. exit 1
  63. fi
  64.  
  65. $WORK_DIR/setup.sh
  66. if [ $? -ne 0 ]; then
  67. echo "Pixla client could not be installed"
  68. exit 1
  69. fi
  70.  
  71. if [ "$TYPE" = "beta" ]; then
  72. sed -i 's/backend.pixla.online/management-beta.rehivetech.com/g' /opt/pixla-client/gwtran.conf
  73. fi
  74.  
  75. rm -rf $WORK_DIR
  76.  
  77. echo "Installation was successful. Check your device at pixla.online"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement