scrypted-install.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 "Installing Python3"
  55. $STD apt-get -y install \
  56. python3 \
  57. python3-dev \
  58. python3-gi \
  59. python3-gst-1.0 \
  60. python3-matplotlib \
  61. python3-numpy \
  62. python3-opencv \
  63. python3-pil \
  64. python3-pip \
  65. python3-setuptools \
  66. python3-skimage \
  67. python3-wheel
  68. $STD python3 -m pip install --upgrade pip
  69. $STD python3 -m pip install aiofiles debugpy typing_extensions typing
  70. msg_ok "Installed Python3"
  71. read -r -p "Would you like to add Coral Edge TPU support? <y/N> " prompt
  72. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  73. msg_info "Adding Coral Edge TPU Support"
  74. $STD apt-key add <(curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg)
  75. sh -c 'echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list'
  76. $STD apt-get -y update
  77. $STD apt-get -y install libedgetpu1-std
  78. msg_ok "Coral Edge TPU Support Added"
  79. fi
  80. msg_info "Installing Scrypted"
  81. $STD sudo -u root npx -y scrypted@latest install-server
  82. msg_info "Installed Scrypted"
  83. msg_info "Creating Service"
  84. service_path="/etc/systemd/system/scrypted.service"
  85. echo "[Unit]
  86. Description=Scrypted service
  87. After=network.target
  88. [Service]
  89. User=root
  90. Group=root
  91. Type=simple
  92. ExecStart=/usr/bin/npx -y scrypted serve
  93. Restart=on-failure
  94. RestartSec=3
  95. [Install]
  96. WantedBy=multi-user.target" >$service_path
  97. $STD systemctl enable --now scrypted.service
  98. msg_ok "Created Service"
  99. motd_ssh
  100. root
  101. msg_info "Cleaning up"
  102. $STD apt-get autoremove
  103. $STD apt-get autoclean
  104. msg_ok "Cleaned"