scrypted-install.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get -y install software-properties-common apt-utils
  15. $STD apt-get -y update
  16. $STD apt-get -y upgrade
  17. $STD apt-get install -y avahi-daemon
  18. $STD apt-get -y install \
  19. build-essential \
  20. gcc \
  21. gir1.2-gtk-3.0 \
  22. libcairo2-dev \
  23. libgirepository1.0-dev \
  24. libglib2.0-dev \
  25. libjpeg-dev \
  26. libgif-dev \
  27. libopenjp2-7 \
  28. libpango1.0-dev \
  29. librsvg2-dev \
  30. pkg-config \
  31. curl \
  32. sudo \
  33. mc
  34. msg_ok "Installed Dependencies"
  35. msg_info "Installing GStreamer"
  36. $STD apt-get -y install \
  37. gstreamer1.0-tools \
  38. libgstreamer1.0-dev \
  39. libgstreamer-plugins-base1.0-dev \
  40. libgstreamer-plugins-bad1.0-dev \
  41. gstreamer1.0-plugins-base \
  42. gstreamer1.0-plugins-good \
  43. gstreamer1.0-plugins-bad \
  44. gstreamer1.0-plugins-ugly \
  45. gstreamer1.0-libav \
  46. gstreamer1.0-alsa
  47. msg_ok "Installed GStreamer"
  48. msg_info "Setting up Node.js Repository"
  49. $STD bash <(curl -fsSL https://deb.nodesource.com/setup_18.x)
  50. msg_ok "Set up Node.js Repository"
  51. msg_info "Installing Node.js"
  52. $STD apt-get install -y nodejs
  53. msg_ok "Installed Node.js"
  54. msg_info "Updating Python3"
  55. $STD apt-get install -y \
  56. python3 \
  57. python3-dev \
  58. python3-pip
  59. msg_ok "Updated Python3"
  60. msg_info "Installing Python3 Dependencies"
  61. $STD apt-get -y install \
  62. python3-gi \
  63. python3-gst-1.0 \
  64. python3-matplotlib \
  65. python3-numpy \
  66. python3-opencv \
  67. python3-pil \
  68. python3-setuptools \
  69. python3-skimage \
  70. python3-wheel
  71. $STD python3 -m pip install --upgrade pip
  72. $STD python3 -m pip install aiofiles debugpy typing_extensions typing
  73. msg_ok "Installed Python3 Dependencies"
  74. read -r -p "Would you like to add Coral Edge TPU support? <y/N> " prompt
  75. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  76. msg_info "Adding Coral Edge TPU Support"
  77. $STD apt-key add <(curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg)
  78. sh -c 'echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list'
  79. $STD apt-get -y update
  80. $STD apt-get -y install libedgetpu1-std
  81. msg_ok "Coral Edge TPU Support Added"
  82. fi
  83. msg_info "Installing Scrypted"
  84. $STD sudo -u root npx -y scrypted@latest install-server
  85. msg_info "Installed Scrypted"
  86. msg_info "Creating Service"
  87. service_path="/etc/systemd/system/scrypted.service"
  88. echo "[Unit]
  89. Description=Scrypted service
  90. After=network.target
  91. [Service]
  92. User=root
  93. Group=root
  94. Type=simple
  95. ExecStart=/usr/bin/npx -y scrypted serve
  96. Restart=on-failure
  97. RestartSec=3
  98. [Install]
  99. WantedBy=multi-user.target" >$service_path
  100. $STD systemctl enable --now scrypted.service
  101. msg_ok "Created Service"
  102. motd_ssh
  103. customize
  104. msg_info "Cleaning up"
  105. $STD apt-get autoremove
  106. $STD apt-get autoclean
  107. msg_ok "Cleaned"